def test_data_location(self):
        sweep_pts = np.linspace(0, 10, 30)
        self.MC.set_sweep_function(None_Sweep())
        self.MC.set_sweep_points(sweep_pts)
        self.MC.set_detector_function(det.Dummy_Detector_Soft())
        self.MC.run('datadir_test_file')
        # raises an error if the file is not found
        ma.MeasurementAnalysis(label='datadir_test_file')

        # change the datadir
        test_dir2 = os.path.abspath(os.path.join(
            os.path.dirname(pq.__file__), os.pardir, 'data_test_2'))
        self.MC.datadir(test_dir2)

        sweep_pts = np.linspace(0, 10, 30)
        self.MC.set_sweep_function(None_Sweep())
        self.MC.set_sweep_points(sweep_pts)
        self.MC.set_detector_function(det.Dummy_Detector_Soft())
        self.MC.run('datadir_test_file_2')
        # raises an error if the file is not found
        with self.assertRaises(Exception):
            ma.MeasurementAnalysis(label='datadir_test_file_2')
        ma.a_tools.datadir = test_dir2
        # changing the dir makes it find the file now
        ma.MeasurementAnalysis(label='datadir_test_file_2')
        self.MC.datadir(get_default_datadir())
    def measure_transients(self, return_detector=False,
                           MC=None,
                           analyze=True,
                           close_fig=True,
                           verbose=True,
                           nr_samples=512):

        self.prepare_for_timedomain()
        if MC is None:
            MC = self.MC.get_instr()

        self.MC.get_instr().set_sweep_function(awg_swf.OffOn(pulse_pars=self.pulse_pars,
                                                             RO_pars=self.RO_pars,
                                                             pulse_comb='OffOff',
                                                             nr_samples=nr_samples))
        self.MC.get_instr().set_sweep_points(np.arange(nr_samples))
        self.input_average_detector.nr_samples = nr_samples
        self.MC.get_instr().set_detector_function(self.input_average_detector)
        self.MC.get_instr().run(
            'Measure_transients_{}_0'.format(self.msmt_suffix))
        a0 = ma.MeasurementAnalysis(auto=True, close_fig=close_fig)
        self.MC.get_instr().set_sweep_function(awg_swf.OffOn(pulse_pars=self.pulse_pars,
                                                             RO_pars=self.RO_pars,
                                                             pulse_comb='OnOn',
                                                             nr_samples=nr_samples))
        # self.MC.get_instr().set_sweep_points(np.arange(nr_samples))
        self.input_average_detector.nr_samples = nr_samples
        self.MC.get_instr().set_detector_function(self.input_average_detector)
        self.MC.get_instr().run(
            'Measure_transients_{}_1'.format(self.msmt_suffix))
        a1 = ma.MeasurementAnalysis(auto=True, close_fig=close_fig)
示例#3
0
    def measure_two_qubit_AllXY(self, sequence_type='simultaneous', MC=None):
        if MC is None:
            MC = qc.station.components['MC']

        qnames = self.qubits()
        q0 = self.find_instrument(qnames[0])
        q1 = self.find_instrument(qnames[1])
        self.prepare_for_timedomain()

        double_points = True
        AllXY = mqqs.two_qubit_AllXY(
            q0.name,
            q1.name,
            RO_target=q0.name,  # shold be 'all'
            sequence_type=sequence_type,
            replace_q1_pulses_X180=False,
            double_points=double_points)

        s = swf.QASM_Sweep_v2(qasm_fn=AllXY.name,
                              config=self.qasm_config(),
                              CBox=self.central_controller.get_instr(),
                              verbosity_level=1)

        d = self.get_correlation_detector()

        MC.set_sweep_function(s)
        MC.set_sweep_points(np.arange(21 * (1 + double_points)))
        MC.set_detector_function(d)
        MC.run('AllXY_{}_{}'.format(q0.name, q1.name))
        ma.MeasurementAnalysis()
示例#4
0
    def extract_data(self):
        self.raw_data_dict = OrderedDict()
        self.timestamps = a_tools.get_timestamps_in_range(self.t_start,
                                                          self.t_stop,
                                                          label=self.labels)
        self.raw_data_dict['timestamps'] = self.timestamps

        self.timestamp = self.timestamps[0]
        a = ma_old.MeasurementAnalysis(timestamp=self.timestamp,
                                       auto=False,
                                       close_file=False)
        a.get_naming_and_values()

        self.raw_data_dict['xvals'] = a.sweep_points
        self.raw_data_dict['xlabel'] = a.parameter_names[0]
        self.raw_data_dict['xunit'] = a.parameter_units[0]

        self.raw_data_dict['bins'] = a.data_file['Experimental Data']\
            ['Experimental Metadata']['bins'].value
        self.raw_data_dict['measured_values'] = a.measured_values
        self.raw_data_dict['value_names'] = a.value_names
        self.raw_data_dict['value_units'] = a.value_units
        self.raw_data_dict['measurementstring'] = a.measurementstring
        self.raw_data_dict['folder'] = a.folder
        a.finish()
示例#5
0
    def measure_heterodyne_spectroscopy(self,
                                        freqs=None,
                                        MC=None,
                                        analyze=True,
                                        close_fig=True):
        """ Varies the frequency of the microwave source to the resonator and
        measures the transmittance """
        if freqs is None:
            raise ValueError("Unspecified frequencies for measure_heterodyne_"
                             "spectroscopy")

        if MC is None:
            MC = self.MC

        previous_freq = self.heterodyne_instr.frequency()

        self.prepare_for_continuous_wave()
        MC.set_sweep_function(
            pw.wrap_par_to_swf(self.heterodyne_instr.frequency))
        MC.set_sweep_points(freqs)
        MC.set_detector_function(
            det.Heterodyne_probe(self.heterodyne_instr,
                                 trigger_separation=5e-6,
                                 demod_mode='single'))
        MC.run(name='resonator_scan' + self.msmt_suffix)

        self.heterodyne_instr.frequency(previous_freq)

        if analyze:
            ma.MeasurementAnalysis(auto=True, close_fig=close_fig)
    def test_save_exp_metadata(self):
        metadata_dict = {
            'intParam': 1,
            'floatParam': 2.5e-3,
            'strParam': 'spam',
            'listParam': [1, 2, 3, 4],
            'arrayParam': np.array([4e5, 5e5]),
            'dictParam': {'a': 1, 'b': 2},
            'tupleParam': (3, 'c')
        }

        old_a_tools_datadir = a_tools.datadir
        a_tools.datadir = self.MC.datadir()

        sweep_pts = np.linspace(0, 10, 30)
        self.MC.set_sweep_function(None_Sweep())
        self.MC.set_sweep_points(sweep_pts)
        self.MC.set_detector_function(det.Dummy_Detector_Soft())
        self.MC.run('test_exp_metadata', exp_metadata=metadata_dict)
        a = ma.MeasurementAnalysis(label='test_exp_metadata', auto=False)

        a_tools.datadir = old_a_tools_datadir

        loaded_dict = read_dict_from_hdf5(
            {}, a.data_file['Experimental Data']['Experimental Metadata'])

        np.testing.assert_equal(metadata_dict, loaded_dict)
 def measure_rabi(self,
                  amps,
                  n=1,
                  MC=None,
                  analyze=True,
                  close_fig=True,
                  verbose=False):
     self.prepare_for_timedomain()
     if MC is None:
         MC = self.MC
     cal_points = [0, 0]
     amps = cal_points + list(amps)
     self.CBox.AWG0_mode('Codeword-trigger mode')
     self.CBox.AWG1_mode('Codeword-trigger mode')
     self.CBox.AWG2_mode('Codeword-trigger mode')
     self.CBox.set_master_controller_working_state(0, 0, 0)
     self.CBox.load_instructions('CBox_v3_test_program\Rabi.asm')
     self.CBox.set_master_controller_working_state(1, 0, 0)
     MC.set_sweep_function(pw.wrap_par_to_swf(self.LutMan.amp180))
     MC.set_sweep_points(amps)
     MC.set_detector_function(
         det.CBox_v3_single_int_avg_with_LutReload(
             self.CBox, self.LutMan, awg_nrs=[self.awg_nr.get()]))
     MC.run('Rabi-n{}'.format(n) + self.msmt_suffix)
     if analyze:
         ma.MeasurementAnalysis(auto=True, close_fig=close_fig)
示例#8
0
    def _measure_2D(self,
                    parameter1,
                    parameter2,
                    values1,
                    values2,
                    label,
                    analyze=True):

        MC = self.instr_mc.get_instr()

        detector = self.prepare_readout()

        initial_value1 = parameter1()
        initial_value2 = parameter2()

        MC.set_sweep_function(parameter1)
        MC.set_sweep_function_2D(parameter2)
        MC.set_sweep_points(values1)
        MC.set_sweep_points_2D(values2)
        MC.set_detector_function(detector)
        MC.run_2D(name=label + self.msmt_suffix)
        if analyze:
            ma.MeasurementAnalysis(TwoD=True, auto=True)

        parameter1(initial_value1)
        parameter2(initial_value2)
    def measure_spectroscopy(self,
                             freqs,
                             pulsed=False,
                             MC=None,
                             analyze=True,
                             close_fig=True,
                             mode='ROGated_SpecGate',
                             force_load=False):
        self.prepare_for_continuous_wave()
        self.cw_source.on()
        if MC is None:
            MC = self.MC
        if pulsed:
            # Redirect to the pulsed spec function
            return self.measure_pulsed_spectroscopy(freqs=freqs,
                                                    MC=MC,
                                                    analyze=analyze,
                                                    close_fig=close_fig,
                                                    mode=mode,
                                                    force_load=force_load)

        MC.set_sweep_function(pw.wrap_par_to_swf(self.cw_source.frequency))
        MC.set_sweep_points(freqs)
        MC.set_detector_function(
            det.Heterodyne_probe(self.heterodyne_instr,
                                 trigger_separation=2.8e-6))
        MC.run(name='spectroscopy' + self.msmt_suffix)

        if analyze:
            ma.MeasurementAnalysis(auto=True, close_fig=close_fig)
        self.cw_source.off()
    def measure_spectroscopy(self, freqs, pulsed=False, MC=None,
                             analyze=True, close_fig=True,
                             force_load=True, use_max=False, update=True):
        self.prepare_for_continuous_wave()
        self.cw_source.get_instr().on()
        if MC is None:
            MC = self.MC.get_instr()
        if pulsed:
            # Redirect to the pulsed spec function
            return self.measure_pulsed_spectroscopy(freqs=freqs,
                                                    MC=MC,
                                                    analyze=analyze,
                                                    close_fig=close_fig,
                                                    update=update,
                                                    upload=force_load)

        MC.set_sweep_function(pw.wrap_par_to_swf(
                              self.cw_source.get_instr().frequency, retrieve_value=True))
        MC.set_sweep_points(freqs)
        MC.set_detector_function(
            det.Heterodyne_probe(
                self.heterodyne_instr.get_instr(),
                trigger_separation=5e-6 + self.RO_acq_integration_length(),
                RO_length=self.RO_acq_integration_length()))
        MC.run(name='spectroscopy'+self.msmt_suffix)

        if analyze:
            ma.MeasurementAnalysis(auto=True, close_fig=close_fig)
        self.cw_source.get_instr().off()
示例#11
0
    def measure_spectroscopy(self,
                             freqs=None,
                             MC=None,
                             analyze=True,
                             close_fig=True,
                             update=False):
        """ Varies qubit drive frequency and measures the resonator
        transmittance """
        if freqs is None:
            raise ValueError("Unspecified frequencies for "
                             "measure_spectroscopy and no previous value")

        if MC is None:
            MC = self.MC

        self.prepare_for_continuous_wave()
        self.cw_source.on()

        MC.set_sweep_function(pw.wrap_par_to_swf(self.cw_source.frequency))
        MC.set_sweep_points(freqs)
        MC.set_detector_function(
            det.Heterodyne_probe(self.heterodyne_instr,
                                 trigger_separation=2.8e-6,
                                 demod_mode='single'))
        MC.run(name='spectroscopy' + self.msmt_suffix)

        self.cw_source.off()

        if analyze:
            ma.MeasurementAnalysis(auto=True, close_fig=close_fig)
示例#12
0
    def test_save_exp_metadata(self):
        metadata_dict = {
            "intParam": 1,
            "floatParam": 2.5e-3,
            "strParam": "spam",
            "listParam": [1, 2, 3, 4],
            "arrayParam": np.array([4e5, 5e5]),
            "dictParam": {
                "a": 1,
                "b": 2
            },
            "tupleParam": (3, "c"),
        }

        old_a_tools_datadir = a_tools.datadir
        a_tools.datadir = self.MC.datadir()

        sweep_pts = np.linspace(0, 10, 30)
        self.MC.set_sweep_function(None_Sweep())
        self.MC.set_sweep_points(sweep_pts)
        self.MC.set_detector_function(det.Dummy_Detector_Soft())
        self.MC.run("test_exp_metadata", exp_metadata=metadata_dict)
        a = ma.MeasurementAnalysis(label="test_exp_metadata", auto=False)

        a_tools.datadir = old_a_tools_datadir

        loaded_dict = read_dict_from_hdf5(
            {}, a.data_file["Experimental Data"]["Experimental Metadata"])

        np.testing.assert_equal(metadata_dict, loaded_dict)
    def extract_data(self):
        self.raw_data_dict = OrderedDict()
        self.timestamps = a_tools.get_timestamps_in_range(self.t_start,
                                                          self.t_stop,
                                                          label=self.labels)
        self.raw_data_dict["timestamps"] = self.timestamps

        self.timestamp = self.timestamps[0]
        a = ma_old.MeasurementAnalysis(timestamp=self.timestamp,
                                       auto=False,
                                       close_file=False)
        a.get_naming_and_values()

        self.raw_data_dict["xvals"] = a.sweep_points
        self.raw_data_dict["xlabel"] = a.parameter_names[0]
        self.raw_data_dict["xunit"] = a.parameter_units[0]

        self.raw_data_dict["bins"] = a.data_file["Experimental Data"][
            "Experimental Metadata"]["bins"].value
        self.raw_data_dict["measured_values"] = a.measured_values
        self.raw_data_dict["value_names"] = a.value_names
        self.raw_data_dict["value_units"] = a.value_units
        self.raw_data_dict["measurementstring"] = a.measurementstring
        self.raw_data_dict["folder"] = a.folder
        a.finish()
示例#14
0
    def __init__(self, auto=True, label='', timestamp=None,
                 fig_format='png',
                 q0_label='q0',
                 q1_label='q1', close_fig=True, **kw):
        self.label = label
        self.timestamp = timestamp
        self.fig_format = fig_format
        # q0 == D2
        self.q0_label = q0_label
        # q1 == A
        self.q1_label = q1_label
        self.n_states = 2 ** 2
        self.ma_obj = ma.MeasurementAnalysis(auto=False, label=label,
                                             timestamp=timestamp)
        self.ma_obj.get_naming_and_values()
        # self.get_naming_and_values()
        # hard coded number of segments for a 2 qubit state tomography
        # constraint imposed by UHFLI
        self.nr_segments = 16
        # self.exp_name = os.path.split(self.folder)[-1][7:]

        avg_h1 = self.ma_obj.measured_values[0]
        avg_h2 = self.ma_obj.measured_values[1]
        avg_h12 = self.ma_obj.measured_values[2]
        h1_00 = np.mean(avg_h1[36:36+7])
        h1_01 = np.mean(avg_h1[43:43+7])
        h1_10 = np.mean(avg_h1[50:50+7])
        h1_11 = np.mean(avg_h1[57:])

        h2_00 = np.mean(avg_h2[36:36+7])
        h2_01 = np.mean(avg_h2[43:43+7])
        h2_10 = np.mean(avg_h2[50:50+7])
        h2_11 = np.mean(avg_h2[57:])

        h12_00 = np.mean(avg_h12[36:36+7])
        h12_01 = np.mean(avg_h12[43:43+7])
        h12_10 = np.mean(avg_h12[50:50+7])
        h12_11 = np.mean(avg_h12[57:])

        measurement_channel_1 = np.array([avg_h1[0], avg_h1[1], avg_h1[7],
                                          avg_h1[8], avg_h1[14], avg_h1[21],
                                          avg_h1[28], avg_h1[35]])
        measurement_channel_2 = np.array([avg_h2[0], avg_h2[1], avg_h2[7], avg_h2[8],
                                          avg_h2[14], avg_h2[21], avg_h2[28], avg_h2[35]])
        measurement_channel_3 = np.array([avg_h12[0], avg_h12[1], avg_h12[7],
                                          avg_h12[8], avg_h12[14], avg_h12[21],
                                          avg_h12[28],avg_h12[35]])
        self.measurements_tomo = np.array([measurement_channel_1,
                                           measurement_channel_2,
                                           measurement_channel_3]).flatten()
        # print(self.measurements_tomo)
        # print(len(self.measurements_tomo))

        # 108 x 1
        # get the calibration points by averaging over the five measurements
        # taken knowing the initial state we put in
        self.measurements_cal = np.array(
            [h1_00, h1_01, h1_10, h1_11,
             h2_00, h2_01, h2_10, h2_11,
             h12_00, h12_01, h12_10, h12_11])
示例#15
0
def measure_SWAP_CZ_SWAP(device,
                         qS_name,
                         qCZ_name,
                         CZ_phase_corr_amps,
                         sweep_qubit,
                         excitations='both_cases',
                         MC=None,
                         upload=True):
    if MC is None:
        MC = station.components['MC']
    if excitations == 'both_cases':
        CZ_phase_corr_amps = np.tile(CZ_phase_corr_amps, 2)
    amp_step = CZ_phase_corr_amps[1] - CZ_phase_corr_amps[0]
    swp_pts = np.concatenate(
        [CZ_phase_corr_amps,
         np.arange(4) * amp_step + CZ_phase_corr_amps[-1]])

    qS = device.qubits()[qS_name]
    qCZ = device.qubits()[qCZ_name]

    int_avg_det = det.UHFQC_integrated_average_detector(
        UHFQC=qS._acquisition_instr,
        AWG=qS.AWG,
        channels=[
            qCZ.RO_acq_weight_function_I(),
            qS.RO_acq_weight_function_I()
        ],
        nr_averages=qS.RO_acq_averages(),
        integration_length=qS.RO_acq_integration_length(),
        result_logging_mode='lin_trans')
    operation_dict = device.get_operation_dict()
    S_CZ_S_swf = awg_swf.awg_seq_swf(
        fsqs.SWAP_CZ_SWAP_phase_corr_swp,
        parameter_name='phase_corr_amps',
        unit='V',
        AWG=qS.AWG,
        fluxing_channels=[qS.fluxing_channel(),
                          qCZ.fluxing_channel()],
        upload=upload,
        awg_seq_func_kwargs={
            'operation_dict': operation_dict,
            'qS': qS.name,
            'qCZ': qCZ.name,
            'sweep_qubit': sweep_qubit,
            'RO_target': qCZ.name,
            'excitations': excitations,
            'upload': upload,
            'distortion_dict': qS.dist_dict()
        })

    MC.set_sweep_function(S_CZ_S_swf)
    MC.set_detector_function(int_avg_det)
    MC.set_sweep_points(swp_pts)
    # MC.set_sweep_points(phases)

    MC.run('SWAP_CP_SWAP_{}_{}'.format(qS_name, qCZ_name))
    ma.MeasurementAnalysis()  # N.B. you may want to run different analysis
    def measure_transients(self,
                           return_detector=False,
                           MC=None,
                           analyze=True,
                           close_fig=True,
                           verbose=True,
                           set_integration_weights=False,
                           nr_samples=512):
        if set_integration_weights:
            print("always using 512 samples to set the weightfunction")
            self.CBox.nr_samples.set(512)
        else:
            self.CBox.nr_samples.set(nr_samples)

        self.prepare_for_timedomain()
        if MC is None:
            MC = self.MC

        self.MC.set_sweep_function(
            awg_swf.OffOn(pulse_pars=self.pulse_pars,
                          RO_pars=self.RO_pars,
                          pulse_comb='OffOff',
                          nr_samples=nr_samples))
        self.MC.set_detector_function(self.input_average_detector)
        self.MC.run('Measure_transients_{}_0'.format(self.msmt_suffix))
        a0 = ma.MeasurementAnalysis(auto=True, close_fig=close_fig)
        self.MC.set_sweep_function(
            awg_swf.OffOn(pulse_pars=self.pulse_pars,
                          RO_pars=self.RO_pars,
                          pulse_comb='OnOn',
                          nr_samples=nr_samples))
        self.MC.set_detector_function(self.input_average_detector)
        self.MC.run('Measure_transients_{}_1'.format(self.msmt_suffix))
        a1 = ma.MeasurementAnalysis(auto=True, close_fig=close_fig)

        if set_integration_weights:
            transient0 = a0.data[1, :]
            transient1 = a1.data[1, :]
            optimized_weights = transient1 - transient0
            optimized_weights = optimized_weights + np.mean(optimized_weights)
            self.CBox.sig0_integration_weights.set(optimized_weights)
            self.CBox.sig1_integration_weights.set(
                np.zeros(512))  #disabling the Q quadrature
示例#17
0
    def extract_data(self):
        """
        Custom data extraction for this specific experiment.
        """
        self.raw_data_dict = OrderedDict()

        self.timestamps = a_tools.get_timestamps_in_range(self.t_start,
                                                          self.t_stop,
                                                          label=self.labels)

        a = ma_old.MeasurementAnalysis(timestamp=self.timestamps[0],
                                       auto=False,
                                       close_file=False)
        a.get_naming_and_values()

        if 'bins' in a.data_file['Experimental Data'][
                'Experimental Metadata'].keys():
            bins = a.data_file['Experimental Data']['Experimental Metadata'][
                'bins'].value
            self.raw_data_dict['ncl'] = bins[:-6:2]
            self.raw_data_dict['bins'] = bins

            self.raw_data_dict['value_names'] = a.value_names
            self.raw_data_dict['value_units'] = a.value_units
            self.raw_data_dict['measurementstring'] = a.measurementstring
            self.raw_data_dict['timestamp_string'] = a.timestamp_string

            self.raw_data_dict['binned_vals'] = OrderedDict()
            self.raw_data_dict['cal_pts_zero'] = OrderedDict()
            self.raw_data_dict['cal_pts_one'] = OrderedDict()
            self.raw_data_dict['cal_pts_two'] = OrderedDict()
            self.raw_data_dict['measured_values_I'] = OrderedDict()
            self.raw_data_dict['measured_values_X'] = OrderedDict()
            for i, val_name in enumerate(a.value_names):
                binned_yvals = np.reshape(a.measured_values[i],
                                          (len(bins), -1),
                                          order='F')
                self.raw_data_dict['binned_vals'][val_name] = binned_yvals
                self.raw_data_dict['cal_pts_zero'][val_name] =\
                    binned_yvals[-6:-4, :].flatten()
                self.raw_data_dict['cal_pts_one'][val_name] =\
                    binned_yvals[-4:-2, :].flatten()
                self.raw_data_dict['cal_pts_two'][val_name] =\
                    binned_yvals[-2:, :].flatten()
                self.raw_data_dict['measured_values_I'][val_name] =\
                    binned_yvals[:-6:2, :]
                self.raw_data_dict['measured_values_X'][val_name] =\
                    binned_yvals[1:-6:2, :]

        else:
            bins = None

        self.raw_data_dict['folder'] = a.folder
        self.raw_data_dict['timestamps'] = self.timestamps
        a.finish()  # closes data file
示例#18
0
def rSWAP_scan(device,
               qS_name,
               qCZ_name,
               recovery_swap_amps,
               emulate_cross_driving=False,
               MC=None,
               upload=True):
    if MC is None:
        MC = station.components['MC']
    amp_step = recovery_swap_amps[1] - recovery_swap_amps[0]
    swp_pts = np.concatenate(
        [recovery_swap_amps,
         np.arange(4) * amp_step + recovery_swap_amps[-1]])

    qS = device.qubits()[qS_name]
    qCZ = device.qubits()[qCZ_name]

    int_avg_det = det.UHFQC_integrated_average_detector(
        UHFQC=qS._acquisition_instr,
        AWG=qS.AWG,
        channels=[
            qCZ.RO_acq_weight_function_I(),
            qS.RO_acq_weight_function_I()
        ],
        nr_averages=qS.RO_acq_averages(),
        integration_length=qS.RO_acq_integration_length(),
        result_logging_mode='lin_trans')
    operation_dict = device.get_operation_dict()
    rSWAP_swf = awg_swf.awg_seq_swf(
        fsqs.rSWAP_amp_sweep,
        parameter_name='rSWAP amplitude',
        unit=r'% dac resolution',
        AWG=qS.AWG,
        fluxing_channels=[qS.fluxing_channel(),
                          qCZ.fluxing_channel()],
        upload=upload,
        awg_seq_func_kwargs={
            'operation_dict': operation_dict,
            'qS': qS.name,
            'qCZ': qCZ.name,
            'recovery_swap_amps': swp_pts,
            'RO_target': qCZ.name,
            'emulate_cross_driving': emulate_cross_driving,
            'upload': upload,
            'distortion_dict': qS.dist_dict()
        })

    MC.set_sweep_function(rSWAP_swf)
    MC.set_detector_function(int_avg_det)
    MC.set_sweep_points(swp_pts)
    # MC.set_sweep_points(phases)

    MC.run('rSWAP_{}_{}'.format(qS_name, qCZ_name))
    ma.MeasurementAnalysis()  # N.B. you may want to run different analysis
    def extract_data(self):
        """
        Custom data extraction for this specific experiment.
        """
        self.timestamps = a_tools.get_timestamps_in_range(
            self.t_start, self.t_stop,
            label=self.labels)
        self.timestamp = self.timestamps[0]
        self.raw_data_dict = OrderedDict()

        self.raw_data_dict['amps'] = []
        self.raw_data_dict['data'] = []

        for i, timestamp in enumerate(self.timestamps):
            a = ma_old.MeasurementAnalysis(
                timestamp=timestamp, auto=False, close_file=False)
            a.get_naming_and_values()
            if i == 0:
                if self.ch_amp_key is None: 
                    ch_amp = 1
                else: 
                    ch_amp = a.data_file[self.ch_amp_key].attrs['value']
                if self.ch_range_key is None:
                    ch_range = 2  # corresponds to a scale factor of 1
                else:
                    ch_range = a.data_file[self.ch_range_key].attrs['value']
                waveform_amp = a.data_file[self.waveform_amp_key].attrs['value']
                amp = ch_amp*ch_range/2*waveform_amp

                # read conversion polynomial from the datafile if not provided as input
                if isinstance(self.polycoeffs_freq_conv, str):
                    self.polycoeffs_freq_conv = np.array(
                        a.data_file[self.polycoeffs_freq_conv])

                self.raw_data_dict['data'] =\
                    a.measured_values[self.ch_idx_cos] + \
                    1j * a.measured_values[self.ch_idx_sin]

                # hacky but required for data saving
                self.raw_data_dict['folder'] = a.folder
                self.raw_data_dict['amps'].append(amp)

            else:
                # If multiple datasets are used, shapes must match
                self.raw_data_dict['data'] +=\
                    a.measured_values[self.ch_idx_cos] + \
                    1j * a.measured_values[self.ch_idx_sin]
            a.finish()

        self.raw_data_dict['times'] = a.sweep_points
        self.raw_data_dict['timestamps'] = self.timestamps
示例#20
0
 def extract_data(self):
     self.raw_data_dict = OrderedDict()
     a = ma.MeasurementAnalysis(
         timestamp=self.ts, label=self.label, auto=False)
     a.get_naming_and_values_2D()
     a.finish()
     self.timestamps = [a.timestamp_string]
     self.raw_data_dict['timestamps'] = self.timestamps
     self.raw_data_dict['timestamp_string'] = a.timestamp
     for attr in ['sweep_points', 'sweep_points_2D', 'measured_values',
                  'parameter_names', 'parameter_units', 'value_names',
                  'value_units']:
         self.raw_data_dict[attr] = getattr(a, attr)
     self.raw_data_dict['folder'] = a.folder
示例#21
0
 def measure_resonator_dac(self, freqs, dac_voltages,
                           MC=None, analyze=True, close_fig=True):
     self.prepare_for_continuous_wave()
     if MC is None:
         MC = self.MC
     MC.set_sweep_functions(
         [self.heterodyne_instr.frequency,
          self.IVVI.parameters['dac{}'.format(self.dac_channel())]])
     MC.set_sweep_points(freqs)
     MC.set_sweep_points_2D(dac_voltages)
     MC.set_detector_function(det.Heterodyne_probe(self.heterodyne_instr))
     MC.run(name='Resonator_dac_scan'+self.msmt_suffix, mode='2D')
     if analyze:
         ma.MeasurementAnalysis(auto=True, TwoD=True, close_fig=close_fig)
    def measure_heterodyne_spectroscopy(self, freqs, MC=None,
                                        analyze=True, close_fig=True):
        self.prepare_for_continuous_wave()

        # sqts.Pulsed_spec_seq(spec_pars, RO_pars)
        if MC is None:
            MC = self.MC.get_instr()
        MC.set_sweep_function(pw.wrap_par_to_swf(
                              self.heterodyne_instr.get_instr().frequency, retrieve_value=True))
        MC.set_sweep_points(freqs)
        MC.set_detector_function(
            det.Heterodyne_probe(self.heterodyne_instr.get_instr(),
                                 trigger_separation=self.RO_acq_integration_length()+5e-6, RO_length=self.RO_acq_integration_length()))
        MC.run(name='Resonator_scan'+self.msmt_suffix)
        if analyze:
            ma.MeasurementAnalysis(auto=True, close_fig=close_fig)
示例#23
0
def measure_two_qubit_AllXY(device,
                            q0_name,
                            q1_name,
                            sequence_type='sequential',
                            MC=None,
                            result_logging_mode='lin_trans'):

    if MC is None:
        MC = qc.station.components['MC']

    q0 = device.find_instrument(q0_name)
    q1 = device.find_instrument(q1_name)

    q0.prepare_for_timedomain()
    q1.prepare_for_timedomain()

    double_points = True
    AllXY = mqqs.two_qubit_AllXY(q0_name,
                                 q1_name,
                                 RO_target=q0_name,
                                 sequence_type=sequence_type,
                                 replace_q1_pulses_X180=False,
                                 double_points=double_points)

    op_dict = device.get_operation_dict()
    for q in device.qubits():
        op_dict['I ' + q]['instruction'] = ''

    s = swf.QASM_Sweep(AllXY.name, device.central_controller.get_instr(),
                       op_dict)
    d = det.UHFQC_integrated_average_detector(
        device.acquisition_instrument.get_instr(),
        AWG=device.central_controller.get_instr(),
        nr_averages=q0.RO_acq_averages(),
        integration_length=q0.RO_acq_integration_length(),
        result_logging_mode=result_logging_mode,
        channels=[
            q0.RO_acq_weight_function_I(),
            q1.RO_acq_weight_function_I()
        ])

    MC.set_sweep_function(s)
    MC.set_sweep_points(np.arange(21 * (1 + double_points)))
    MC.set_detector_function(d)
    MC.run('AllXY_{}_{}'.format(q0_name, q1_name))
    ma.MeasurementAnalysis()
示例#24
0
    def _measure_1D(self, parameter, values, label, analyze=True):

        MC = self.instr_mc.get_instr()

        initial_value = parameter()

        detector = self.prepare_readout()

        MC.set_sweep_function(parameter)
        MC.set_sweep_points(values)
        MC.set_detector_function(detector)

        MC.run(name=label + self.msmt_suffix)
        if analyze:
            ma.MeasurementAnalysis(auto=True)

        parameter(initial_value)
示例#25
0
    def extract_data(self):
        """
        Custom data extraction for this specific experiment.
        """
        self.raw_data_dict = OrderedDict()
        self.timestamps = a_tools.get_timestamps_in_range(self.t_start,
                                                          self.t_stop,
                                                          label=self.labels)

        a = ma_old.MeasurementAnalysis(timestamp=self.timestamps[0],
                                       auto=False,
                                       close_file=False)
        a.get_naming_and_values()

        time = a.sweep_points[:-6:2]

        self.raw_data_dict['time'] = time
        self.raw_data_dict['time units'] = a.sweep_unit[0]

        self.raw_data_dict['value_names'] = a.value_names
        self.raw_data_dict['value_units'] = a.value_units
        self.raw_data_dict['measurementstring'] = a.measurementstring
        self.raw_data_dict['timestamp_string'] = a.timestamp_string

        self.raw_data_dict['cal_pts_zero'] = OrderedDict()
        self.raw_data_dict['cal_pts_one'] = OrderedDict()
        self.raw_data_dict['cal_pts_two'] = OrderedDict()
        self.raw_data_dict['measured_values_I'] = OrderedDict()
        self.raw_data_dict['measured_values_X'] = OrderedDict()

        for i, val_name in enumerate(a.value_names):
            self.raw_data_dict['cal_pts_zero'][val_name] = \
                a.measured_values[i][-6:-4]
            self.raw_data_dict['cal_pts_one'][val_name] = \
                a.measured_values[i][-4:-2]
            self.raw_data_dict['cal_pts_two'][val_name] = \
                a.measured_values[i][-2:]
            self.raw_data_dict['measured_values_I'][val_name] = \
                a.measured_values[i][::2][:-3]
            self.raw_data_dict['measured_values_X'][val_name] = \
                a.measured_values[i][1::2][:-3]

        self.raw_data_dict['folder'] = a.folder
        self.raw_data_dict['timestamps'] = self.timestamps
        a.finish()  # closes data file
示例#26
0
 def measure_resonator_power(self, freqs, powers,
                             MC=None, analyze=True, close_fig=True):
     '''
     N.B. This one does not use powers but varies the mod-amp.
     Need to find a way to keep this function agnostic to that
     '''
     self.prepare_for_continuous_wave()
     if MC is None:
         MC = self.MC
     MC.set_sweep_functions(
         [pw.wrap_par_to_swf(self.heterodyne_instr.frequency),
          pw.wrap_par_to_swf(self.heterodyne_instr.RF_power)])
     MC.set_sweep_points(freqs)
     MC.set_sweep_points_2D(powers)
     MC.set_detector_function(det.Heterodyne_probe(self.heterodyne_instr))
     MC.run(name='Resonator_power_scan'+self.msmt_suffix, mode='2D')
     if analyze:
         ma.MeasurementAnalysis(auto=True, TwoD=True, close_fig=close_fig)
 def measure_heterodyne_spectroscopy(self,
                                     freqs,
                                     MC=None,
                                     analyze=True,
                                     close_fig=True,
                                     RO_length=2000e-9):
     self.prepare_for_continuous_wave()
     if MC is None:
         MC = self.MC
     MC.set_sweep_function(
         pw.wrap_par_to_swf(self.heterodyne_instr.frequency))
     MC.set_sweep_points(freqs)
     MC.set_detector_function(
         det.Heterodyne_probe(self.heterodyne_instr,
                              trigger_separation=2.8e-6,
                              RO_length=2274e-9))
     MC.run(name='Resonator_scan' + self.msmt_suffix)
     if analyze:
         ma.MeasurementAnalysis(auto=True, close_fig=close_fig)
    def measure_pulsed_spectroscopy(self,
                                    freqs,
                                    MC=None,
                                    analyze=True,
                                    return_detector=False,
                                    close_fig=True,
                                    upload=True):
        """
        Measure pulsed spec with the qubit.

            Accepts a manual sequence parameters, which has to be a call to a
            pulse generation allowing for alternative sequences to be played
            instead of the standard one

        """

        self.prepare_for_pulsed_spec()
        self.heterodyne_instr._disable_auto_seq_loading = True

        self.cw_source.pulsemod_state.set('On')
        self.cw_source.power.set(self.spec_pow_pulsed.get())
        self.cw_source.on()

        if MC is None:
            MC = self.MC

        spec_pars, RO_pars = self.get_spec_pars()
        # Upload the AWG sequence
        sq.Pulsed_spec_seq(spec_pars, RO_pars)

        self.AWG.start()
        if return_detector:
            return det.Heterodyne_probe(self.heterodyne_instr)

        else:
            MC.set_sweep_function(self.cw_source.frequency)
            MC.set_sweep_points(freqs)
            MC.set_detector_function(
                det.Heterodyne_probe(self.heterodyne_instr))
            MC.run(name='pulsed-spec' + self.msmt_suffix)
            if analyze:
                ma.MeasurementAnalysis(auto=True, close_fig=close_fig)
        self.cw_source.off()
    def measure_pulsed_spectroscopy(self,
                                    freqs,
                                    mode='ROGated_SpecGate',
                                    MC=None,
                                    analyze=True,
                                    close_fig=True,
                                    force_load=False):
        # This is a trick so I can reuse the heterodyne instr
        # to do pulsed-spectroscopy
        self.heterodyne_instr._disable_auto_seq_loading = True

        if mode == 'ROMod_SpecGated':
            if ('Pulsed_spec_with_RF_mod'
                    not in self.AWG.setup_filename.get()) or force_load:
                st_seqs.Pulsed_spec_seq_RF_mod(
                    IF=self.f_RO_mod.get(),
                    spec_pulse_length=spec_pulse_length,
                    marker_interval=30e-6,
                    RO_pulse_delay=self.RO_pulse_delay.get())
        elif mode == 'ROGated_SpecGate':
            if ('Pulsed_spec_with_RF_gated'
                    not in self.AWG.setup_filename.get()) or force_load:
                st_seqs.Pulsed_spec_seq_RF_gated(self.RO_pars, self.pulse_pars)
        else:
            NotImplementedError(
                'Pulsed Spec mode not supported. Only ROMod_SpecGated and ROGated_SpecGate are avaible right now.\n'
            )

        self.cw_source.pulsemod_state.set('on')
        self.cw_source.power.set(self.spec_pow_pulsed.get())

        self.AWG.start()
        if hasattr(self.heterodyne_instr, 'mod_amp'):
            self.heterodyne_instr.set('mod_amp', self.mod_amp_cw.get())
        else:
            self.heterodyne_instr.RF.power(self.RO_power_cw())
        MC.set_sweep_function(pw.wrap_par_to_swf(self.cw_source.frequency))
        MC.set_sweep_points(freqs)
        MC.set_detector_function(det.Heterodyne_probe(self.heterodyne_instr))
        MC.run(name='pulsed-spec' + self.msmt_suffix)
        if analyze:
            ma.MeasurementAnalysis(auto=True, close_fig=close_fig)
示例#30
0
    def extract_data(self):
        self.raw_data_dict = OrderedDict()

        self.timestamps = a_tools.get_timestamps_in_range(self.t_start,
                                                          self.t_stop,
                                                          label=self.labels)
        self.raw_data_dict['timestamps'] = self.timestamps

        self.timestamp = self.timestamps[0]
        a = ma_old.MeasurementAnalysis(timestamp=self.timestamp,
                                       auto=False,
                                       close_file=False)
        a.get_naming_and_values()

        self.raw_data_dict['xvals'] = a.sweep_points
        self.raw_data_dict['xlabel'] = a.parameter_names[0]
        self.raw_data_dict['xunit'] = a.parameter_units[0]

        self.raw_data_dict['bins'] = a.data_file['Experimental Data'][
            'Experimental Metadata']['bins'].value

        if self.gst_exp_list_filepath == None:
            gst_exp_list_filename = a.data_file['Experimental Data'][
                'Experimental Metadata'].attrs['gst_exp_list_filename']

            self.raw_data_dict['gst_exp_list_filepath'] = os.path.join(
                gst_exp_filepath, gst_exp_list_filename)
        else:
            self.raw_data_dict['gst_exp_list_filepath'] = \
                self.gst_exp_list_filepath

        self.raw_data_dict['expList'] = pygsti_expList_from_dataset(
            self.raw_data_dict['gst_exp_list_filepath'])

        self.raw_data_dict['measured_values'] = a.measured_values
        self.raw_data_dict['value_names'] = a.value_names
        self.raw_data_dict['value_units'] = a.value_units
        self.raw_data_dict['measurementstring'] = a.measurementstring
        self.measurementstring = a.measurementstring
        self.raw_data_dict['folder'] = a.folder
        a.finish()