示例#1
0
    def do_simple_map(self, xsteps=np.arange(0, 10000, 1000), ysteps=np.arange(0, 10000, 1000),
                      settle_time=0.1, mmw_source_frequencies=-1, description="",suffix=""):
        if not self._have_found_home:
            print "homing..."
            self.stage.find_home()
            self.stage.find_home()
            self._have_found_home = True
        if np.isscalar(mmw_source_frequencies):
            mmw_source_frequencies = np.array([mmw_source_frequencies])
        # if CW mode is used, frequency is > 0
        if mmw_source_frequencies[0] > 0:
            if self.hittite is None:
                self.hittite = hittiteController()
                self.hittite.set_power(0)
                self.hittite.on()

        mapfile = MapDataFile(xsteps,ysteps,mmw_source_frequencies,suffix=suffix)
        mapfile.group.description = description
        #mapfile.group.microstepping =
        self.mapfile = mapfile
        total_measurements = len(xsteps)*len(ysteps)
        measured_so_far = 0
        start_time = time.time()

        for y in range(len(ysteps)):
            if y % 2:
                direction = -1
            else:
                direction = 1
            ystep = ysteps[y]
            for x in range(len(xsteps))[::direction]:
                xstep = xsteps[x]
                self.stage.go_to_position(xstep, ystep)
                for freq_index,freq in enumerate(mmw_source_frequencies):
                    if freq > 0:
                        self.hittite.set_freq(freq/12.0)
                    time.sleep(settle_time)
                    #z, _, r, theta = self.lockin.get_data()
                    r,sensitivity = self.lockin.auto_range_measure(debug=True)
                    mapfile.z[x,y,freq_index] = r
                    mapfile.sensitivity[x,y,freq_index] = sensitivity
                    mapfile.nc.sync()
                    print x, y, freq, r
                measured_so_far +=1
                time_so_far = time.time()-start_time
                time_per_point = time_so_far/measured_so_far
                time_remaining = time_per_point*(total_measurements-measured_so_far)
                print "%.1f minutes remaining, finish at %s" % (time_remaining/60.,time.ctime(time.time()+time_remaining))
import time
import sys

import numpy as np

from kid_readout.roach import heterodyne
from kid_readout.utils import data_file, sweeps
from kid_readout.analysis.resonator import fit_best_resonator
from kid_readout.equipment import hittite_controller, lockin_controller


# fg = FunctionGenerator()
hittite = hittite_controller.hittiteController(addr='192.168.0.200')
lockin = lockin_controller.lockinController()
print lockin.get_idn()
ri = heterodyne.RoachHeterodyne()
ri.set_lo(1210.0)

f0s = np.load('/data/readout/resonances/2015-11-03-starcryo-nevins-initial-resonances-160mK.npy')

suffix = "mmw_frequency_sweep"
mmw_source_modulation_freq = ri.set_modulation_output(rate=7)
mmw_atten_turns = (7.0, 7.0)
print "modulating at: {}".format(mmw_source_modulation_freq),

nf = len(f0s)
atonce = 32
if nf % atonce > 0:
    print "extending list of resonators to make a multiple of ", atonce
    f0s = np.concatenate((f0s, np.arange(1, 1 + atonce - (nf % atonce)) + f0s.max()))
from kid_readout.roach import baseband

matplotlib.use('agg')
import numpy as np
import time
import sys
from kid_readout.utils import data_file,sweeps
from kid_readout.analysis.resonator import fit_best_resonator
from kid_readout.equipment import hittite_controller
from kid_readout.equipment import lockin_controller
from kid_readout.equipment.agilent_33220 import FunctionGenerator

fg = FunctionGenerator()

hittite = hittite_controller.hittiteController()
lockin = lockin_controller.lockinController()
print lockin.get_idn()

ri = baseband.RoachBaseband()
ri.initialize()
f0s = np.load('/home/gjones/kid_readout/apps/sc5x4_0813f12.npy')
f0s.sort()
f0s = f0s[[0,1,2,3,4,5,6,7,8,9,10,13,14,15,16,17]]  # remove close packed resonators to enable reading out all simultaneously

suffix = "mmwnoise"
mmw_source_modulation_freq = 25.0
mmw_atten_turns = (6.5,6.5)

def source_on():
    ri.r.write_int('gpiob',0x00)
示例#4
0
__author__ = 'gjones'
import time
import sys

import numpy as np

from kid_readout.roach import heterodyne
from kid_readout.utils import data_file, sweeps
from kid_readout.equipment import hittite_controller, lockin_controller

hittite = hittite_controller.hittiteController(addr='192.168.0.200')
lockin = lockin_controller.lockinController()
print lockin.get_idn()
ri = heterodyne.RoachHeterodyne(adc_valon='/dev/ttyUSB0')
ri.iq_delay = 0
ri.set_lo(1410.0)

#group_1_lo = 1020.0
#group_2_lo = 1410.0
#all_f0s = np.load('/data/readout/resonances/2016-01-13-jpl-2015-10-park-dark-32-resonances-split-at-1300.npy') -0.5

#group_1_f0 = all_f0s[all_f0s < 1300]
#group_2_f0 = all_f0s[all_f0s > 1300]
"""
all_f0s = np.load('/data/readout/resonances/2016-02-12-jpl-park-100nm-32-resonances.npy')
group_1_f0 = all_f0s[all_f0s<1500]
group_2_f0 = all_f0s[all_f0s>1800]

group_1_lo = 1220.0
group_2_lo = 1810.0
"""
import time
import sys

import numpy as np

from kid_readout.roach import baseband
from kid_readout.utils import data_file, sweeps
from kid_readout.analysis.resonator import fit_best_resonator
from kid_readout.equipment import hittite_controller, lockin_controller

# fg = FunctionGenerator()
hittite = hittite_controller.hittiteController()
lockin = lockin_controller.lockinController()
print lockin.get_idn()
ri = baseband.RoachBaseband()

f0s = np.load('/home/data2/resonances/2014-12-06_140825_0813f8_fit_16.npy')

suffix = "mmw_frequency_sweep"
mmw_source_modulation_freq = ri.set_modulation_output(rate=7)
mmw_atten_turns = (7.0, 7.0)
print "modulating at: {}".format(mmw_source_modulation_freq),

nf = len(f0s)
atonce = 16
if nf % atonce > 0:
    print "extending list of resonators to make a multiple of ", atonce
    f0s = np.concatenate(
        (f0s, np.arange(1, 1 + atonce - (nf % atonce)) + f0s.max()))

nsamp = 2**18
示例#6
0
def mmw_source_power_step(f_initial_off,
                          f_initial_on,
                          attenuations,
                          f_mmw_source=0,
                          suffix="mmw",
                          hittite_power=0,
                          long_stream_time=30,
                          modulated_stream_time=4,
                          coarse_exponent=19,
                          fine_exponent=21,
                          modulation_rate_integer=7):
    if f_mmw_source:
        from kid_readout.equipment import hittite_controller

        frequency_multiplication_factor = 12
        hittite = hittite_controller.hittiteController()
        hittite.set_power(hittite_power)  # in dBm
        hittite.set_freq(f_mmw_source /
                         frequency_multiplication_factor)  # in Hz
        hittite.on()

    lockin = lockin_controller.lockinController()
    print(lockin.get_idn())

    roach = baseband.RoachBaseband()

    n_coarse_samples = 2**coarse_exponent
    n_fine_samples = 2**fine_exponent
    coarse_frequency_resolution = roach.fs / n_coarse_samples
    fine_frequency_resolution = roach.fs / n_fine_samples
    coarse_offset_integers = offset_integers[coarse_exponent]
    fine_offset_integers = offset_integers[fine_exponent]
    f_coarse_offset = coarse_frequency_resolution * coarse_offset_integers
    f_fine_offset = fine_frequency_resolution * fine_offset_integers

    while True:
        f_source_modulation = roach.set_modulation_output(
            modulation_rate_integer)
        print(
            "\nSet source modulation frequency to {:.1f} Hz. Check the lock-in."
            .format(f_source_modulation))
        try:
            mmw_attenuator_turns = float(
                raw_input(
                    "Enter the value to which both attenuators are set, or hit Enter to stop recording data: "
                ))
        except ValueError:
            break

        start_time = time.time()
        df = data_file.DataFile(suffix=suffix)
        df.nc.mmw_atten_turns = (mmw_attenuator_turns, mmw_attenuator_turns)
        maximum_attenuation = max(attenuations)
        print(
            "Setting DAC attenuator to maximum requested attenuation of {:.1f} dB."
            .format(maximum_attenuation))
        roach.set_dac_attenuator(maximum_attenuation)

        # At the lowest readout power, record a coarse sweep with the source off and a modulated stream at the fit
        # source-off resonances.
        sweeps.prepare_sweep(roach, f_initial_off, f_coarse_offset,
                             n_coarse_samples)
        coarse_sweep_off, stream_mod_off = mmw_source_sweep_and_stream(
            df, roach, lockin, modulated_stream_time, False, f_mmw_source,
            'high', modulation_rate_integer, modulation_rate_integer)
        f_coarse_fit_off = np.array(
            [r.f_0 for r in fit_sweep_data(coarse_sweep_off)])
        print("Source off: coarse - initial [Hz]: " + ', '.join([
            '{:.0f}'.format(1e6 * diff)
            for diff in f_coarse_fit_off - f_initial_off
        ]))

        # At the lowest readout power, record a fine sweep and long stream with the source off.
        sweeps.prepare_sweep(roach, f_coarse_fit_off, f_fine_offset,
                             n_fine_samples)
        fine_sweep_off, stream_off = mmw_source_sweep_and_stream(
            df, roach, lockin, long_stream_time, False, f_mmw_source, 'high',
            'high', modulation_rate_integer)
        f_fine_fit_off = np.array(
            [r.f_0 for r in fit_sweep_data(fine_sweep_off)])
        print("Source off: fine - coarse [Hz]: " + ', '.join([
            '{:.0f}'.format(1e6 * diff)
            for diff in f_fine_fit_off - f_coarse_fit_off
        ]))

        # At the lowest readout power, record a coarse sweep with the source on and a modulated stream at the fit
        # source-on resonances.
        sweeps.prepare_sweep(roach, f_initial_on, f_coarse_offset,
                             n_coarse_samples)
        coarse_sweep_on, stream_mod_on = mmw_source_sweep_and_stream(
            df, roach, lockin, modulated_stream_time, False, f_mmw_source,
            'low', modulation_rate_integer, modulation_rate_integer)
        f_coarse_fit_on = np.array(
            [r.f_0 for r in fit_sweep_data(coarse_sweep_on)])
        print("Source on: coarse - initial [Hz]: " + ', '.join([
            '{:.0f}'.format(1e6 * diff)
            for diff in f_coarse_fit_on - f_initial_on
        ]))

        # Use these frequencies for all subsequent sweeps, and add an additional waveform for each stream.
        print("\nSetting fine sweep frequencies for source-on measurements.")
        sweeps.prepare_sweep(roach, f_coarse_fit_on, f_fine_offset,
                             n_fine_samples)

        for k, attenuation in enumerate(attenuations):
            print(
                "\nSource-on measurement {} of {}: DAC attenuator at {:.1f} dB."
                .format(k + 1, len(attenuations), attenuation))
            roach.set_dac_attenuator(attenuation)
            fine_sweep_on, stream = mmw_source_sweep_and_stream(
                df,
                roach,
                lockin,
                long_stream_time,
                k > 0,  # overwrite after the first.
                f_mmw_source,
                'low',
                'low',
                modulation_rate_integer)
            f_fine_fit_on = [r.f_0 for r in fit_sweep_data(fine_sweep_on)]
            print("Source on: fine - coarse [Hz]: " + ', '.join([
                '{:.0f}'.format(1e6 * diff)
                for diff in f_fine_fit_on - f_coarse_fit_on
            ]))

        df.close()
        print("Completed in {:.0f} minutes: {}".format(
            (time.time() - start_time) / 60, df.filename))

    # Clean up.
    if f_mmw_source:
        hittite.off()
        hittite.disconnect()
__author__ = 'gjones'
from kid_readout.equipment import hittite_controller, lockin_controller
import numpy as np
import time
import sys

hmc = hittite_controller.hittiteController('192.168.0.200')
li = lockin_controller.lockinController()
print li.get_idn()

mmw_freqs = np.linspace(140e9, 161e9, 1024)

while True:
    zbd = []
    tstart = time.time()
    for mmw_freq in mmw_freqs:
        hmc.set_freq(mmw_freq / 12.)
        time.sleep(0.5)
        r, _, _, _ = li.get_data()
        zbd.append(r)
        print("\r%d/%d" % (len(zbd), len(mmw_freqs))),
        sys.stdout.flush()
    zbd = np.array(zbd)
    tend = time.time()
    fn = time.strftime("%Y-%m-%d_%H%M%S")
    np.savez(('/data/readout/mmw_sweeps/%s_cryo_waveguide_short.npz' % fn),
             start_epoch=tstart,
             end_epoch=tend,
             mmw_freqs=mmw_freqs,
             zbd=zbd)
    print fn
示例#8
0
 def __init__(self, hittite_addr='192.168.1.70'):
     self.hittite = hittiteController(addr=hittite_addr)
     self.rtl = rtlsdr.RtlSdr()
     self.rtl.sample_rate = 256e3
     self.rtl.gain = 30.0
示例#9
0
 def __init__(self,hittite_addr='192.168.1.70'):
     self.hittite = hittiteController(addr=hittite_addr)
     self.rtl = rtlsdr.RtlSdr()
     self.rtl.sample_rate = 256e3
     self.rtl.gain = 30.0
__author__ = 'gjones'
from kid_readout.equipment import hittite_controller, lockin_controller
import numpy as np
import time
import sys

hmc = hittite_controller.hittiteController('192.168.0.200')
li = lockin_controller.lockinController()
print li.get_idn()

mmw_freqs = np.linspace(140e9,161e9,1024)

while True:
    zbd = []
    tstart = time.time()
    for mmw_freq in mmw_freqs:
        hmc.set_freq(mmw_freq/12.)
        time.sleep(0.5)
        r,_,_,_ = li.get_data()
        zbd.append(r)
        print ("\r%d/%d" % (len(zbd),len(mmw_freqs))),
        sys.stdout.flush()
    zbd = np.array(zbd)
    tend = time.time()
    fn = time.strftime("%Y-%m-%d_%H%M%S")
    np.savez(('/data/readout/mmw_sweeps/%s_cryo_waveguide_short.npz' % fn),
             start_epoch=tstart, end_epoch = tend,
             mmw_freqs=mmw_freqs, zbd = zbd)
    print fn
示例#11
0
def mmw_source_power_step(f_initial_off, f_initial_on, attenuations, f_mmw_source=0, suffix="mmw", hittite_power=0,
                          long_stream_time=30,
                          modulated_stream_time=4, coarse_exponent=19, fine_exponent=21, modulation_rate_integer=7):
    if f_mmw_source:
        from kid_readout.equipment import hittite_controller

        frequency_multiplication_factor = 12
        hittite = hittite_controller.hittiteController()
        hittite.set_power(hittite_power)  # in dBm
        hittite.set_freq(f_mmw_source / frequency_multiplication_factor)  # in Hz
        hittite.on()

    lockin = lockin_controller.lockinController()
    print(lockin.get_idn())

    roach = baseband.RoachBaseband()

    n_coarse_samples = 2 ** coarse_exponent
    n_fine_samples = 2 ** fine_exponent
    coarse_frequency_resolution = roach.fs / n_coarse_samples
    fine_frequency_resolution = roach.fs / n_fine_samples
    coarse_offset_integers = offset_integers[coarse_exponent]
    fine_offset_integers = offset_integers[fine_exponent]
    f_coarse_offset = coarse_frequency_resolution * coarse_offset_integers
    f_fine_offset = fine_frequency_resolution * fine_offset_integers

    while True:
        f_source_modulation = roach.set_modulation_output(modulation_rate_integer)
        print("\nSet source modulation frequency to {:.1f} Hz. Check the lock-in.".format(f_source_modulation))
        try:
            mmw_attenuator_turns = float(
                raw_input("Enter the value to which both attenuators are set, or hit Enter to stop recording data: "))
        except ValueError:
            break

        start_time = time.time()
        df = data_file.DataFile(suffix=suffix)
        df.nc.mmw_atten_turns = (mmw_attenuator_turns, mmw_attenuator_turns)
        maximum_attenuation = max(attenuations)
        print("Setting DAC attenuator to maximum requested attenuation of {:.1f} dB.".format(maximum_attenuation))
        roach.set_dac_attenuator(maximum_attenuation)

        # At the lowest readout power, record a coarse sweep with the source off and a modulated stream at the fit
        # source-off resonances.
        sweeps.prepare_sweep(roach, f_initial_off, f_coarse_offset, n_coarse_samples)
        coarse_sweep_off, stream_mod_off = mmw_source_sweep_and_stream(df, roach, lockin, modulated_stream_time,
                                                                       False,
                                                                       f_mmw_source, 'high',
                                                                       modulation_rate_integer,
                                                                       modulation_rate_integer)
        f_coarse_fit_off = np.array([r.f_0 for r in fit_sweep_data(coarse_sweep_off)])
        print("Source off: coarse - initial [Hz]: " + ', '.join(['{:.0f}'.format(1e6 * diff)
                                                                 for diff in f_coarse_fit_off - f_initial_off]))

        # At the lowest readout power, record a fine sweep and long stream with the source off.
        sweeps.prepare_sweep(roach, f_coarse_fit_off, f_fine_offset, n_fine_samples)
        fine_sweep_off, stream_off = mmw_source_sweep_and_stream(df, roach, lockin, long_stream_time, False,
                                                                 f_mmw_source, 'high', 'high',
                                                                 modulation_rate_integer)
        f_fine_fit_off = np.array([r.f_0 for r in fit_sweep_data(fine_sweep_off)])
        print("Source off: fine - coarse [Hz]: " + ', '.join(['{:.0f}'.format(1e6 * diff)
                                                              for diff in f_fine_fit_off - f_coarse_fit_off]))

        # At the lowest readout power, record a coarse sweep with the source on and a modulated stream at the fit
        # source-on resonances.
        sweeps.prepare_sweep(roach, f_initial_on, f_coarse_offset, n_coarse_samples)
        coarse_sweep_on, stream_mod_on = mmw_source_sweep_and_stream(df, roach, lockin, modulated_stream_time,
                                                                     False,
                                                                     f_mmw_source,
                                                                     'low', modulation_rate_integer,
                                                                     modulation_rate_integer)
        f_coarse_fit_on = np.array([r.f_0 for r in fit_sweep_data(coarse_sweep_on)])
        print("Source on: coarse - initial [Hz]: " + ', '.join(['{:.0f}'.format(1e6 * diff)
                                                                for diff in f_coarse_fit_on - f_initial_on]))

        # Use these frequencies for all subsequent sweeps, and add an additional waveform for each stream.
        print("\nSetting fine sweep frequencies for source-on measurements.")
        sweeps.prepare_sweep(roach, f_coarse_fit_on, f_fine_offset, n_fine_samples)

        for k, attenuation in enumerate(attenuations):
            print("\nSource-on measurement {} of {}: DAC attenuator at {:.1f} dB.".format(k + 1, len(attenuations),
                                                                                          attenuation))
            roach.set_dac_attenuator(attenuation)
            fine_sweep_on, stream = mmw_source_sweep_and_stream(df, roach, lockin, long_stream_time,
                                                                k > 0,  # overwrite after the first.
                                                                f_mmw_source, 'low', 'low',
                                                                modulation_rate_integer)
            f_fine_fit_on = [r.f_0 for r in fit_sweep_data(fine_sweep_on)]
            print("Source on: fine - coarse [Hz]: " + ', '.join(['{:.0f}'.format(1e6 * diff)
                                                                 for diff in f_fine_fit_on - f_coarse_fit_on]))

        df.close()
        print("Completed in {:.0f} minutes: {}".format((time.time() - start_time) / 60, df.filename))

    # Clean up.
    if f_mmw_source:
        hittite.off()
        hittite.disconnect()