def test_condition_oscillation_extracted_pars(self): a = ma.Conditional_Oscillation_Analysis(t_start='20180130_191229') extracted = np.array([ a.proc_data_dict['phi_cond'][0], a.proc_data_dict['phi_cond'][1], a.proc_data_dict['phi_0'][0], a.proc_data_dict['phi_0'][1], a.proc_data_dict['phi_1'][0], a.proc_data_dict['phi_1'][1], a.proc_data_dict['osc_amp_0'][0], a.proc_data_dict['osc_amp_0'][1], a.proc_data_dict['osc_amp_1'][0], a.proc_data_dict['osc_amp_1'][1], a.proc_data_dict['offs_diff'][0], a.proc_data_dict['offs_diff'][1], a.proc_data_dict['osc_offs_0'][0], a.proc_data_dict['osc_offs_0'][1], a.proc_data_dict['osc_offs_1'][0], a.proc_data_dict['osc_offs_1'][1] ]) expected = np.array([ 178.48651885251698, 2.9898741913646272, 3.3113606223925696, 1.691099641377918, 181.79787947490954, 2.4656702300023334, 0.3236975712917689, 0.009554015995104392, 0.27746120839251875, 0.011940273429767528, 0.00150761346297007, 0.010813168390439071, 0.4868083822944365, 0.0067557093031373455, 0.4883159957574066, 0.0084430446197739737 ]) np.testing.assert_almost_equal(extracted, expected, decimal=3)
def test_save_fit_results(self): # strictly speaking an integration test as it relies on the cond # oscillation analysis, but the only thing tested here is # if the value of the fit_result is saved. ts = '20181126_131143' a = ma2.Conditional_Oscillation_Analysis(t_start=ts) exp_val = a.fit_res['cos_fit_off'].params['amplitude'].value fn = a_tools.measurement_filename(a_tools.data_from_time(ts)) with h5py.File(fn, 'r') as file: saved_val = float(file['Analysis']['cos_fit_off']['params'] ['amplitude'].attrs['value']) a.fit_res = {} a.save_fit_results() assert exp_val == saved_val
def test_condition_oscillation_extracted_pars(self): a = ma.Conditional_Oscillation_Analysis(t_start="20181126_131143", cal_points="gef") qoi = a.proc_data_dict["quantities_of_interest"] print(qoi) extracted = np.array([ qoi["phi_cond"].nominal_value, qoi["phi_cond"].std_dev, qoi["phi_0"].nominal_value, qoi["phi_0"].std_dev, qoi["phi_1"].nominal_value, qoi["phi_1"].std_dev, qoi["osc_amp_0"].nominal_value, qoi["osc_amp_0"].std_dev, qoi["osc_amp_1"].nominal_value, qoi["osc_amp_1"].std_dev, qoi["offs_diff"].nominal_value, qoi["offs_diff"].std_dev, qoi["osc_offs_0"].nominal_value, qoi["osc_offs_0"].std_dev, qoi["osc_offs_1"].nominal_value, qoi["osc_offs_1"].std_dev, ]) expected = np.array([ 7.139e01, 1.077e00, 8.753e01, 5.926e-01, 1.614e01, 8.990e-01, 4.859e-01, 5.026e-03, 4.792e-01, 7.518e-03, 1.225e-02, 6.395e-03, 4.869e-01, 3.554e-03, 4.992e-01, 5.316e-03, ]) np.testing.assert_almost_equal(extracted, expected, decimal=2)
def test_condition_oscillation_extracted_pars(self): a = ma.Conditional_Oscillation_Analysis(t_start='20181126_131143', cal_points='gef') qoi = a.proc_data_dict['quantities_of_interest'] print(qoi) extracted = np.array([ qoi['phi_cond'].nominal_value, qoi['phi_cond'].std_dev, qoi['phi_0'].nominal_value, qoi['phi_0'].std_dev, qoi['phi_1'].nominal_value, qoi['phi_1'].std_dev, qoi['osc_amp_0'].nominal_value, qoi['osc_amp_0'].std_dev, qoi['osc_amp_1'].nominal_value, qoi['osc_amp_1'].std_dev, qoi['offs_diff'].nominal_value, qoi['offs_diff'].std_dev, qoi['osc_offs_0'].nominal_value, qoi['osc_offs_0'].std_dev, qoi['osc_offs_1'].nominal_value, qoi['osc_offs_1'].std_dev ]) expected = np.array([ 7.139e+01, 1.077e+00, 8.753e+01, 5.926e-01, 1.614e+01, 8.990e-01, 4.859e-01, 5.026e-03, 4.792e-01, 7.518e-03, 1.225e-02, 6.395e-03, 4.869e-01, 3.554e-03, 4.992e-01, 5.316e-03 ]) np.testing.assert_almost_equal(extracted, expected, decimal=2)