def __init__(self, pc, postemp_wait, fidtemp_wait): self.PC = pc self.postemp_wait = postemp_wait self.fidtemp_wait = fidtemp_wait self.start_time = datetime.datetime.now() self.file_path = '/home/msdos/focalplane/pos_utility/' self.temp_log_path = os.getcwd()#'/home/msdos/test_util/temp_logs/' self.pos_index_file = 'desi_positioner_indexes.csv' self.date_today = str(self.start_time.year)+str(self.start_time.month).zfill(2)+str(self.start_time.day) #Start PC Petal_to_PC = {0:4, 1:5, 2:6, 3:3, 4:8, 5:10, 6:11, 7:2, 8:7, 9:9, 18:0} self.temp_log_name = self.temp_log_path+'/%s_temp_log_PC_%s.txt' % (self.date_today, str(self.PC)) self.petal = Petal_to_PC[self.PC] self.comm = petalcomm.PetalComm(self.PC) petal_label = print("Connected to PC%s on Petal %s" % (str(self.PC), str(self.petal))) df = pd.read_csv(self.pos_index_file) self.pdf=df.loc[df['PETAL_ID'] == int(self.petal)] self.hole_coords = np.genfromtxt(self.file_path+'hole_coords.csv', delimiter = ',', usecols = (3,4), skip_header = 40) self.nons = [38, 331, 438, 460, 478, 479, 480, 481, 497, 498, 499, 500, 513, 514, 515, 516, 527, 528, 529, 530, 531, 535, 536, 537, 538, 539, 540] self.gifs = [541, 542] self.fifs = [11, 75, 150, 239, 321, 439, 482, 496, 517, 534] self.mt = [] self.mean_temps = [] self.mean_fids = [] self.can_buses= {'can10','can11','can12','can13','can14','can15','can16','can17','can22','can23'} self.pb_temps = {'PBOX_TEMP_SENSOR':[], 'FPP_TEMP_SENSOR_1': [], 'FPP_TEMP_SENSOR_2': [], 'FPP_TEMP_SENSOR_3': [], 'GXB_TEMP_SENSOR': []} self.adc_values = {'ADC2': [], 'ADC3': [], 'ADC1': [], 'ADC4': [], 'ADC0': []}
def set_PC(self): Petal_to_PC = {0:4, 1:5, 2:6, 3:3, 4:8, 5:10, 6:11, 7:2, 8:7, 9:9, 18:0} self.PC = int(self.PC_entry.get()) self.petal = Petal_to_PC[self.PC] self.comm = petalcomm.PetalComm(self.PC) petal_label = print("Connected to PC%s on Petal %s" % (str(self.PC), str(self.petal))) df = pd.read_csv(self.pos_index_file) self.pdf=df.loc[df['PETAL_ID'] == int(self.petal)]
def connect_to_petal(self): self.comm = petalcomm.PetalComm(self.pc_num) line = 'Connected to Petal %d with PC# %d' % (self.petal_num, self.pc_num) self.logdisp.insert(0, line) #Get FIF CANIDS this_data = self.map[self.map['PETAL_ID'] == float(self.petal_num)] fif_list = this_data[(this_data['DEVICE_TYPE'] == 'FIF')|(this_data['DEVICE_TYPE'] == 'GIF')] self.fid_dict = {'can10':{},'can11':{},'can12':{},'can13':{},'can14':{},'can15':{},'can16':{},'can17':{},'can22':{},'can23':{}} for fif in fif_list: self.fid_dict['can'+str(int(fif['BUS_ID']))][int(fif['CAN_ID'])] = fif['DEVICE_ID'] line = "Using this list of fiducials: ", self.fid_dict self.logdisp.insert(0,line)
def __init__(self): self.start_time = datetime.datetime.now() self.file_path = '/home/msdos/focalplane/pos_utility/' self.temp_log_path = os.getcwd() #'/home/msdos/test_util/temp_logs/' self.wait = int(results.wait) if self.wait is None: self.wait = 60 print("Temperature will be read every %d seconds" % self.wait) self.temp_log = open( self.temp_log_path + '/temp_log_%s.txt' % str(self.start_time), 'w') self.hole_coords = np.genfromtxt(self.file_path + 'hole_coords.csv', delimiter=',', usecols=(3, 4), skip_header=40) self.nons = [ 38, 331, 438, 460, 478, 479, 480, 481, 497, 498, 499, 500, 513, 514, 515, 516, 527, 528, 529, 530, 531, 535, 536, 537, 538, 539, 540 ] self.gifs = [541, 542] self.fifs = [11, 75, 150, 239, 321, 439, 482, 496, 517, 534] try: self.petal = str(results.petal).zfill(2) self.comm = petalcomm.PetalComm(int(str(results.pc))) except: print('Must be run with two arguments: petal # and petalbox #') sys.exit() self.init_temps = [ -40, -35, -30, -25, -20, -15, -10, -5, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125 ] self.adc = [ 3972.291151, 3927.370935, 3869.451327, 3795.92674, 3704.600096, 3593.238247, 3460.369957, 3305.419031, 3129.278263, 2933.684449, 2721.964441, 2500.36307, 2273.125056, 2048, 1829.510403, 1621.972457, 1428.638708, 1251.753073, 1091.966263, 949.5873406, 823.911807, 713.9506234, 618.034474, 535.4993046, 464.1503813, 402.5825068, 348.8588418, 302.7049454, 263.3419356, 229.9160146, 201.3532376, 176.832823, 155.6819655, 137.3646468 ] self.f2 = interpolate.interp1d(self.adc, self.init_temps, kind='cubic')
import sys sys.path.append('/home/msdos/focalplane/plate_control/trunk/petal') import datetime import numpy as np import petalcomm import petal start_time = datetime.datetime.now() print(start_time) Comms = [] for pc in [0, 1, 3, 4, 5, 6, 7, 8, 9]: try: Comms.append(petalcomm.PetalComm(pc)) except: print("Can't connect with PC%d" % pc) for i, comm in enumerate(Comms): comm.pbset('GFA_FAN', {'inlet': ['off', 0], 'outlet': ['off', 0]}) print("All GFA Fans should be turned OFF now: ", datetime.datetime.now()) print("Now double checking the GFA Fans are turned OFF") for i, comm in enumerate(Comms): print("Petal Location %d" % i) print(comm.pbget('GFA_FAN'))