# mezz 2 mod 4 obd24 = pickle.load( open( overbias_data + '/data/IceBoard_' + str(iceboard) + '.Mezz_2.ReadoutModule_4_OUTPUT.pkl', 'r')) voltages_24 = [] for jj in obd24['overbiased']: voltages_24.append(obd24['overbiased'][jj]['V']) #for kk in j24: # voltages_24.remove(voltages_24[kk]) print "The length of voltages_24 is " + str(len(voltages_24)) v24 = len(voltages_24) #hardware map hwm = pydfmux.load_session(open(hwm_dir))['hardware_map'] ds = hwm.query(pydfmux.Dfmux) sqcbs = hwm.query(pydfmux.SQUIDController) squids = hwm.query(pydfmux.SQUID) bolos = hwm.query(pydfmux.Bolometer) rm = hwm.query(pydfmux.ReadoutModule) d = ds[0] #m1m1_init=[] m1m2_init = [] m1m3_init = [] m1m4_init = [] m2m1_init = [] m2m2_init = [] m2m3_init = [] m2m4_init = []
else: core.G3Logger.global_logger = console_logger core.set_log_level(core.G3LogLevel.LOG_ERROR, 'DfMuxBuilder') core.set_log_level(core.G3LogLevel.LOG_ERROR, 'DfMuxCollector') args.hardware_map = os.path.realpath(args.hardware_map) if not len(args.boards): # If the input is a hardware map path, import the HWM and # extract the list of boards from it core.log_notice('Initializing hardware map and boards', unit='Data Acquisition') import pydfmux hwm = pydfmux.load_session(open(args.hardware_map, 'r'))['hardware_map'] boards = hwm.query(pydfmux.Dfmux) boards.resolve() boards = boards.serial else: # Otherwise assume the input is a list of board serials core.log_notice('Acquiring hardware map information from boards', unit='Data Acquisition') hwm = None boards = ['%04d' % (int(b)) for b in args.boards] core.log_notice('Beginning data acquisition', unit='Data Acquisition') # Set up DfMux consumer pipe = core.G3Pipeline() builder = dfmux.DfMuxBuilder([int(board) for board in boards])
from spt3g import core, calibration import matplotlib.pyplot as plt import pydfmux import numpy as np d = list(core.G3File('/home/adama/SPT/spt3g_software/calibration/scripts/new_boloprops.g3'))[0] #'/spt/user/production/calibration/calframe/RCW38-pixelraster/70228757.g3'))[0] dnominal = list(core.G3File('/spt/data/bolodata/downsampled/RCW38-pixelraster/70228757/nominal_online_cal.g3'))[0] hwm = pydfmux.load_session(open('/home/adama/SPT/hardware_maps_southpole/2019/hwm_pole/hwm.yaml'))['hardware_map'] x = {} y = {} x_nominal = {} y_nominal = {} x_hwm = {} y_hwm = {} for bolo in d['BolometerProperties'].keys(): if d['BolometerProperties'][bolo].wafer_id not in x: x[d['BolometerProperties'][bolo].wafer_id] = {} y[d['BolometerProperties'][bolo].wafer_id] = {} x[d['BolometerProperties'][bolo].wafer_id][bolo] = d['BolometerProperties'][bolo].x_offset y[d['BolometerProperties'][bolo].wafer_id][bolo] = d['BolometerProperties'][bolo].y_offset for bolo in dnominal['NominalBolometerProperties'].keys(): if dnominal['NominalBolometerProperties'][bolo].wafer_id not in x_nominal: x_nominal[dnominal['NominalBolometerProperties'][bolo].wafer_id] = {} y_nominal[dnominal['NominalBolometerProperties'][bolo].wafer_id] = {} x_nominal[dnominal['NominalBolometerProperties'][bolo].wafer_id][bolo] = dnominal['NominalBolometerProperties'][bolo].x_offset y_nominal[dnominal['NominalBolometerProperties'][bolo].wafer_id][bolo] = dnominal['NominalBolometerProperties'][bolo].y_offset bololist = hwm.query(pydfmux.Bolometer)
PID_low_temp = 0.400 wafer_high_temp = 0.650 wafer_low_temp = 0.400 K_per_sec = 1e-4 update_time = 10 overbias_amplitude = 0.0002 logfile = #parser_path = '/home/spt3g/pydfmux/firmware/mcgill/x86_64/parser' #T_data_path = '/home/spt3g/ledgerman_output/20161005/down3.h5' ledgerman_path = '/home/spt3g/spt3g_software/dfmux/bin/ledgerman.py' R_data_path = '/home/spt3g/ledgerman_output/20161208/downm2m2.nc' # pydfmux stuff hwm_file = '/home/spt3g/hardware_maps/hwm_anl_20161115_w109/hwm_anl_complete.yml' y = pydfmux.load_session(open(hwm_file, 'r')) rc=y['hardware_map'].query(pydfmux.ReadoutChannel) bolos = y['hardware_map'].query(pydfmux.Bolometer) ds = y['hardware_map'].query(pydfmux.Dfmux) sc.He3UCs.remote_set() sc.He3ICs.remote_set() # unlatch the switches print('Turning off switches...') sc.He3UCs.set_voltage(0.0) sc.He3ICs.set_voltage(0.0) while float(gt.gettemp(logfile, 'He3 UC Switch'))>2.00: time.sleep(10) while float(gt.gettemp(logfile, 'He3 IC Switch'))>2.00:
'amp \t freq_shift \t overbias_file \t DAN_on_dump \t DAN_on_Z_squid \t DAN_off_dump \t DAN_off_Z_squid \n' ) ############################## CONFIGURATION ################################### hwm_location = '/home/spt3g/hardware_maps/hwm_anl_20170201_Nb_and_Al/hwm_anl_complete.yml' cut_on_transimpedance = False # Only use SQUIDs that have good transimpedance # NOTE: This requires that tune_squids=True transimpedance_cut = 300 # Ohms target_lowgain = 10 # The lowest-noise gain setting you want to reach use_test_IRIG = True # For setups without external IRIG cold_overbias = False # For setups with cold overbias-able bolometers serialize = False # Debugging option to run most algorithms in serial # not asynchronously (/parallel) # Load Hardware Map and query it for the objects we will use s = pydfmux.load_session(file(hwm_location)) hwm = s['hardware_map'] ds = hwm.query(pydfmux.Dfmux) # dfmux boards sqcbs = hwm.query(pydfmux.SQUIDController) # squid controllers squids = hwm.query(pydfmux.SQUID) # actual squids rmods = hwm.query(pydfmux.ReadoutModule) # readout modules? # --- below is for the bolos on mezz1 sqcbs = hwm.query( pydfmux.SQUIDController).filter(pydfmux.SQUIDController.serial == '06-01') squids_ = hwm.query(pydfmux.SQUID).join( pydfmux.SQUIDModule, pydfmux.SQUIDController, pydfmux.MGMEZZ04).filter(pydfmux.MGMEZZ04.serial.in_(['160']), pydfmux.SQUIDModule.module.in_([1])) rmods_ = hwm.query(pydfmux.ReadoutModule).join( pydfmux.MGMEZZ04, pydfmux.SQUIDController,
import pickle import matplotlib.pyplot as plt import numpy as np import pydfmux hwm_file = '/home/adama/hardware_maps/fnal/run34/slots12/hwm.yaml' hwm = pydfmux.load_session(open(hwm_file, 'r'))['hardware_map'] rchans = hwm.readout_channels_from_pstring('0135/2/1/{1:10}') bias_frequencies = [rc.lc_channel.frequency for rc in rchans] fname1 = [ '/daq/pydfmux_output/20181011/20181011_224733_take_rawdump/data/IceBoard_0135.Mezz_2.ReadoutModule_1_OUTPUT.pkl', '/daq/pydfmux_output/20181011/20181011_232656_take_rawdump/data/IceBoard_0135.Mezz_2.ReadoutModule_1_OUTPUT.pkl' ] fname2 = [ '/daq/pydfmux_output/20181011/20181011_224733_take_rawdump/data/IceBoard_0135.Mezz_2.ReadoutModule_2_OUTPUT.pkl', '/daq/pydfmux_output/20181011/20181011_232656_take_rawdump/data/IceBoard_0135.Mezz_2.ReadoutModule_2_OUTPUT.pkl' ] for jdump in [0, 1]: with open(fname1[jdump], 'r') as f: d1 = pickle.load(f) #, encoding='latin1') with open(fname2[jdump], 'r') as f: d2 = pickle.load(f) #, encoding='latin1') fmin = 2 * 1.6e6 fmax = 2 * 2.3e6 plt.figure() freq1 = d1['full_data']['spectrum_freqs'] plt.plot(freq1[(freq1 > fmin) & (freq1 < fmax)],
import pydfmux import pandas as pd from pydfmux.spt3g.hwm_tools import wafer_bolo_info from pydfmux.spt3g import lc_tools import numpy as np import pickle hwm_fname = '/home/adama/SPT/hardware_maps_southpole/2019/hwm_pole/hwm.yaml' hwm = pydfmux.load_session(open(hwm_fname, 'rb'))['hardware_map'] bolos = hwm.query(pydfmux.Bolometer) # load the matching info df_swap = pd.read_csv('singleton_fixes.csv', sep='\t') df_info = wafer_bolo_info() f_new = {} for ind, row in df_swap.iterrows(): old_bolo = df_swap['old_name'][ind].split('_')[1] old_wafer = df_swap['old_name'][ind].split('_')[0] new_bolo = df_swap['new_name'][ind].split('_')[1] new_wafer = df_swap['new_name'][ind].split('_')[0] bolo = hwm.query(pydfmux.Bolometer).join(pydfmux.Wafer)\ .filter((pydfmux.Bolometer.physical_name==old_bolo) & \ (pydfmux.Wafer.name == old_wafer)) old_lc_ind = bolo[0].channel_map.lc_channel.channel - 1 new_lc_ind = np.array(df_info[df_info.physical_name == new_bolo].lc_ind)[0] lc_name = bolo[0].channel_map.lc_channel.lc_board.name version = lc_name.split('.')[1] batch = lc_name.split('.')[2] if lc_name not in f_new: if lc_name in lc_tools.template_data[version].keys():
# user params PID_high_temp = 0.625 # starting temperature where we overbias PID_low_temp = 0.400 # lowest temperature that we PID control after cooling wafer_high_temp = 0.625 # we wait until the wafer reaches this temp before starting to cool wafer_low_temp = 0.450 # we wait until the wafer reaches this temp before warming up K_per_sec = 1e-4 # heating and cooling rate of PID target temp update_time = 10 # how often we change PID parameters overbias_amplitude = 0.0005 ledgerman_path = '/daq/spt3g_software/dfmux/bin/ledgerman.py' RT_data_path = '/daq/spt3g_software/dfmux/bin/%s_RT.nc' % '{:%Y%m%d_%H%M%S}'.format(datetime.datetime.now()) channel_of_interest = 'wafer holder' PID_channel = 'UC Head' # pydfmux stuff hwm_file = '/home/spt3g/detector_testing/run14/hardware_maps/hwm_slot1/fermilab_hwm_complete.yaml' y = pydfmux.load_session(open(hwm_file, 'r')) bolos = y['hardware_map'].query(pydfmux.Bolometer) ds = y['hardware_map'].query(pydfmux.Dfmux) # Lakeshore config ChaseLS = LS.Lakeshore350('192.168.0.12', ['UC Head', 'IC Head', 'UC stage', 'LC shield']) WaferLS = LS.Lakeshore350('192.168.2.5', ['wafer holder', '3G IC head', '3G UC head', '3G 4He head']) ChaseLS.config_output(1,1,ChaseLS.channel_names.index(PID_channel)+1) # Power supply config PS1 = PS.Agilent3631A('/dev/ttyr02', '3He UC switch', '3He IC switch', '3He UC pump') PS2 = PS.Agilent3631A('/dev/ttyr03', '4He IC switch', '3He IC pump', '4He IC pump') # print general warnings print('Starting R(T) measurement script')
import pickle import numpy as np import matplotlib.pyplot as plt import pydfmux.analysis.utils.pixel_tools as pxtools import pydfmux dark_pixels = [271, 250, 225, 196, 163] with open('/home/adama/hardware_maps/fnal/run33/hwm.yaml', 'rb') as f: hwm = pydfmux.load_session(f)['hardware_map'] with open('fnal_run33_slots12_0135_0136_optical_eff_fit_results.pkl', 'rb') as f: d = pickle.load(f) slopes_optical = dict() slopes_optical_corrected = dict() efficiency_optical = dict() efficiency_optical_corrected = dict() freqs_optical = dict() slopes_blanked = dict() slopes_blanked_outer = dict() slopes_dark = dict() median_slopes_blanked_outer = dict() for band in [90, 150, 220]: slopes_optical[band] = np.array([ d[bolo]['slope_CL'] for bolo in d if str(d[bolo]['pstring']).split('/')[0] == '0135' and str(d[bolo]['pstring']).split('/')[1] == '2' and bolo.split('.')[1] == str(band) ])
def autocycle(): ''' This is a function to run a fridge cycle. Note that it takes 6+ hours to run. ''' try: logfile = raw_input('What is the logfile? /home/spt3g/') logfile = str(logfile) hwm_dir = raw_input('What is the full path to the hardware map yml? ') hwm_dir = str(hwm_dir) hwm = pydfmux.load_session(open(hwm_dir))['hardware_map'] ds = hwm.query(pydfmux.Dfmux) d = ds[0] print "Turning off mezzanines." ds.set_mezzanine_power(False, 1) ds.set_mezzanine_power(False, 2) raw_input( 'Please press enter if the mezzanines are actually off (for testing).' ) print "Mezzanines off, ready to go." sc.He4p.remote_set() sc.He3ICp.remote_set() sc.He3UCp.remote_set() print 'Setting the heater, switches, and pumps to 0.' zero_everything() print 'Waiting for switches to cool.' while float(gt.gettemp(logfile, 'He3 IC Switch')) > 2.00: time.sleep(10) while float(gt.gettemp(logfile, 'He3 UC Switch')) > 2.00: time.sleep(10) while float(gt.gettemp(logfile, 'He4 IC Switch')) > 4.00: time.sleep(10) print 'Switches are cool, beginning heating.' print '' print 'Turning He4 pump to 12.00 V.' sc.He4p.set_voltage(12.00) print 'Turning inter pump to 9.60 V.' sc.He3ICp.set_voltage(9.60) print 'Turning ultra pump to 6.30 V.' sc.He3UCp.set_voltage(6.30) print '' print 'Waiting 30 minutes for pumps to heat.' t = 0 while t < 1800: time.sleep(60) t = t + 60 minutes = str(t / 60) print('%s minutes elapsed so far.' % minutes) print 'Turning He4 pump to 9.50 V.' sc.He4p.set_voltage(9.50) print 'Turning IC pump to 5.10 V.' sc.He3ICp.set_voltage(5.10) print 'Turning UC pump to 5.30 V.' sc.He3UCp.set_voltage(5.30) print 'Waiting 20 minutes.' t = 0 while t < 1200: time.sleep(60) t = t + 60 minutes = str(t / 60) print('%s minutes elapsed so far.' % minutes) print 'Turning He4 pump to 5.0 V.' sc.He4p.set_voltage(5.0) print 'Waiting for He4 pump temperature to reach 43 K.' while float(gt.gettemp(logfile, 'He4 IC Pump')) < 43: time.sleep(10) print 'Turning He4 pump to 3.0 V.' sc.He4p.set_voltage(3.00) print 'Waiting 5 minutes.' time.sleep(300) print 'Setting He4 pump to 0.0 V.' sc.He4p.set_voltage(0.00) print 'Sleeping for 3 minutes.' time.sleep(180) print 'Setting He4 switch to 4.00 V.' sc.He4s.set_voltage(4.00) print 'Waiting for He3 IC Pump temperatures to change.' while float(gt.gettemp(logfile, 'He3 IC Pump')) < 52: time.sleep(10) print 'Setting inter pump to 3.0 V.' sc.He3ICp.set_voltage(3.00) print 'Waiting for He3 UC Pump temperature to change.' while float(gt.gettemp(logfile, 'He3 UC Pump')) < 52: time.sleep(10) print 'Setting ultra pump to 5.00 V.' sc.He3UCp.set_voltage(5.00) finish_cycle(logfile) print 'Cycle is complete.' return except: print 'Crashed!' print datetime.datetime.now() zero_everything()