Example #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())
Example #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())
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #11
0
 def test_opts(self):
     self.fig = dcs.plot_time_history(self.time, self.data, self.label, self.type_, opts=self.opts)
Example #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)
Example #13
0
 def test_truth1(self):
     self.fig = dcs.plot_time_history(self.time, self.data, self.label, self.type_, \
         truth=self.truth)
Example #14
0
 def test_normal(self):
     self.fig = dcs.plot_time_history(self.time, self.data, self.label, self.type_)
Example #15
0
 def test_plot_empty(self):
     self.fig = dcs.plot_time_history([], [], '')
Example #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)
Example #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)
Example #18
0
 def test_colormap(self):
     self.fig = dcs.plot_time_history(self.time, self.data, self.label, self.type_, colormap='Dark2')
Example #19
0
 def test_normal(self):
     self.fig = dcs.plot_time_history(self.time, self.data, self.label,
                                      self.type_)
Example #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)
Example #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)
Example #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)
Example #23
0
 def test_opts(self):
     self.fig = dcs.plot_time_history(self.time,
                                      self.data,
                                      self.label,
                                      self.type_,
                                      opts=self.opts)
Example #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)
Example #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)
Example #26
0
 def test_simple(self):
     self.fig = dcs.plot_time_history(0, 0, 'Text')
Example #27
0
 def test_colormap(self):
     self.fig = dcs.plot_time_history(self.time,
                                      self.data,
                                      self.label,
                                      self.type_,
                                      colormap='Dark2')
Example #28
0
 def test_plot_empty(self):
     self.fig = dcs.plot_time_history([], [], '')
Example #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)
Example #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)
Example #31
0
 def test_simple(self):
     self.fig = dcs.plot_time_history(0, 0, 'Text')
Example #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)
Example #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)
Example #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)
Example #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)