def _get_id_stats(glyphs, k=None): import stats if len(glyphs) < 3: return (len(glyphs),1.0, 1.0, 1.0) if k is None: k = kNN() distances = k.unique_distances(glyphs) return (len(glyphs),stats.lmean(distances), stats.lstdev(distances), stats.lmedian(distances))
def characteristic_value(OD_list): if characteristic_value_type == 'median': return float('%1.4f'%(stats.lmedian(OD_list))) elif characteristic_value_type == 'max': return float('%1.4f'%(max(OD_list))) else: print 'characteristic value type not defined, enter median or max' exit()
def characteristic_value(plate_data): for keys in plate_data: if not characteristic_value_of_time_course.has_key(keys): if characteristic_value_type == 'median': characteristic_value_of_time_course[keys] = stats.lmedian(plate_data[keys]) else: characteristic_value_of_time_course[keys] = max(plate_data[keys]) for keys in characteristic_value_of_time_course: print keys, characteristic_value_of_time_course[keys]
rdp_list = [] rdp_tmp = 0.0 if icmp_len < bn_len : loop_count = icmp_len for i in range(loop_count) : if brunet_time_list[i] != -1.0 and icmp_time_list[i] != -1.0 : if brunet_time_list[i] != 0.0 and icmp_time_list[i] != 0.0 : bin_index = math.floor(icmp_time_list[i]/binsize)*binsize rdp_tmp = brunet_time_list[i]/icmp_time_list[i] tmp1_list = [] if bin_index in timebin_to_time_list : tmp1_list = timebin_to_time_list[bin_index] tmp1_list.append(rdp_tmp) else : timebin_to_time_list[bin_index] = [rdp_tmp] timebin_to_time_list[bin_index] = tmp1_list #print timebin_to_time_list bin_final_list = timebin_to_time_list.keys() bin_final_list.sort() for bin in bin_final_list : if len(timebin_to_time_list[bin]) > 0: tmed = stats.lmedian(timebin_to_time_list[bin],100000 ) tmp_scor_list = timebin_to_time_list[bin] tmp_scor_list.sort() nin = int( math.floor( 0.9*len(tmp_scor_list) ) ) tstdband = tmp_scor_list[nin] print bin, min(tmp_scor_list),tmed ,tstdband
def median(self): return float('%1.4f'%stats.lmedian(self.datapoints))