def test_angles(self):
        tp = 2 * np.pi
        ro_amp_high_factor = 0.1
        ts = '20180508_182642'
        te = '20180508_183214'
        for angle in np.arange(0, 360, 30):
            options_dict = {
                'verbose': True,
                'rotation_angle': angle * np.pi / 180,
                'auto_rotation_angle': True,
                'fixed_p01': 0,
                'fixed_p10': 0,
                'nr_bins': 100,
            }
            label = 'SSRO_%d_%.2f' % (angle, ro_amp_high_factor * 100)
            aut = ma.Singleshot_Readout_Analysis(t_start=ts,
                                                 t_stop=te,
                                                 label=label,
                                                 extract_only=True,
                                                 do_fitting=True,
                                                 options_dict=options_dict)
            aut_angle = aut.proc_data_dict['raw_offset'][2]
            aut_angle = aut_angle % tp
            aut_snr = aut.fit_res['shots_all'].params['SNR'].value

            options_dict['auto_rotation_angle'] = False
            opt = ma.Singleshot_Readout_Analysis(t_start=ts,
                                                 t_stop=te,
                                                 label=label,
                                                 extract_only=True,
                                                 do_fitting=True,
                                                 options_dict=options_dict)
            opt_angle = opt.proc_data_dict['raw_offset'][2]
            opt_angle = opt_angle % tp
            opt_snr = opt.fit_res['shots_all'].params['SNR'].value
            da = min(abs(aut_angle - opt_angle),
                     abs(aut_angle - opt_angle + 2 * np.pi),
                     abs(aut_angle - opt_angle - 2 * np.pi))

            # Check if the angle was found within a few degrees
            self.assertLess(da * 180 / np.pi, 9)

            # Check if the SNRs roughly make sense
            self.assertLess(aut_snr, 1.1)
            self.assertLess(opt_snr, 1.1)
            self.assertGreater(aut_snr, 0.55)
            self.assertGreater(opt_snr, 0.55)
Ejemplo n.º 2
0
 def test_SSRO_analysis_basic_1D_wrong_peak_selected(self):
     # This fit failed when I made a typo in the peak selection part
     t_start = '20171016_171715'
     t_stop = t_start
     a = ma.Singleshot_Readout_Analysis(t_start=t_start, t_stop=t_stop,
                                        extract_only=True)
     self.assertBetween(a.proc_data_dict['threshold_raw'], -3.3, -3.2)
     np.testing.assert_almost_equal(a.proc_data_dict['F_assignment_raw'],
                                    0.944, decimal=2)
     self.assertBetween(a.proc_data_dict['threshold_fit'], -3.3, -3.2)
     np.testing.assert_almost_equal(a.proc_data_dict['F_assignment_fit'],
                                    0.944, decimal=2)
     self.assertBetween(a.proc_data_dict['threshold_discr'], -3.3, -3.2)
     np.testing.assert_almost_equal(a.proc_data_dict['F_discr'],
                                    0.99, decimal=2)
Ejemplo n.º 3
0
 def test_SSRO_analysis_basic_1D(self):
     t_start = '20171016_135112'
     t_stop = t_start
     a = ma.Singleshot_Readout_Analysis(t_start=t_start, t_stop=t_stop,
                                        options_dict={'plot_init': True})
     np.testing.assert_almost_equal(a.proc_data_dict['threshold_raw'],
                                    -3.66, decimal=2)
     np.testing.assert_almost_equal(a.proc_data_dict['F_assignment_raw'],
                                    0.922, decimal=3)
     self.assertBetween(a.proc_data_dict['threshold_fit'], -3.69, -3.62)
     np.testing.assert_almost_equal(a.proc_data_dict['F_assignment_fit'],
                                    0.920, decimal=2)
     np.testing.assert_almost_equal(a.proc_data_dict['threshold_discr'],
                                    -3.64, decimal=1)
     np.testing.assert_almost_equal(a.proc_data_dict['F_discr'],
                                    0.996, decimal=2)
Ejemplo n.º 4
0
 def test_SSRO_analysis_basic_1D_misfit(self):
     # This dataset failed before I added additional constraints to the
     # guess
     t_start = '20171016_181021'
     t_stop = t_start
     a = ma.Singleshot_Readout_Analysis(t_start=t_start, t_stop=t_stop,
                                        extract_only=True)
     self.assertBetween(a.proc_data_dict['threshold_raw'], -1, -0.7)
     np.testing.assert_almost_equal(a.proc_data_dict['F_assignment_raw'],
                                    0.949, decimal=2)
     self.assertBetween(a.proc_data_dict['threshold_fit'], -1, -.7)
     np.testing.assert_almost_equal(a.proc_data_dict['F_assignment_fit'],
                                    0.945, decimal=2)
     self.assertBetween(a.proc_data_dict['threshold_discr'], -1, -.7)
     np.testing.assert_almost_equal(a.proc_data_dict['F_discr'],
                                    1.000, decimal=2)
     self.assertLess(a.proc_data_dict['residual_excitation'], 0.09)
     np.testing.assert_almost_equal(
         a.proc_data_dict['measurement_induced_relaxation'], 0.1,
         decimal=1)