attenuation = 20 fft_gain = 4 df_baseband_target = 15e3 f_start = 2.4e9 f_stop = 3.1e9 overlap_fraction = 0.5 f_baseband_minimum = 10e6 # Keep the tones away from the LO by at least this frequency f_baseband_maximum = 200e6 # Keep the tones below this frequency length_seconds = 0 # Take the minimum amount of data, in this case one block filterbank_bin_separation = 2 # The minimum number of PFB bins that separate tones df_lo = 2.5e3 # The minimum num_tones_maximum = 128 # Imposed by the data streaming rate # Hardware conditioner = analog.HeterodyneMarkII() shield = hardware.Thing(name='magnetic_shield_pocket', state={'orientation': 'horizontal'}) led = hardware.Thing(name='led', state={'bias_current_mA': 10}) hw = hardware.Hardware(conditioner, shield) ri = hardware_tools.r1h14_with_mk2(initialize=True, use_config=False) ri.adc_valon.set_ref_select(0) ri.lo_valon.set_ref_select(1) ri.set_dac_attenuator(attenuation) ri.set_fft_gain(fft_gain) # 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))
# Parameters f0_MHz = np.array([2201.8, 2378.8, 2548.9, 2731.5, 2905.1, 3416.0]) num_offsets = 100 span_MHz = 20 minimum_MHz = 10 round_to_MHz = 2 lo_MHz = round_to_MHz * np.round( (f0_MHz - span_MHz / 2 - minimum_MHz) / round_to_MHz) offsets_MHz = np.linspace(minimum_MHz, minimum_MHz + span_MHz, num_offsets) num_tone_samples = 2**19 length_seconds = 0.1 # Hardware conditioner = analog.HeterodyneMarkII() magnet = hardware.Thing('canceling_magnet', { 'orientation': 'up', 'distance_from_base_mm': 25 }) hw = hardware.Hardware(conditioner, magnet) ri = hardware_tools.r2_with_mk2() ri.set_dac_atten(40) ri.set_fft_gain(4) ri.set_modulation_output('high') # Run ncf = acquire.new_nc_file(suffix='sweep') tic = time.time() try: for lo in progress(lo_MHz): state = hw.state() state['temperature'] = { 'package': temps.get_temperature_at(time.time())
fractional_frequency_shift = 0 f_center *= (1 + fractional_frequency_shift) df_baseband_target = 10e3 fine_sweep_num_linewidths = 5 Q_max_expected = 30e3 df_coarse_sweep = f_center.min( ) / Q_max_expected # A coarse sweep with a resolution of one linewidth should work df_total = 2e6 # The total span of the baseband tones df_lo = 2.5e3 # This is the smallest resolution available f_baseband_minimum = 10e6 # Keep the tones away from the LO by at least this frequency. sweep_length_seconds = 0 # Take the minimum amount of data, in this case one block stream_length_seconds = 10 # Hardware conditioner = analog.HeterodyneMarkII() shield = hardware.Thing(name='magnetic_shield_pocket', state={'orientation': 'horizontal'}) generator = hardware.Thing(name='generator', state={ 'waveform': 'pulse', 'V_pp': 0, 'frequency': 100, 'duty_cycle': 0.01 }) resistor = hardware.Thing(name='resistor', state={ 'resistance_ohms': 47, '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
fractional_frequency_shift = 0 f_center *= (1 + fractional_frequency_shift) df_baseband_target = 10e3 fine_sweep_num_linewidths = 5 Q_max_expected = 30e3 df_coarse_sweep = f_center.min( ) / Q_max_expected # A coarse sweep with a resolution of one linewidth should work df_total = 2e6 # The total span of the baseband tones df_lo = 2.5e3 # This is the smallest resolution available f_baseband_minimum = 10e6 # Keep the tones away from the LO by at least this frequency. sweep_length_seconds = 0 # Take the minimum amount of data, in this case one block stream_length_seconds = 10 # 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
all_f0_MHz = np.array( [2254.837, 2326.842, 2483.490, 3313.270, 3378.300, 3503.600, 3524.435]) f0 = all_f0_MHz[3:4] attenuations = [40] # The minimum for sweep resolution: gives 2 ** 5 tones per bin tone_sample_exponent = 16 # This should sweep across one entire bin, with 32 / 4 = 8 tones in the bin. n_lo_offset = np.arange(-32, 33, 4) length_seconds_sweep = 0.1 length_seconds_stream = 10 # 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.adc_valon.set_ref_select(0) # internal ri.lo_valon.set_ref_select(1) # external ri.set_fft_gain(fft_gain) # Calculate LO and baseband frequencies roach_state = ri.state df_tone = roach_state.adc_sample_rate / 2**tone_sample_exponent df_filterbank = roach_state.adc_sample_rate / roach_state.num_filterbank_channels minimum_integer_sweep = int(f_minimum / df_tone) n_baseband_sweep = minimum_integer_sweep + np.arange(num_tones_sweep) f_baseband_MHz_sweep = 1e-6 * df_tone * n_baseband_sweep
frequency_shift = 1 - 0 f0_MHz *= frequency_shift attenuations = [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() 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)
fractional_frequency_shift = 0 f_center *= (1 + fractional_frequency_shift) df_baseband_target = 5e3 fine_sweep_num_linewidths = 5 Q_max_expected = 50e3 df_coarse_sweep = f_center.min( ) / Q_max_expected # A coarse sweep with a resolution of one linewidth should work df_total = 4e6 # The total span of the baseband tones df_lo = 2.5e3 # This is the smallest resolution available f_baseband_minimum = 10e6 # Keep the tones away from the LO by at least this frequency. sweep_length_seconds = 0 # Take the minimum amount of data, in this case one block stream_length_seconds = 10 # Hardware conditioner = analog.HeterodyneMarkII() shield = hardware.Thing(name='magnetic_shield_pocket', state={'orientation': 'horizontal'}) hittite = hardware.Thing(name='hittite', state={'output_dBm': 0}) hw = hardware.Hardware(conditioner, shield, hittite) 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))
acquire.show_settings() logger = acquire.get_script_logger(__file__) # Parameters dummy_MHz = 170 f0_MHz = np.array([78.350, 116.164, 160.815, dummy_MHz]) attenuations = [17, 23, 29, 35, 41] tone_sample_exponent = 21 sweep_length_seconds = 0.1 stream_length_seconds = 30 num_sweep_tones = 128 # Hardware conditioner = analog.Baseband() shield = hardware.Thing(name='magnetic_shield', state={}) hw = hardware.Hardware(conditioner, shield) ri = r2baseband.Roach2Baseband(roachip=ROACH2_IP, adc_valon=ROACH2_VALON) ri.set_modulation_output('high') ri.set_fft_gain(6) # Calculate baseband frequencies num_tone_samples = 2**tone_sample_exponent f_resolution = ri.state.adc_sample_rate / num_tone_samples offset_integers = np.arange(-num_sweep_tones / 2, num_sweep_tones / 2) offset_frequencies_MHz = 1e-6 * f_resolution * offset_integers sweep_frequencies_MHz = offset_frequencies_MHz[:, np.newaxis] + f0_MHz[np.newaxis, :] logger.info("Frequency spacing is {:.3f} kHz".format(1e3 * (offset_frequencies_MHz[1] - offset_frequencies_MHz[0]))) logger.info("Sweep span is {:.3f} MHz".format(offset_frequencies_MHz.ptp())) # Run
f_center = f_center_all # select a subset of the frequencies fractional_frequency_shift = 0 f_center *= (1 + fractional_frequency_shift) df_baseband_target = 200e3 fine_sweep_num_linewidths = 7 Q_max_expected = 5e3 df_coarse_sweep = f_center.min() / Q_max_expected # A coarse sweep with a resolution of one linewidth should work df_total = 10e6 # The total span of the baseband tones df_lo = 2.5e3 # This is the smallest resolution available f_baseband_minimum = 10e6 # Keep the tones away from the LO by at least this frequency. sweep_length_seconds = 0 # Take the minimum amount of data, in this case one block stream_length_seconds = 10 # Hardware conditioner = analog.HeterodyneMarkII() shield = hardware.Thing(name='magnetic_shield_pocket', state={'orientation': 'horizontal'}) hw = hardware.Hardware(conditioner, shield) 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) logger.info("Coarse sweep span is {:.1f} MHz".format(1e-6 * f_baseband.ptp())) coarse_stride = max(df_coarse_sweep // df_baseband, 1)
bands = band_dict.values()[3:] attenuations_list = [(10, ), (25, ), (20, ), (23, ), (20, ), (10, ), (5, ), (5, )][3:] # Hardware temperature = starcryo_temps.Temperature() lock = lockin.SR830(serial_device=LOCKIN_SERIAL_PORT) lock.identification # This seems to be necessary to wake up the lockin mmw = mmwave_source.MMWaveSource() mmw.set_attenuator_ticks(0, 0) mmw.multiplier_input = 'thermal' mmw.ttl_modulation_source = 'roach_2' mmw.waveguide_twist_angle = 0 heater = hardware.Thing(name='heater', state={ 'voltage': 1.70, 'resistance': 1021 }) conditioner = analog.HeterodyneMarkII() hw = hardware.Hardware(temperature, lock, mmw, heater, conditioner) ri = hardware_tools.r2h14_with_mk2(initialize=True, use_config=False) ri.set_modulation_output('high') ri.iq_delay = -1 ri.adc_valon.set_ref_select(0) # internal assert np.all(ri.adc_valon.get_phase_locks()) # 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
frequency_shift = 1 f0_MHz *= frequency_shift attenuations = [10, 20, 30] sweep_interval = 2 tone_sample_exponent = 18 sweep_length_seconds = 0.1 stream_length_seconds = 10 lo_round_to_MHz = 0.1 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 fft_gain = 3 # Hardware conditioner = analog.HeterodyneMarkII() shield = hardware.Thing(name='mu_metal_pocket', state={'orientation': 'horizontal'}) hw = hardware.Hardware(conditioner, shield) 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 ri.set_fft_gain(fft_gain) # 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, :] all_lo_MHz = lo_round_to_MHz * np.round(