def get_delta_vis(self, block, output, loc, static_cfg, hidden_cfg, label): rel_path = "%s/%s/%s/" % (self.VISUALIZATIONS, block, static_cfg) util.mkdir_if_dne(rel_path) if label.value == 'none': return "%s/%s-%s-%s-mdl.png" % (rel_path, loc, output, hidden_cfg) else: return "%s/%s-%s-%s-mdl.png" % (rel_path, loc, output, label.value)
def waveform_plot_file(self,graph_index,scale_index, \ model,opt,\ calib_obj, phys_db, \ variable,trial, \ plot, \ oscilloscope=False, \ no_scale=False, \ one_mode=False,): filepath = "{path}/{plot_type}" cdir = filepath.format(path=self.PLOT_DIR, \ plot_type='wave') util.mkdir_if_dne(cdir) tag = PathHandler._get_tag(no_scale, one_mode) path = "{path}/{prog}_g{lgraph}_s{lscale}_{model}_{opt}_{calib_obj}_{physdb}{tag}" path += "_{var}_{trial}_{plot}" if oscilloscope: path += "_scope" path += ".pdf" return path.format(path=cdir, prog=self._prog, lgraph=graph_index, lscale=scale_index, model=model, calib_obj=calib_obj.tag(), \ physdb=phys_db, \ opt=opt, \ tag=tag, \ var=variable, trial=trial, \ plot=plot)
def adp_sim_plot(self, plot_type, prog, lgraph, lscale, opt, model, per_variable=False): assert (isinstance(plot_type, PlotType)) filepath = "{path}/{plot_type}" cdir = filepath.format(path=self.PLOT_DIR, \ plot_type=plot_type.value) util.mkdir_if_dne(cdir) if per_variable: filepat = "{path}/{prog}_{lgraph}_{lscale}_{opt}_{model}_{variable}.png" else: filepat = "{path}/{prog}_{lgraph}_{lscale}_{opt}_{model}.png" cfilename = filepat.format(path=cdir, \ prog=prog, \ lgraph=lgraph, \ lscale=lscale, \ opt=opt, \ model=model, \ variable="{variable}") return cfilename
def get_histogram_vis(self, name, block, output, static_cfg, label): rel_path = "%s/%s/%s/" % (self.VISUALIZATIONS, block, static_cfg) util.mkdir_if_dne(rel_path) if label.value == 'none': return "%s/hist-%s-%s.png" \ % (rel_path,name,output) else: return "%s/hist-%s-%s-%s.png" \ % (rel_path,name,output,label.value)
def get_model_file(self, block, output, loc, static_cfg, hidden_cfg, label): rel_path = "%s/%s/%s/" % (self.MODEL_DIR, block, static_cfg) util.mkdir_if_dne(rel_path) util.mkdir_if_dne(rel_path) if label.value == 'none': return "%s/mdl-%s-%s-%s.txt" % (rel_path, loc, output, hidden_cfg) else: return "%s/mdl-%s-%s-%s.txt" % (rel_path, loc, output, label.value)
def __init__(self, subset, prog, make_dirs=True): self.set_root_dir(subset, prog) for path in [ self.ROOT_DIR, self.PROG_DIR, self.LGRAPH_ADP_DIR, self.LGRAPH_ADP_DIAG_DIR, self.LSCALE_ADP_DIR, self.LSCALE_ADP_DIAG_DIR, self.MEAS_WAVEFORM_FILE_DIR, self.PLOT_DIR, self.TIME_DIR ]: if make_dirs: util.mkdir_if_dne(path) self._subset = subset self._prog = prog
def __init__(self, board, model, make_dirs=True, model_subdir=""): self.board = board self.model = model if model_subdir is None or len(model_subdir) == 0: self.set_root_dir(DeviceStatePathHandler.DEVICE_STATE_DIR + "/%s/%s" \ % (board,model)) else: self.set_root_dir(DeviceStatePathHandler.DEVICE_STATE_DIR + "/%s/%s/%s" \ % (board,model_subdir,model)) for path in [ self.ROOT_DIR, self.MODEL_DIR, self.SRC_DIR, self.VISUALIZATIONS ]: if make_dirs: util.mkdir_if_dne(path)
def get_directory(model): def to_tag(mode): if isinstance(mode, tuple): tag = ''.join(map(lambda m: str(m)[0], mode)) else: tag = str(mode) return tag block, loc = model.block, model.loc loc = to_safe_loc(loc) cm, sm = to_tag(model.comp_mode), to_tag(model.scale_mode) direc = "{path}/{block}-{loc}/{comp_mode}-{scale_mode}/{calib_obj}" conc_dir = direc.format(path=CFG.MODEL_PATH, block=block, loc=loc, comp_mode=cm, scale_mode=sm, calib_obj=CALIB_OBJ.value) util.mkdir_if_dne(conc_dir) return conc_dir