Пример #1
0
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
df_lo_MHz = 0.1
sweep_interval = 6
dac_attenuation = 33
fft_gain = 0
tone_sample_exponent = 18
sweep_length_seconds = 0.1
num_sweep_tones = 255

# Hardware
conditioner = analog.HeterodyneMarkII()
magnet = hardware.Thing(name='magnet_array', state={'orientation': 'up',
                                                    'distance_from_base_mm': 276})
hw = hardware.Hardware(conditioner, magnet)
ri = hardware_tools.r1h11_with_mk2(initialize=True, use_config=False)
ri.set_dac_attenuator(dac_attenuation)
ri.set_fft_gain(fft_gain)

# Calculate LO and baseband frequencies
f_resolution = ri.state.adc_sample_rate / 2**tone_sample_exponent
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
f_lo_MHz = df_lo_MHz * np.round((f0_MHz - offset_frequencies_MHz.mean()) / df_lo_MHz)
logger.info("Frequency spacing is {:.1f} kHz".format(1e-3 * sweep_interval * f_resolution))
logger.info("Sweep span is {:.1f} MHz".format(offset_frequencies_MHz.ptp()))
ri.set_lo(lomhz=f_lo_MHz, chan_spacing=df_lo_MHz)
logger.info("Set LO to {:.3f} MHz".format(f_lo_MHz))
ri.set_tone_baseband_freqs(offset_frequencies_MHz[:, np.newaxis], nsamp=2 ** tone_sample_exponent)
Пример #2
0
# Hardware
conditioner = analog.HeterodyneMarkII()
shield = hardware.Thing(name='magnetic_shield_pocket',
                        state={'orientation': 'horizontal'})
generator = hardware.Thing(name='generator',
                           state={
                               'waveform': 'square',
                               'V_pp': 0
                           })
resistor = hardware.Thing(name='resistor',
                          state={
                              'resistance_ohms': 677,
                              'V_pp': 0
                          })
hw = hardware.Hardware(conditioner, shield, generator, resistor)
ri = hardware_tools.r1h11_with_mk2(initialize=True, use_config=False)
ri.adc_valon.set_ref_select(0)  # internal
ri.lo_valon.set_ref_select(1)  # external

# Calculate sweep parameters, LO and baseband sweep frequencies
ri_state = ri.state
tone_sample_exponent = int(
    np.round(np.log2(ri_state.adc_sample_rate / df_baseband_target)))
df_baseband = ri_state.adc_sample_rate / 2**tone_sample_exponent
logger.info("Baseband resolution is {:.0f} Hz using 2^{:d} samples".format(
    df_baseband, tone_sample_exponent))
num_sweep_tones = min(int(df_total / df_baseband),
                      ri.max_num_waveforms(2**tone_sample_exponent))
logger.info("Using {:d} tones".format(num_sweep_tones))
f_baseband = f_baseband_minimum + ri.state.adc_sample_rate / 2**tone_sample_exponent * np.arange(
    num_sweep_tones)