1 """@namespace IMP.EMageFit.argminmax
2 Utility functions to extract min/max from the inputs.
7 """ Argmin function: Returns the pair (min_value,min_index),
8 where min_index is the index of the minimum value
10 min_value = sequence[0]
12 for i, s
in enumerate(sequence):
16 return min_value, min_index
20 """ return the key of the dictionary that has the minimum value """
21 ks = list(dictionary.keys())
23 min_value = dictionary[min_key]
25 if dictionary[k] < min_value:
26 min_value = dictionary[k]
28 return min_value, min_key
32 """ Argmax function: Returns the pair (max_value,max_index),
33 where max_index is the index of the maximum value
35 max_value = sequence[0]
37 for i, s
in enumerate(sequence):
41 return max_value, max_index
45 """ return the key of the dictionary that has the maximum value """
46 ks = list(dictionary.keys())
48 min_value = dictionary[max_key]
50 if dictionary[k] > min_value:
51 min_value = dictionary[k]
53 return min_value, max_key
def keymax
return the key of the dictionary that has the maximum value
def keymin
return the key of the dictionary that has the minimum value
def argmax
Argmax function: Returns the pair (max_value,max_index), where max_index is the index of the maximum ...
def argmin
Argmin function: Returns the pair (min_value,min_index), where min_index is the index of the minimum ...