1 """@namespace IMP.em2d.argminmax
2 Utility functions to extract min/max from the inputs.
6 """ Argmin function: Returns the pair (min_value,min_index),
7 where min_index is the index of the minimum value
9 min_value = sequence[0]
11 for i,s
in enumerate(sequence):
15 return min_value, min_index
18 """ return the key of the dictionary that has the minimum value """
19 ks = dictionary.keys()
21 min_value = dictionary[min_key]
23 if(dictionary[k] < min_value):
24 min_value = dictionary[k]
26 return min_value, min_key
31 """ Argmax function: Returns the pair (max_value,max_index),
32 where max_index is the index of the maximum value
34 max_value = sequence[0]
36 for i,s
in enumerate(sequence):
40 return max_value, max_index
44 """ return the key of the dictionary that has the maximum value """
45 ks = dictionary.keys()
47 min_value = dictionary[max_key]
49 if(dictionary[k] > min_value):
50 min_value = dictionary[k]
52 return min_value, max_key
def keymax
return the key of the dictionary that has the maximum value
def argmax
Argmax function: Returns the pair (max_value,max_index), where max_index is the index of the maximum ...
def keymin
return the key of the dictionary that has the minimum value