Ejemplo n.º 1
0
    def run(
        self,
        presto_address: str,
        presto_port: int = None,
        ext_ref_clk: bool = False,
    ) -> str:
        with lockin.Lockin(
                address=presto_address,
                port=presto_port,
                ext_ref_clk=ext_ref_clk,
                **CONVERTER_CONFIGURATION,
        ) as lck:
            assert lck.hardware is not None

            lck.hardware.set_adc_attenuation(self.input_port, 0.0)
            lck.hardware.set_dac_current(self.output_port, DAC_CURRENT)
            lck.hardware.set_inv_sinc(self.output_port, 0)

            nr_bias = len(self.bias_arr)
            nr_pump_pwr = len(self.pump_pwr_arr)
            _, self.df = lck.tune(0.0, self.df)

            f_start = self.freq_center - self.freq_span / 2
            f_stop = self.freq_center + self.freq_span / 2
            n_start = int(round(f_start / self.df))
            n_stop = int(round(f_stop / self.df))
            n_arr = np.arange(n_start, n_stop + 1)
            nr_freq = len(n_arr)
            self.freq_arr = self.df * n_arr

            self.ref_resp_arr = np.zeros((nr_bias, nr_freq), np.complex128)
            self.ref_pwr_arr = np.zeros((nr_bias, nr_freq), np.float64)
            self.resp_arr = np.zeros((nr_pump_pwr, nr_bias, nr_freq),
                                     np.complex128)
            self.pwr_arr = np.zeros((nr_pump_pwr, nr_bias, nr_freq),
                                    np.float64)

            lck.hardware.set_lmx(
                0.0, 0, self.pump_port)  # start with pump off for reference
            lck.hardware.set_dc_bias(self.bias_arr[0], self.bias_port)
            lck.hardware.sleep(0.1, False)

            lck.hardware.configure_mixer(
                freq=self.freq_arr[0],
                in_ports=self.input_port,
                out_ports=self.output_port,
            )
            lck.set_df(self.df)
            og = lck.add_output_group(self.output_port, 1)
            og.set_frequencies(0.0)
            og.set_amplitudes(self.amp)
            og.set_phases(0.0, 0.0)

            lck.set_dither(self.dither, self.output_port)
            ig = lck.add_input_group(self.input_port, 1)
            ig.set_frequencies(0.0)

            lck.apply_settings()

            pb = ProgressBar((nr_pump_pwr + 1) * nr_bias * nr_freq)
            pb.start()
            for kk, pump_pwr in enumerate(np.r_[-1, self.pump_pwr_arr]):
                if kk == 0:
                    lck.hardware.set_lmx(0.0, 0, self.pump_port)
                else:
                    lck.hardware.set_lmx(self.pump_freq, pump_pwr,
                                         self.pump_port)
                lck.hardware.sleep(0.1, False)
                for jj, bias in enumerate(self.bias_arr):
                    lck.hardware.set_dc_bias(bias, self.bias_port)
                    lck.hardware.sleep(0.1, False)

                    for ii, freq in enumerate(self.freq_arr):
                        lck.hardware.configure_mixer(
                            freq=freq,
                            in_ports=self.input_port,
                            out_ports=self.output_port,
                        )
                        lck.hardware.sleep(1e-3, False)

                        _d = lck.get_pixels(self.num_skip + self.num_averages)
                        data_i = _d[self.input_port][1][:, 0]
                        data_q = _d[self.input_port][2][:, 0]
                        data = data_i.real + 1j * data_q.real  # using zero IF

                        if kk == 0:
                            self.ref_resp_arr[jj, ii] = np.mean(
                                data[-self.num_averages:])
                            self.ref_pwr_arr[jj, ii] = np.mean(
                                np.abs(data[-self.num_averages:])**2)
                        else:
                            self.resp_arr[kk - 1, jj, ii] = np.mean(
                                data[-self.num_averages:])
                            self.pwr_arr[kk - 1, jj, ii] = np.mean(
                                np.abs(data[-self.num_averages:])**2)

                        pb.increment()

            pb.done()

            # Mute outputs at the end of the sweep
            og.set_amplitudes(0.0)
            lck.apply_settings()
            lck.hardware.set_dc_bias(0.0, self.bias_port)
            lck.hardware.set_lmx(0.0, 0, self.pump_port)

        return self.save()
Ejemplo n.º 2
0
    def run(
        self,
        presto_address: str,
        presto_port: int = None,
        ext_ref_clk: bool = False,
    ) -> str:
        with lockin.Lockin(
                address=presto_address,
                port=presto_port,
                ext_ref_clk=ext_ref_clk,
                **CONVERTER_CONFIGURATION,
        ) as lck:
            assert lck.hardware is not None

            lck.hardware.set_adc_attenuation(self.input_port, 0.0)
            lck.hardware.set_dac_current(self.output_port, DAC_CURRENT)
            lck.hardware.set_inv_sinc(self.output_port, 0)

            # tune frequencies
            _, self.df = lck.tune(0.0, self.df)
            f_start = self.freq_center - self.freq_span / 2
            f_stop = self.freq_center + self.freq_span / 2
            n_start = int(round(f_start / self.df))
            n_stop = int(round(f_stop / self.df))
            n_arr = np.arange(n_start, n_stop + 1)
            nr_freq = len(n_arr)
            self.freq_arr = self.df * n_arr
            self.resp_arr = np.zeros(nr_freq, np.complex128)

            lck.hardware.configure_mixer(
                freq=self.freq_arr[0],
                in_ports=self.input_port,
                out_ports=self.output_port,
            )
            lck.set_df(self.df)
            og = lck.add_output_group(self.output_port, 1)
            og.set_frequencies(0.0)
            og.set_amplitudes(self.amp)
            og.set_phases(0.0, 0.0)

            lck.set_dither(self.dither, self.output_port)
            ig = lck.add_input_group(self.input_port, 1)
            ig.set_frequencies(0.0)

            lck.apply_settings()

            pb = ProgressBar(nr_freq)
            pb.start()
            for ii in range(len(n_arr)):
                f = self.freq_arr[ii]

                lck.hardware.configure_mixer(
                    freq=f,
                    in_ports=self.input_port,
                    out_ports=self.output_port,
                )
                lck.hardware.sleep(1e-3, False)

                _d = lck.get_pixels(self.num_skip + self.num_averages)
                data_i = _d[self.input_port][1][:, 0]
                data_q = _d[self.input_port][2][:, 0]
                data = data_i.real + 1j * data_q.real  # using zero IF

                self.resp_arr[ii] = np.mean(data[-self.num_averages:])

                pb.increment()

            pb.done()

            # Mute outputs at the end of the sweep
            og.set_amplitudes(0.0)
            lck.apply_settings()

        return self.save()
Ejemplo n.º 3
0
n_start = int(round(f_start / df))
n_stop = int(round(f_stop / df))
n_arr = np.arange(n_start, n_stop + 1)
nr_freqs = len(n_arr)
freq_arr = df * n_arr
resp_arr = np.zeros((nr_bias, nr_freqs), np.complex128)

set_amp(coupler_bias_port, True)
set_dc_bias(coupler_bias_port, coupler_bias_arr[0])
time.sleep(1.0)

with lockin.Lockin(
        address=ADDRESS,
        port=PORT,
        ext_ref_clk=EXT_CLK_REF,
        adc_mode=AdcMode.Mixed,
        adc_fsample=AdcFSample.G2,
        dac_mode=DacMode.Mixed42,
        dac_fsample=DacFSample.G10,
) as lck:
    lck.hardware.set_adc_attenuation(input_port, 0.0)
    lck.hardware.set_dac_current(output_port, 32_000)
    lck.hardware.set_inv_sinc(output_port, 0)

    lck.hardware.configure_mixer(
        freq=freq_arr[0],
        in_ports=input_port,
        out_ports=output_port,
    )
    lck.set_df(df)
    og = lck.add_output_group(output_port, 1)
Ejemplo n.º 4
0
    def run(
        self,
        presto_address: str,
        presto_port: int = None,
        ext_ref_clk: bool = False,
    ) -> str:
        with lockin.Lockin(
                address=presto_address,
                port=presto_port,
                ext_ref_clk=ext_ref_clk,
                **CONVERTER_CONFIGURATION,
        ) as lck:
            assert lck.hardware is not None

            lck.hardware.set_adc_attenuation(self.input_port, 0.0)
            lck.hardware.set_dac_current(self.readout_port, DAC_CURRENT)
            lck.hardware.set_dac_current(self.control_port, DAC_CURRENT)
            lck.hardware.set_inv_sinc(self.readout_port, 0)
            lck.hardware.set_inv_sinc(self.control_port, 0)
            # if USE_JPA:
            #     lck.hardware.set_lmx(jpa_pump_freq, jpa_pump_pwr)

            nr_amps = len(self.control_amp_arr)

            # tune frequencies
            _, self.df = lck.tune(0.0, self.df)
            f_start = self.control_freq_center - self.control_freq_span / 2
            f_stop = self.control_freq_center + self.control_freq_span / 2
            n_start = int(round(f_start / self.df))
            n_stop = int(round(f_stop / self.df))
            n_arr = np.arange(n_start, n_stop + 1)
            nr_freq = len(n_arr)
            self.control_freq_arr = self.df * n_arr
            self.resp_arr = np.zeros((nr_amps, nr_freq), np.complex128)

            lck.hardware.configure_mixer(
                freq=self.readout_freq,
                in_ports=self.input_port,
                out_ports=self.readout_port,
            )
            lck.hardware.configure_mixer(
                freq=self.control_freq_arr[0],
                out_ports=self.control_port,
            )
            lck.set_df(self.df)
            ogr = lck.add_output_group(self.readout_port, 1)
            ogr.set_frequencies(0.0)
            ogr.set_amplitudes(self.readout_amp)
            ogr.set_phases(0.0, 0.0)
            ogc = lck.add_output_group(self.control_port, 1)
            ogc.set_frequencies(0.0)
            ogc.set_amplitudes(self.control_amp_arr[0])
            ogc.set_phases(0.0, 0.0)

            lck.set_dither(self.dither, [self.readout_port, self.control_port])
            ig = lck.add_input_group(self.input_port, 1)
            ig.set_frequencies(0.0)

            lck.apply_settings()

            pb = ProgressBar(nr_amps * nr_freq)
            pb.start()
            for jj, control_amp in enumerate(self.control_amp_arr):
                ogc.set_amplitudes(control_amp)
                lck.apply_settings()

                for ii, control_freq in enumerate(self.control_freq_arr):
                    lck.hardware.configure_mixer(
                        freq=control_freq,
                        out_ports=self.control_port,
                    )
                    lck.hardware.sleep(1e-3, False)

                    _d = lck.get_pixels(self.num_skip + self.num_averages)
                    data_i = _d[self.input_port][1][:, 0]
                    data_q = _d[self.input_port][2][:, 0]
                    data = data_i.real + 1j * data_q.real  # using zero IF

                    self.resp_arr[jj, ii] = np.mean(data[-self.num_averages:])

                    pb.increment()

            pb.done()

            # Mute outputs at the end of the sweep
            ogr.set_amplitudes(0.0)
            ogc.set_amplitudes(0.0)
            lck.apply_settings()
            # if USE_JPA:
            #     lck.hardware.set_lmx(0.0, 0)
        # if USE_JPA:
        #     mla.lockin.set_dc_offset(jpa_bias_port, 0.0)
        #     mla.disconnect()

        return self.save()