示例#1
0
 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())
示例#2
0
 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())
示例#3
0
 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)
示例#4
0
 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)
示例#5
0
 def test_group(self):
     self.fig = dcs.plot_time_history(self.time, self.data, self.label, self.type_, \
         opts=self.opts, plot_indiv=False)
示例#6
0
 def test_diffs(self):
     self.fig = dcs.plot_time_history(self.time, self.data_matrix, self.label, self.type_, \
         plot_as_diffs=True)
示例#7
0
 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)
示例#9
0
 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)
示例#10
0
 def test_diffs(self):
     self.fig = dcs.plot_time_history(self.time, self.data_matrix, self.label, self.type_, \
         plot_as_diffs=True)
示例#11
0
 def test_opts(self):
     self.fig = dcs.plot_time_history(self.time, self.data, self.label, self.type_, opts=self.opts)
示例#12
0
 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)
示例#13
0
 def test_truth1(self):
     self.fig = dcs.plot_time_history(self.time, self.data, self.label, self.type_, \
         truth=self.truth)
示例#14
0
 def test_normal(self):
     self.fig = dcs.plot_time_history(self.time, self.data, self.label, self.type_)
示例#15
0
 def test_plot_empty(self):
     self.fig = dcs.plot_time_history([], [], '')
示例#16
0
 def test_group(self):
     self.fig = dcs.plot_time_history(self.time, self.data, self.label, self.type_, \
         opts=self.opts, plot_indiv=False)
示例#17
0
 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)
示例#18
0
 def test_colormap(self):
     self.fig = dcs.plot_time_history(self.time, self.data, self.label, self.type_, colormap='Dark2')
示例#19
0
 def test_normal(self):
     self.fig = dcs.plot_time_history(self.time, self.data, self.label,
                                      self.type_)
示例#20
0
 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)
示例#21
0
 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)
示例#22
0
 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)
示例#23
0
 def test_opts(self):
     self.fig = dcs.plot_time_history(self.time,
                                      self.data,
                                      self.label,
                                      self.type_,
                                      opts=self.opts)
示例#24
0
 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)
示例#25
0
 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)
示例#26
0
 def test_simple(self):
     self.fig = dcs.plot_time_history(0, 0, 'Text')
示例#27
0
 def test_colormap(self):
     self.fig = dcs.plot_time_history(self.time,
                                      self.data,
                                      self.label,
                                      self.type_,
                                      colormap='Dark2')
示例#28
0
 def test_plot_empty(self):
     self.fig = dcs.plot_time_history([], [], '')
示例#29
0
 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)
示例#30
0
 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)
示例#31
0
 def test_simple(self):
     self.fig = dcs.plot_time_history(0, 0, 'Text')
示例#32
0
 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)
示例#33
0
 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)
示例#34
0
 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)
示例#35
0
 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)