def test_bad_truth_size(self): self.truth.data = self.truth.data[:-1] with self.assertRaises(ValueError): dcs.plot_time_history(self.time, self.data, self.label, self.type_, \ truth=self.truth) # close uncompleted plot window plt.close(plt.gcf())
def test_array_data2(self): data = np.column_stack((self.data, self.data)) self.fig = dcs.plot_time_history(self.time, data, self.label, self.type_, plot_as_diffs=True)
def test_second_y_scale2(self): self.fig = dcs.plot_time_history(self.time, self.data, self.label, type_='percentage', \ second_y_scale=self.second_y_scale)
def test_group(self): self.fig = dcs.plot_time_history(self.time, self.data, self.label, self.type_, \ opts=self.opts, plot_indiv=False)
def test_diffs(self): self.fig = dcs.plot_time_history(self.time, self.data_matrix, self.label, self.type_, \ plot_as_diffs=True)
def test_truth1(self): self.fig = dcs.plot_time_history(self.time, self.data, self.label, self.type_, \ truth=self.truth)
minstep=0.1)) # Run code if rerun: (bpe_results, results) = dcs.run_bpe(opti_opts) else: bpe_results = dcs.BpeResults.load( os.path.join(opti_opts.output_folder, opti_opts.output_results)) results = sim_model( sim_params) # just re-run, nothing is actually saved by this model # Plot results if make_plots: # build opts opts = dcs.Opts() opts.case_name = 'Model Results' opts.save_path = dcs.get_output_dir() opts.save_plot = True # make model plots dcs.plot_time_history(time, results, description='Output vs. Time', opts=opts, truth=truth) # make BPE plots bpe_plots = {'innovs': True, 'convergence': False, 'correlation': True, 'info_svd': True, \ 'covariance': False} dcs.plot_bpe_results(bpe_results, opts, plots=bpe_plots)
def test_diffs_and_opts(self): self.fig = dcs.plot_time_history(self.time, self.data_matrix, self.label, self.type_, \ opts=self.opts, plot_as_diffs=True)
def test_opts(self): self.fig = dcs.plot_time_history(self.time, self.data, self.label, self.type_, opts=self.opts)
def test_truth2(self): self.truth.data_lo = self.truth.data - 0.1 self.truth.data_hi = self.truth.data + 0.1 self.fig = dcs.plot_time_history(self.time, self.data, self.label, self.type_, \ truth=self.truth)
def test_normal(self): self.fig = dcs.plot_time_history(self.time, self.data, self.label, self.type_)
def test_plot_empty(self): self.fig = dcs.plot_time_history([], [], '')
def test_no_rms_in_legend1(self): self.fig = dcs.plot_time_history(self.time, self.data, self.label, self.type_, rms_in_legend=False)
def test_colormap(self): self.fig = dcs.plot_time_history(self.time, self.data, self.label, self.type_, colormap='Dark2')
def test_second_y_scale1(self): self.fig = dcs.plot_time_history(self.time, self.data, self.label, self.type_, \ second_y_scale=self.second_y_scale)
def test_simple(self): self.fig = dcs.plot_time_history(0, 0, 'Text')
def test_plot_all_nans(self): self.fig = dcs.plot_time_history(np.array([np.nan, np.nan]), np.array([np.nan, np.nan]), self.label)
def test_no_rms_in_legend2(self): self.fig = dcs.plot_time_history(self.time, self.data, self.label, self.type_, \ rms_in_legend=False, plot_as_diffs=True)
opti_opts.shrink_radius = 0.5 opti_opts.trust_radius = 1.0 # Parameters to estimate opti_opts.params.append(dcs.OptiParam('magnitude', best=2.5, min_=-10, max_=10, typical=5, minstep=0.01)) opti_opts.params.append(dcs.OptiParam('frequency', best=20, min_=1, max_=1000, typical=60, minstep=0.01)) opti_opts.params.append(dcs.OptiParam('phase', best=180, min_=0, max_=360, typical=100, minstep=0.1)) # Run code if rerun: (bpe_results, results) = dcs.run_bpe(opti_opts) else: bpe_results = dcs.BpeResults.load(os.path.join(opti_opts.output_folder, opti_opts.output_results)) results = sim_model(sim_params) # just re-run, nothing is actually saved by this model # Plot results if make_plots: # build opts opts = dcs.Opts() opts.case_name = 'Model Results' opts.save_path = dcs.get_output_dir() opts.save_plot = True # make model plots dcs.plot_time_history(time, results, description='Output vs. Time', opts=opts, truth=truth) # make BPE plots bpe_plots = {'innovs': True, 'convergence': False, 'correlation': True, 'info_svd': True, \ 'covariance': False} dcs.plot_bpe_results(bpe_results, opts, plots=bpe_plots)