def _plot_id_vs_value(self, sounding_ids, plot_values, get_lines=None, time_strings=None, **kwargs): ax = self.new_axis(**kwargs) error = kwargs.get("error", []) show_gaps = kwargs.get("show_gaps", True) markers = Line2D.filled_markers[:len(plot_values)] for idx, (snd_ids, p_val, marker) in enumerate(zip(sounding_ids, plot_values, markers)): # Fall back to converting sounding ids into times if time strings are not supplied if time_strings != None: datetimes = utils.time_string_to_dt(time_strings) else: datetimes = utils.id2time(snd_ids) if show_gaps: ax.xaxis.set_major_formatter(DateFormatter(DATETIME_FORMAT)) x_val = datetimes else: ax.xaxis.set_major_formatter(DateLookupFormatter(datetimes, **kwargs)) x_val = numpy.arange(len(p_val)) if idx < len(error) and error[idx] != None: lines = ax.errorbar(x_val, p_val, yerr=error[idx], marker=marker, linestyle='') # errorbar routine creates multiple lines which can screw up # legends if you use the default legend with jut names call method if get_lines != None: get_lines.append(lines[0]) else: line = ax.plot(x_val, p_val, marker) if get_lines != None: get_lines.append(line) # Set some padding some padding on the xaxis if not show_gaps: ax.set_xlim(-10, len(plot_values[0])+10) ax.get_figure().autofmt_xdate() return ax
def ids2times(sounding_ids): return [ numpy.array([ time.mktime(dt.timetuple()) for dt in utils.id2time(snds) ]) for snds in sounding_ids ]
return heatmap_w, heatmap_s, c_norm, c_s_norm, R_i, R, R_s def top_dict(kv_dict, num=2): k_list = list(kv_dict.keys())[:num] subdict = {k: kv_dict[k] for k in k_list} print('\ndict len:', len(kv_dict)) return subdict print('Gathering keyframes info...') #preparing dicts id2dir_dict_kfrm = utils.create_dict_kfrm(kfrm_path, kfrm_msb, video_asr_path, video_map_path) id2time_dict_kfrm = utils.id2time(kfrm_msb) print('Creating parent-child dictionaries...') #generate parent-child dictionaries parent_dict, child_dict = utils.create_dict(parent_child_tab) # for i in child_dict.keys(): # if 'mp4' in i: # print(i,child_dict[i]) # print(top_dict(child_dict,5)) print('Creating path dictionary...') #generate global id2path dictionary #ltf path_dict = utils.create_path_dict(ltf_path) #jpg