module: topics¶
Support AGUP topics
-
class
Assign_GUP.topics.
Topics
[source]¶ Bases:
object
manage the list of AGUP topics (known here as
key
)-
addTopics
(key_list)[source]¶ add several topics at once (with default values)
Parameters: key_list ([str]) – list of topics (strings) to be added
-
compare
(other_topics_object)[source]¶ compare topics in self.topics with the other_topics_object, return True if identical
compares sorted list of topics between each object
Parameters: other_topics_object (obj) – instance of Topics()
-
diff
(other_topics_object)[source]¶ differences in list of topics between self.topics and other_topics_object
Comparison assumes that self.topics is the final result. Returned result shows topics added and removed from other_topics_object to obtain current list.
Parameters: other_topics_object (obj) – instance of Topics() Returns ([],[]): first list is topics added, second list is topics removed
-
dotProduct
(other)[source]¶ normalized dot product of Proposal (self) and Reviewer (other) topic strengths, \(\vec{p} \cdot \vec{r}\)
Parameters: other (obj) – instance of Topics() Returns: \(\sum{\vec{p} \cdot \vec{r}} / \sum{\vec{p}}\) - \(\vec{p}\) is array of topic value strengths for Proposal
- \(\vec{r}\) is array of topic value strengths for Reviewer
-
get
(key)[source]¶ return value of an existing topic (known here as
key
)topic must exist or KeyError exception will be raised
-
importXml
(xmlFile, read_values=True)[source]¶ Parameters: - filename (str) – name of XML file with Topics
- read_values (bool) – import topic values?
-
importXmlTopics
(parent_node, read_values=True)[source]¶ make this common code segment reuseable
Parameters: - parent_node (obj) – XML parent node
- read_values (bool) – import topic values?
-
removeTopics
(key_list)[source]¶ remove several topics at once
Parameters: key_list ([str]) – list of topics (strings) to be removed
-
-
Assign_GUP.topics.
checkTopicValueRange
(value)[source]¶ topic values must be 0..1 inclusive: standardize this check
Parameters: value (float) – topic value to be checked
-
Assign_GUP.topics.
diffLists
(new_list, old_list)[source]¶ differences between two lists, return tuple([items added], [items removed])
assumes each list had only unique entries, no redundancies
Parameters: - new_list ([str]) – new list of strings to be compared
- old_list ([str]) – old list of strings to be compared