def dict_builder_vals_test(self): # dict_builder(params, test_name = '') y = dict_builder(self.x, test_name = 'STEP_BOX') assert list(y) == [{'TITLE': 'STEP_BOX0-4-2', 'a': '0', 'b': '2', 'c': '4'}, {'TITLE': 'STEP_BOX0-4-3', 'a': '0', 'b': '3', 'c': '4'}, {'TITLE': 'STEP_BOX1-4-2', 'a': '1', 'b': '2', 'c': '4'}, {'TITLE': 'STEP_BOX1-4-3', 'a': '1', 'b': '3', 'c': '4'}]
def plotter(parameters, plotted_val='HRR', **kwargs): """ plotter(parameters, plotted_val = 'HRR', **kwargs) takes in a parameter set and a plotted_val (for now a column label in the FDS output) reads the data in, and then plots all grouping variations of the plotted_val as a function of the parameter study variables. """ dataLists = {} # read data for folder in glob.glob(os.path.join(kwargs['base_path'], '*')): for datafile in glob.glob(os.path.join(folder, '*_hrr.csv')): dataLists[folder.split("/")[-1]] = pd.read_csv(datafile, skiprows=1) filename_map = pd.DataFrame( list(dict_builder(parameters, test_name=kwargs['test_name']))) for key in parameters.keys(): for results in filename_map.groupby(by=key): plt.figure() for title in results[1]['TITLE'].values: plt.plot(dataLists[title].Time, dataLists[title][plotted_val], label=title) plt.title(key + ' ' + str(results[0])) plt.legend() plt.savefig(key + ' ' + str(results[0]) + '.png', dpi=300)
def plotter(parameters, plotted_val = 'HRR', **kwargs): """ plotter(parameters, plotted_val = 'HRR', **kwargs) takes in a parameter set and a plotted_val (for now a column label in the FDS output) reads the data in, and then plots all grouping variations of the plotted_val as a function of the parameter study variables. """ dataLists = {} # read data for folder in glob.glob(os.path.join(kwargs['base_path'],'*')): for datafile in glob.glob(os.path.join(folder, '*_hrr.csv')): dataLists[folder.split("/")[-1]] = pd.read_csv(datafile, skiprows = 1) filename_map = pd.DataFrame(list(dict_builder(parameters, test_name = kwargs['test_name']))) for key in parameters.keys(): for results in filename_map.groupby(by = key): plt.figure() for title in results[1]['TITLE'].values: plt.plot(dataLists[title].Time, dataLists[title][plotted_val], label = title) plt.title(key + ' ' + str(results[0])) plt.legend() plt.savefig(key + ' ' + str(results[0]) + '.png', dpi = 300)
def dict_builder_len_test(self): y = dict_builder(self.x) assert len(list(y)) == 4