def find_sample_min_std(self, Intensities):
        '''
        find the best interpretation with the minimum stratard deviation (in units of percent % !)
        '''

        Best_array = []
        best_array_std_perc = inf
        Best_array_tmp = []
        Best_interpretations = {}
        Best_interpretations_tmp = {}
        for this_specimen in list(Intensities.keys()):
            for value in Intensities[this_specimen]:
                Best_interpretations_tmp[this_specimen] = value
                Best_array_tmp = [value]
                all_other_specimens = list(Intensities.keys())
                all_other_specimens.remove(this_specimen)

                for other_specimen in all_other_specimens:
                    closest_value = self.find_close_value(
                        Intensities[other_specimen], value)
                    Best_array_tmp.append(closest_value)
                    Best_interpretations_tmp[other_specimen] = closest_value

                if std(Best_array_tmp, ddof=1) / mean(Best_array_tmp) < best_array_std_perc:
                    Best_array = Best_array_tmp
                    best_array_std_perc = std(
                        Best_array, ddof=1) / mean(Best_array_tmp)
                    Best_interpretations = copy.deepcopy(
                        Best_interpretations_tmp)
                    Best_interpretations_tmp = {}
        return Best_interpretations, mean(Best_array), std(Best_array, ddof=1)
def find_sample_min_std ( self , Intensities ) : Best_array = [ ] best_array_std_perc = inf Best_array_tmp = [ ] Best_interpretations = { } Best_interpretations_tmp = { } for this_specimen in list ( Intensities . keys ( ) ) : for value in Intensities [ this_specimen ] : Best_interpretations_tmp [ this_specimen ] = value Best_array_tmp = [ value ] all_other_specimens = list ( Intensities . keys ( ) ) all_other_specimens . remove ( this_specimen ) for other_specimen in all_other_specimens : closest_value = self . find_close_value ( Intensities [ other_specimen ] , value ) Best_array_tmp . append ( closest_value ) Best_interpretations_tmp [ other_specimen ] = closest_value if std ( Best_array_tmp , ddof = 1 ) / mean ( Best_array_tmp ) < best_array_std_perc : Best_array = Best_array_tmp best_array_std_perc = std ( Best_array , ddof = 1 ) / mean ( Best_array_tmp ) Best_interpretations = copy . deepcopy ( Best_interpretations_tmp ) Best_interpretations_tmp = { } return Best_interpretations , mean ( Best_array ) , std ( Best_array , ddof = 1 )
find the best interpretation with the minimum stratard deviation (in units of percent % !)