Esempio n. 1
0
# 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')
tic = time.time()
try:
    ri.set_tone_baseband_freqs(offset_array_MHz, nsamp=num_tone_samples)
    for lo_index, lo in enumerate(lo_MHz):
        ri.set_lo(lomhz=lo, chan_spacing=lo_round_to_MHz)
        logger.info("Set LO to {:.3f} MHz".format(lo))
        for attenuation in attenuations:
            ri.set_dac_attenuator(attenuation)
            logger.info("Set DAC attenuation to {:.1f} dB".format(attenuation))
            state = hw.state()
            state['lo_index'] = lo_index
            state['temperature'] = {
                'package': temps.get_temperature_at(time.time())
            }
            sweep_array = acquire.run_loaded_sweep(
Esempio n. 2
0
nstep = 128
#f0binned = np.round(f0s * nsamp / 512.0) * 512.0 / nsamp
offset_bins = np.arange(-(nstep), (nstep)) * step

offsets = offset_bins * 512.0 / nsamp

ri.set_modulation_output(7)

ri.set_lo(1250.)

acquire.load_heterodyne_sweep_tones(
    ri,
    (np.arange(1, 129)[None, :] * 7 / 4. + ri.lo_frequency + offsets[:, None]),
    num_tone_samples=nsamp)

state = dict(mmw_atten_turns=(7., 7.))

tic = time.time()
for lo in 1010 + 190 * np.arange(0, 6):
    print "lo:", lo
    df = acquire.new_nc_file(
        suffix='scan_lo_%.1f_MHz_mmw_modulated_7_7_turns' % lo)
    ri.set_lo(lo)
    swa = acquire.run_multipart_sweep(ri,
                                      length_seconds=1.0,
                                      state=state,
                                      verbose=True)
    df.write(swa)
    df.close()
    print "elapsed:", (time.time() - tic) / 60.0, 'minutes'
Esempio n. 3
0
sweep_length_seconds = 0.1
stream_length_seconds = 30

# 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_stream')
tic = time.time()
try:
    for lo in progress(lo_MHz):
        state = hw.state()
        state['temperature'] = {'package': temps.get_temperature_at(time.time())}
        tone_banks = (lo + offsets_MHz)[:, np.newaxis]  # Transform to shape (num_offsets, 1)
        ri.set_lo(lomhz=lo, chan_spacing=round_to_MHz)
        sweep_array = acquire.run_sweep(ri, tone_banks=tone_banks, num_tone_samples=num_tone_samples,
                                        length_seconds=sweep_length_seconds)
        single_sweep = sweep_array[0]
        f0_MHz = 1e-6 * single_sweep.resonator.f_0
        ri.set_tone_freqs(np.array([f0_MHz]), nsamp=num_tone_samples)
        ri.select_fft_bins(np.array([0]))
        stream_array = ri.get_measurement(num_seconds=stream_length_seconds)
        single_stream = stream_array[0]
num_tone_samples_fine = 2 ** tone_sample_exponent_fine
f_resolution_fine = ri.state.adc_sample_rate / num_tone_samples_fine
offset_integers_fine = np.arange(-num_sweep_tones_fine // 2, num_sweep_tones_fine // 2)
offset_frequencies_fine_MHz = 1e-6 * f_resolution_fine * offset_integers_fine

logger.info("Coarse frequency spacing is {:.3f} kHz".format(1e3 * (offset_frequencies_coarse_MHz[1] -
                                                                   offset_frequencies_coarse_MHz[0])))
logger.info("Coarse sweep span is {:.3f} MHz".format(offset_frequencies_coarse_MHz.ptp()))
logger.info("Fine frequency spacing is {:.3f} kHz".format(1e3 * (offset_frequencies_fine_MHz[1] -
                                                                 offset_frequencies_fine_MHz[0])))
logger.info("Fine sweep span is {:.3f} MHz".format(offset_frequencies_fine_MHz.ptp()))
raw_input("Press enter to continue or ctrl-C to abort.")

# Run
ncf = acquire.new_nc_file(suffix=suffix)
tic = time.time()
try:
    for fft_gain, attenuation in zip(fft_gains, attenuations):
        ri.set_fft_gain(fft_gain)
        ri.set_dac_attenuator(attenuation)
        state = hw.state()
        start_time = time.time()  # Use this time to retrieve the temperature (see below).
        logger.info("Recording {:.1f} s coarse sweep around MHz frequencies {}".format(sweep_length_seconds, f0_MHz))
        sweep_array_coarse = acquire.run_sweep(ri=ri, tone_banks=sweep_frequencies_coarse_MHz,
                                               length_seconds=sweep_length_seconds,
                                               num_tone_samples=num_tone_samples_coarse, state=state)
        ncf.write(sweep_array_coarse)
        fit_f0_coarse_MHz = np.array([1e-6 * sweep_array_coarse[n].resonator.f_0
                                      for n in range(sweep_array_coarse.num_channels)])
        logger.info("coarse - initial [kHz]: {}".format(', '.join(['{:.3f}'.format(1e3 * df0)
Esempio n. 5
0
length_seconds = 0.1
offset_frequency = np.linspace(10, 200, 16)
num_tone_samples = 2**15
dac_attenuation = 62  # The maximum
lo_frequency = 3000

# Hardware
conditioner = analog.HeterodyneMarkII()
hw = hardware.Hardware(conditioner)
ri = hardware_tools.r1_with_mk2()
ri.initialize(use_config=False)
ri.set_dac_attenuator(dac_attenuation)
ri.set_lo(lomhz=lo_frequency)
ri.set_tone_freqs(freqs=lo_frequency + offset_frequency,
                  nsamp=num_tone_samples)
ri.select_fft_bins(np.arange(offset_frequency.size))

# Acquire
sweep = basic.SweepArray(core.IOList(), description="T_c measurement")
name = 'sweep'
ncf = acquire.new_nc_file(suffix='Tc')
ncf.write(sweep, name)
try:
    while True:
        sweep.stream_arrays.append(
            ri.get_measurement(num_seconds=length_seconds, state=hw.state()))
        sleep(wait)
finally:
    ncf.close()
    print("Wrote {}".format(ncf.root_path))
ri.set_fft_gain(6)

nsamp = 2**16
step = 1
nstep = 32
offset_bins = np.arange(-(nstep), (nstep)) * step

offsets = offset_bins * 512.0 / nsamp

ri.set_modulation_output('high')

#ri.set_lo(3200.)
ri.set_lo(2370.)

state = dict(magnetic_shield = 'on', cryostat='starcryo')
state.update(other=setup.state())

tic = time.time()

#for lo in 2200.+190*np.arange(0,2):

for lo in 2200. + 190 * np.arange(0, 2):
    logger.info("Measuring at LO %.1f" % lo)
    df = acquire.new_nc_file(suffix='scan_lo_%.1f_MHz_atten_%.1f_dB' % (lo, dac_atten))
    ri.set_lo(lo)
    state.update(other=setup.state(fast=True))
    swa = acquire.run_sweep(ri, (np.arange(1, 257)[None, :] * 7 / 8. + ri.lo_frequency + offsets[:, None]),
                            num_tone_samples=nsamp, length_seconds=0.2, state=state, verbose=True)
    df.write(swa)
    df.close()
    print "elapsed:", (time.time()-tic)/60.0,'minutes'
nsamp = 2**15
step = 1
nstep = 32
#f0binned = np.round(f0s * nsamp / 512.0) * 512.0 / nsamp
offset_bins = np.arange(-(nstep), (nstep)) * step

offsets = offset_bins * 512.0 / nsamp

ri.set_modulation_output(7)

ri.set_lo(1250.)

#legacy.load_heterodyne_sweep_tones(ri,(np.arange(1,129)[None,:]*7/4.+ri.lo_frequency + offsets[:,None]),
#                                    num_tone_samples=nsamp)

state = dict(magnetic_shield = 'on', cryostat='starcryo')
state.update(other=setup.state())

tic = time.time()
for lo in 790.+190*np.arange(0,5):
    logger.info("Measuring at LO %.1f" % lo)
    df = acquire.new_nc_file(suffix='scan_lo_%.1f_MHz' % lo)
    ri.set_lo(lo)
    state.update(other=setup.state(fast=True))
    swa = acquire.run_sweep(ri, (np.arange(1, 257)[None, :] * 7 / 8. + ri.lo_frequency + offsets[:, None]),
                            num_tone_samples=nsamp, length_seconds=0.2, state=state, verbose=True)
    df.write(swa)
    df.close()
    print "elapsed:", (time.time()-tic)/60.0,'minutes'

Esempio n. 8
0
ri.set_modulation_output('low')

#setup = hardware.Hardware()

ri = Roach2Baseband()

#turn on source
ri.set_modulation_output(7)
raw_input('set attenuator knobs to 3 turns & check lock-in range')

for dac_atten in [10]:
    ri.set_dac_atten(dac_atten)

    ri.set_modulation_output('low')

    df = acquire.new_nc_file(suffix='vna_dac_atten_%.1f_dB_3_turns_broadband' %
                             dac_atten)
    swa = acquire.run_sweep(
        ri,
        np.linspace(100, 180, 64)[None, :] +
        np.arange(650, dtype='int')[:, None] * 512. / 2.**18,
        2**18,
        verbose=True,
        length_seconds=.1,
    )
    df.write(swa)
    df.close()

#for example
#170-230 MHz band, steps are (230-170)/128
#then sampling 480 times between each of these steps by stepping an additional 2**18
Esempio n. 9
0
                                 num_sweep_tones_fine // 2)
offset_frequencies_fine_MHz = 1e-6 * f_resolution_fine * offset_integers_fine

logger.info("Coarse frequency spacing is {:.3f} kHz".format(
    1e3 *
    (offset_frequencies_coarse_MHz[1] - offset_frequencies_coarse_MHz[0])))
logger.info("Coarse sweep span is {:.3f} MHz".format(
    offset_frequencies_coarse_MHz.ptp()))
logger.info("Fine frequency spacing is {:.3f} kHz".format(
    1e3 * (offset_frequencies_fine_MHz[1] - offset_frequencies_fine_MHz[0])))
logger.info("Fine sweep span is {:.3f} MHz".format(
    offset_frequencies_fine_MHz.ptp()))
raw_input("Press enter to continue or ctrl-C to abort.")

# Run
ncf = acquire.new_nc_file(suffix=suffix)
tic = time.time()
try:
    for fft_gain, attenuation in zip(fft_gains, attenuations):
        ri.set_fft_gain(fft_gain)
        ri.set_dac_attenuator(attenuation)
        state = hw.state()
        start_time = time.time(
        )  # Use this time to retrieve the temperature (see below).
        logger.info(
            "Recording {:.1f} s coarse sweep around MHz frequencies {}".format(
                sweep_length_seconds, f0_MHz))
        sweep_array_coarse = acquire.run_sweep(
            ri=ri,
            tone_banks=sweep_frequencies_coarse_MHz,
            length_seconds=sweep_length_seconds,
ri = Roach2Baseband()

ri.set_modulation_output('low')

#setup = hardware.Hardware()

ri = Roach2Baseband()

#turn on source
ri.set_modulation_output(7)
raw_input('set attenuator knobs to 3 turns & check lock-in range')

for dac_atten in [10]:
    ri.set_dac_atten(dac_atten)


    ri.set_modulation_output('low')

    df = acquire.new_nc_file(suffix='vna_dac_atten_%.1f_dB_3_turns_broadband' % dac_atten)
    swa = acquire.run_sweep(ri,np.linspace(100,180,64)[None,:]+np.arange(650,dtype='int')[:,None]*512./2.**18,
                            2**18,
                            verbose=True,length_seconds=.1,
                            )
    df.write(swa)
    df.close()


#for example
#170-230 MHz band, steps are (230-170)/128
#then sampling 480 times between each of these steps by stepping an additional 2**18
Esempio n. 11
0
ri.set_lo(1250.)

#legacy.load_heterodyne_sweep_tones(ri,(np.arange(1,129)[None,:]*7/4.+ri.lo_frequency + offsets[:,None]),
#                                    num_tone_samples=nsamp)

state = dict(field_canceling_magnet=False,
             warm_magnetic_shield=True,
             cryostat='starcryo')
state.update(**setup.state())

if True:
    tic = time.time()
    for lo in 830. + 190 * np.arange(0, 4):
        logger.info("Measuring at LO %.1f" % lo)
        ri.set_lo(lo)
        df = acquire.new_nc_file(
            suffix='scan_lo_%.1f_MHz_modulated_mmw_source' % lo)
        state.update(**setup.state(fast=True))
        swa = acquire.run_sweep(ri, (np.arange(1, 257)[None, :] * 7 / 8. +
                                     ri.lo_frequency + offsets[:, None]),
                                num_tone_samples=nsamp,
                                length_seconds=0.1,
                                state=state,
                                verbose=True)
        x, y = ri.get_raw_adc()
        logger.info("ADC RMSs: %.1f %.1f" % (x.std(), y.std()))
        df.write(swa)
        df.close()
        print "elapsed:", (time.time() - tic) / 60.0, 'minutes'
    #time.sleep(60.)
    # while time.time() - tic < 5*60:
    #     print "waiting... %.1f min remaining" % ((5*60 - (time.time() - tic))/60)
ri = Roach2Baseband()

ri.set_modulation_output('low')

#setup = hardware.Hardware()

ri = Roach2Baseband()

#turn on source
ri.set_modulation_output(7)
raw_input('set attenuator knobs to 3 turns & check lock-in range')

for dac_atten in [10]:
    ri.set_dac_atten(dac_atten)

    df = acquire.new_nc_file(suffix='vna_dac_atten_%.1f_dB_1_turns_chopped' %
                             dac_atten)
    swa = acquire.run_sweep(
        ri,
        np.linspace(100, 180, 64)[None, :] +
        np.arange(650, dtype='int')[:, None] * 512. / 2.**18,
        2**18,
        verbose=True,
        length_seconds=.1,
    )
    df.write(swa)
    df.close()

#for example
#170-230 MHz band, steps are (230-170)/128
#then sampling 480 times between each of these steps by stepping an additional 2**18
Esempio n. 13
0
offset_bins = np.arange(-(nstep), (nstep)) * step

offsets = offset_bins * 512.0 / nsamp

ri.set_modulation_output('high')

#ri.set_lo(3200.)
ri.set_lo(2370.)

state = dict(magnetic_shield='on', cryostat='starcryo')
state.update(other=setup.state())

tic = time.time()

#for lo in 2200.+190*np.arange(0,2):

for lo in 2200. + 190 * np.arange(0, 2):
    logger.info("Measuring at LO %.1f" % lo)
    df = acquire.new_nc_file(suffix='scan_lo_%.1f_MHz_atten_%.1f_dB' %
                             (lo, dac_atten))
    ri.set_lo(lo)
    state.update(other=setup.state(fast=True))
    swa = acquire.run_sweep(ri, (np.arange(1, 257)[None, :] * 7 / 8. +
                                 ri.lo_frequency + offsets[:, None]),
                            num_tone_samples=nsamp,
                            length_seconds=0.2,
                            state=state,
                            verbose=True)
    df.write(swa)
    df.close()
    print "elapsed:", (time.time() - tic) / 60.0, 'minutes'
Esempio n. 14
0
print("Using {} simultaneous tones spanning {:.1f} MHz.".format(num_tones, 1e-6 * f_block))
f_center_MHz = 1e-6 * np.arange(f_start, f_stop, f_block)
print("Block center frequencies in MHz: {}".format(', '.join(['{:.1f}'.format(f) for f in f_center_MHz])))
f_lo_offset_MHz = 1e-6 * (np.arange(-f_tone / 2, f_tone / 2, f_lo_resolution) - f_minimum)
# This order covers the entire band then comes back to fill in the gaps.
f_lo_MHz = (f_center_MHz[np.newaxis, :] + f_lo_offset_MHz[:, np.newaxis]).flatten()
n_minimum = np.ceil(f_minimum / f_roach_resolution)
step = np.floor(f_tone / f_roach_resolution)
n_baseband = n_minimum + step * np.arange(num_tones)
f_baseband_MHz = 1e-6 * n_baseband * f_roach_resolution

# State
state = {'cryostat': 'hpd',
         'canceling_magnet': {'orientation': 'up',
                              'distance_from_base_mm': 25}}

# Acquire
ri.set_tone_baseband_freqs(freqs=f_baseband_MHz, nsamp=num_tone_samples)
ri.select_fft_bins(np.arange(f_baseband_MHz.size))
sweep = basic.SweepArray(core.IOList(), state=state, description=acquire.script_code())
ncf = acquire.new_nc_file(suffix='lo_scan_test')
ncf.write(sweep)
try:
    for f_lo in make_iterable(f_lo_MHz):
        ri.set_lo(lomhz=f_lo, chan_spacing=1e-6 * f_lo_resolution)
        sweep.stream_arrays.append(ri.get_measurement(num_seconds=stream_seconds, state=state))
finally:
    ncf.close()
    print("Wrote {}".format(ncf.root_path))
    print("Elapsed time {:.0f} minutes.".format((time.time() - tic) / 60))
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')
tic = time.time()
try:
    ri.set_tone_baseband_freqs(offset_array_MHz, nsamp=num_tone_samples)
    for lo_index, lo in enumerate(lo_MHz):
        ri.set_lo(lomhz=lo, chan_spacing=lo_round_to_MHz)
        logger.info("Set LO to {:.3f} MHz".format(lo))
        for attenuation in attenuations:
            ri.set_dac_attenuator(attenuation)
            logger.info("Set DAC attenuation to {:.1f} dB".format(attenuation))
            state = hw.state()
            state['lo_index'] = lo_index
            state['temperature'] = {'package': temps.get_temperature_at(time.time())}
            sweep_array = acquire.run_loaded_sweep(ri, length_seconds=sweep_length_seconds,
                                                   tone_bank_indices=np.arange(num_sweep_tones))
            on_sweep = sweep_array[0]
ri.set_modulation_output(7)

ri.set_lo(1250.)

#legacy.load_heterodyne_sweep_tones(ri,(np.arange(1,129)[None,:]*7/4.+ri.lo_frequency + offsets[:,None]),
#                                    num_tone_samples=nsamp)

state = dict(field_canceling_magnet=False,warm_magnetic_shield=True,cryostat='starcryo')
state.update(**setup.state())

if True:
    tic = time.time()
    for lo in 830.+190*np.arange(0,4):
        logger.info("Measuring at LO %.1f" % lo)
        ri.set_lo(lo)
        df = acquire.new_nc_file(suffix='scan_lo_%.1f_MHz_modulated_mmw_source' % lo)
        state.update(**setup.state(fast=True))
        swa = acquire.run_sweep(ri, (np.arange(1, 257)[None, :] * 7 / 8. + ri.lo_frequency + offsets[:, None]),
                                num_tone_samples=nsamp, length_seconds=0.1, state=state, verbose=True)
        x,y = ri.get_raw_adc()
        logger.info("ADC RMSs: %.1f %.1f" % (x.std(),y.std()))
        df.write(swa)
        df.close()
        print "elapsed:", (time.time()-tic)/60.0,'minutes'
    #time.sleep(60.)
    # while time.time() - tic < 5*60:
    #     print "waiting... %.1f min remaining" % ((5*60 - (time.time() - tic))/60)
    #     time.sleep(60)


Esempio n. 17
0
attenuations = [41, 47, 53, 59]
fft_gains = [6, 7, 8, 9]
tone_sample_exponent = 15
length_seconds = 0.1
wait = 10

# Hardware
conditioner = analog.Baseband()
shield = hardware.Thing(name='magnetic_shield_bucket', state={})
hw = hardware.Hardware(conditioner, shield)
ri = r2baseband.Roach2Baseband(roachip=ROACH2_IP, adc_valon=ROACH2_VALON)
ri.set_modulation_output('high')
ri.set_tone_freqs(freqs=frequency, nsamp=2**tone_sample_exponent)

# Run
sweeps = [basic.SweepArray(core.IOList(), description="T_c {:.1f} dB".format(attenuation))
          for attenuation in attenuations]
ncf = acquire.new_nc_file(suffix='Tc')
for sweep in sweeps:
    ncf.write(sweep)
try:
    while True:
        for sweep, attenuation, fft_gain in zip(sweeps, attenuations, fft_gains):
            ri.set_fft_gain(fft_gain)
            ri.set_dac_attenuator(attenuation)
            sweep.stream_arrays.append(ri.get_measurement(num_seconds=length_seconds, state=hw.state()))
            time.sleep(wait)
finally:
    ncf.close()
    print("Wrote {}".format(ncf.root_path))
ri.set_dac_atten(30)
ri.set_fft_gain(4)

nsamp = 2 ** 16
step = 1
nstep = 128
# f0binned = np.round(f0s * nsamp / 512.0) * 512.0 / nsamp
offset_bins = np.arange(-(nstep), (nstep)) * step

offsets = offset_bins * 512.0 / nsamp

ri.set_modulation_output(7)

ri.set_lo(1250.0)

acquire.load_heterodyne_sweep_tones(
    ri, (np.arange(1, 129)[None, :] * 7 / 4.0 + ri.lo_frequency + offsets[:, None]), num_tone_samples=nsamp
)

state = dict(mmw_atten_turns=(7.0, 7.0))

tic = time.time()
for lo in 1010 + 190 * np.arange(0, 6):
    print "lo:", lo
    df = acquire.new_nc_file(suffix="scan_lo_%.1f_MHz_mmw_modulated_7_7_turns" % lo)
    ri.set_lo(lo)
    swa = acquire.run_multipart_sweep(ri, length_seconds=1.0, state=state, verbose=True)
    df.write(swa)
    df.close()
    print "elapsed:", (time.time() - tic) / 60.0, "minutes"
Esempio n. 19
0
#f0binned = np.round(f0s * nsamp / 512.0) * 512.0 / nsamp
offset_bins = np.arange(-(nstep), (nstep)) * step

offsets = offset_bins * 512.0 / nsamp

ri.set_modulation_output('high')

ri.set_lo(1250.)

#legacy.load_heterodyne_sweep_tones(ri,(np.arange(1,129)[None,:]*7/4.+ri.lo_frequency + offsets[:,None]),
#                                    num_tone_samples=nsamp)

state = dict(magnetic_shield='on', cryostat='starcryo')
state.update(other=setup.state())

tic = time.time()
for lo in 880. + 190 * np.arange(0, 2):
    logger.info("Measuring at LO %.1f" % lo)
    df = acquire.new_nc_file(suffix='scan_lo_%.1f_MHz' % lo)
    ri.set_lo(lo)
    state.update(other=setup.state(fast=True))
    swa = acquire.run_sweep(ri, (np.arange(1, 257)[None, :] * 7 / 8. +
                                 ri.lo_frequency + offsets[:, None]),
                            num_tone_samples=nsamp,
                            length_seconds=0.2,
                            state=state,
                            verbose=True)
    df.write(swa)
    df.close()
    print "elapsed:", (time.time() - tic) / 60.0, 'minutes'
Esempio n. 20
0
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
ncf = acquire.new_nc_file(suffix='magnetic_shield')
tic = time.time()
try:
    for attenuation in attenuations:
        ri.set_dac_attenuator(attenuation)
        logger.info("Set DAC attenuation to {:.1f} dB".format(attenuation))
        state = hw.state()
        state['temperature'] = {'package': starcryo_temps.get_temperatures_at(time.time())[0]}
        logger.info("Recording {:.1f} s sweep at MHz center frequencies {}".format(sweep_length_seconds, f0_MHz))
        sweep_array = acquire.run_sweep(ri=ri, tone_banks=sweep_frequencies_MHz, length_seconds=sweep_length_seconds,
                                        num_tone_samples=num_tone_samples)
        fit_f0_MHz = np.array([1e-6 * sweep_array[n].resonator.f_0 for n in range(sweep_array.num_channels)])
        logger.info("Fit - initial [kHz]: {}".format(', '.join(['{:.3f}'.format(1e3 * df0) for df0 in fit_f0_MHz - f0_MHz])))
        f_stream_MHz = ri.set_tone_freqs(np.array(fit_f0_MHz), nsamp=num_tone_samples)
        ri.select_bank(0)
        ri.select_fft_bins(np.arange(f_stream_MHz.size))
Esempio n. 21
0
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())
        }
        tone_banks = np.array([np.array([f]) for f in lo + offsets_MHz])
        ri.set_lo(lomhz=lo, chan_spacing=round_to_MHz)
        sweep = acquire.run_sweep(ri,
                                  tone_banks=tone_banks,
                                  num_tone_samples=num_tone_samples,
                                  length_seconds=length_seconds,
                                  state=state)
        ncf.write(sweep)
Esempio n. 22
0
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
ncf = acquire.new_nc_file(suffix='magnetic_shield_compressor_off')
tic = time.time()
try:
    for attenuation in attenuations:
        ri.set_dac_attenuator(attenuation)
        logger.info("Set DAC attenuation to {:.1f} dB".format(attenuation))
        state = hw.state()
        state['temperature'] = {'package': starcryo_temps.get_temperatures_at(time.time())[0]}
        raw_input("Hit enter when temperatures have recovered.")
        logger.info("Recording {:.1f} s sweep at MHz center frequencies {}".format(sweep_length_seconds, f0_MHz))
        sweep_array = acquire.run_sweep(ri=ri, tone_banks=sweep_frequencies_MHz, length_seconds=sweep_length_seconds,
                                        num_tone_samples=num_tone_samples)
        fit_f0_MHz = np.array([1e-6 * sweep_array[n].resonator.f_0 for n in range(sweep_array.num_channels)])
        logger.info("Fit - initial [kHz]: {}".format(', '.join(['{:.3f}'.format(df0) for df0 in fit_f0_MHz - f0_MHz])))
        f_stream_MHz = ri.set_tone_freqs(np.array(fit_f0_MHz), nsamp=num_tone_samples)
        ri.select_bank(0)