Exemple #1
0
    def setup_roach(self, N=16, nsamp=2**20, NFFT=2**8, lendata=2**6, Fs=512.e6, atten=None, lof=1000, use_r2=True, use_mk2=True):
        self.N = N
        self.nsamp = nsamp
        self.NFFT = NFFT
        self.lendata = lendata
        self.Fs = Fs
        self.use_r2 = use_r2

        if use_r2:
            self.r = hardware_tools.r2_with_mk2()
        else:
            if use_mk2:
                self.r = hardware_tools.r1_with_mk2()
            else:   
                self.r = hardware_tools.r1_with_mk1()
            self.lendata = 1

        if atten != None: 
            self.r.set_dac_attenuator(atten)

        self.r.set_lo(lof, modulator_lo_power=5, demodulator_lo_power=5)
        self.lo = lof
        self.r.iq_delay = 0
        freqs = self.r.set_tone_baseband_freqs(np.linspace(10, 150, N), nsamp=nsamp)
        self.r.select_fft_bins(range(N))
        self.r._sync()
        return
frequency_shift = 1 - 0
f0_MHz *= frequency_shift
attenuations = [20, 40]  # [10, 20, 30, 40, 50, 60]
sweep_interval = 32
tone_sample_exponent = 18
sweep_length_seconds = 0.1
stream_length_seconds = 30
lo_round_to_MHz = 2
f_minimum = 10e6  # Keep the tones away from the LO by at least this frequency.
f_stream_offset_MHz = 10  # Set a second tone away from the resonance by this amount
num_sweep_tones = 127

# Hardware
conditioner = analog.HeterodyneMarkII()
hw = hardware.Hardware(conditioner)
ri = hardware_tools.r1_with_mk2()
ri.set_modulation_output('high')

# Calculate LO and baseband frequencies
num_tone_samples = 2**tone_sample_exponent
f_resolution = ri.state.adc_sample_rate / num_tone_samples
minimum_integer = int(f_minimum / f_resolution)
offset_integers = minimum_integer + sweep_interval * np.arange(num_sweep_tones)
offset_frequencies_MHz = 1e-6 * f_resolution * offset_integers
offset_array_MHz = offset_frequencies_MHz[:, np.newaxis] + np.array([0, f_stream_offset_MHz])[np.newaxis, :]
lo_MHz = lo_round_to_MHz * np.round((f0_MHz - offset_frequencies_MHz.mean()) / lo_round_to_MHz)
logger.info("Frequency spacing is {:.1f} kHz".format(1e3 * (offset_frequencies_MHz[1] - offset_frequencies_MHz[0])))
logger.info("Sweep span is {:.1f} MHz".format(offset_frequencies_MHz.ptp()))

# Run
ncf = acquire.new_nc_file(suffix='sweep_stream_on_off')
Exemple #3
0
tone_sample_exponent = 18
sweep_length_seconds = 0.1
stream_length_seconds = 30
lo_round_to_MHz = 2
f_minimum = 10e6  # Keep the tones away from the LO by at least this frequency.
f_stream_offset_MHz = 10  # Set a second tone away from the resonance by this amount
num_sweep_tones = 127

# Hardware
conditioner = analog.HeterodyneMarkII()
magnet = hardware.Thing('canceling_magnet_quincunx', {
    'orientation': 'up',
    'ruler_to_base_mm': magnet_distance_mm
})
hw = hardware.Hardware(conditioner, magnet)
ri = hardware_tools.r1_with_mk2()
ri.set_modulation_output('high')

# Calculate LO and baseband frequencies
num_tone_samples = 2**tone_sample_exponent
f_resolution = ri.state.adc_sample_rate / num_tone_samples
minimum_integer = int(f_minimum / f_resolution)
offset_integers = minimum_integer + sweep_interval * np.arange(num_sweep_tones)
offset_frequencies_MHz = 1e-6 * f_resolution * offset_integers
offset_array_MHz = offset_frequencies_MHz[:, np.newaxis] + np.array(
    [0, f_stream_offset_MHz])[np.newaxis, :]
lo_MHz = lo_round_to_MHz * np.round(
    (f0_MHz - offset_frequencies_MHz.mean()) / lo_round_to_MHz)
logger.info("Frequency spacing is {:.1f} kHz".format(
    1e3 * (offset_frequencies_MHz[1] - offset_frequencies_MHz[0])))
logger.info("Sweep span is {:.1f} MHz".format(offset_frequencies_MHz.ptp()))