def test_jellyroll_subplot(): data = ecm.load_cases(root) case_index = 0 amp_index = 0 var_index = 0 case_folder = children[case_index] amps = ecm.get_amp_cases(case_folder) case = list(data.keys())[case_index] ecm.jellyroll_subplot(data, case, amps[amp_index], var=var_index, soc_list=[[1.0, 0.99], [0.98, 0.97]], global_range=False, dp=1) if close_plots: plt.close('all') wrk.clear() assert 1 == 1
def load_all_data(): config = configparser.ConfigParser() net = ecm.get_net() weights = ecm.get_weights(net) cases = get_cases() amps = ecm.get_amp_cases() variables = ecm.get_saved_var_names() data = {} for ci in range(len(cases.keys())): case_folder = os.path.join(root, cases[ci]['file']) data[ci] = {} config.read(os.path.join(case_folder, 'config.txt')) data[ci]['config'] = ecm.config2dict(config) for amp in amps: amp_folder = os.path.join(case_folder, str(amp) + 'A') data[ci][amp] = {} for vi, v in enumerate(variables): data[ci][amp][vi] = {} temp = ecm.load_and_amalgamate(amp_folder, v) if temp is not None: if vi == 0: check_nans = np.any(np.isnan(temp), axis=1) if np.any(check_nans): print('Nans removed from', amp_folder) if np.any(check_nans): temp = temp[~check_nans, :] data[ci][amp][vi]['data'] = temp means = np.zeros(temp.shape[0]) for t in range(temp.shape[0]): (mean, std_dev) = ecm.weighted_avg_and_std( temp[t, :], weights) means[t] = mean data[ci][amp][vi]['mean'] = means data[ci][amp][vi]['min'] = np.min(temp, axis=1) data[ci][amp][vi]['max'] = np.max(temp, axis=1) if temp is not None: t_hrs = data[ci][amp][10]['data'][:, 0] cap = t_hrs * amp data[ci][amp]['capacity'] = cap return data
plt.style.use('seaborn-dark') cmap = sns.color_palette("rocket") warnings.filterwarnings("ignore") root = 'D:\\pybamm_pnm_results\\46800' save_im_path = 'D:\\pybamm_pnm_results\\46800\\figures' plt.close('all') savefigs = True tab_1 = [0, 1, 2, 3, ] tab_tesla = [4, 5, 6, 7, ] amps = ecm.get_amp_cases() d = ecm.load_all_data() cases = ecm.get_cases() soc_list = [[0.9, 0.8, 0.7], [0.6, 0.5, 0.4], [0.3, 0.2, 0.1]] mini_soc_list = [[0.8, 0.6], [0.4, 0.2]] grp = 'neg' data = d[0][17.5][0]['data'] def find_best_fit(y, report_results=False): # Set up list of candidate distributions to use # See https://docs.scipy.org/doc/scipy/reference/stats.html for more #y = data_spm.copy()
def _load(filepath): data = ecm.load_cases(filepath) cases = list(data.keys()) amps = ecm.get_amp_cases(os.path.join(filepath, cases[0])) return data, amps, cases