def getpoweratinstall(self, det, whatbaseline): #value of the nr of rotation set before installation (hardcoded) # find the power at -2V from calibration ref = 0 rotation = 0 poweratminus2 = 0 if det.type == 'horn': ref = refrotationhorn rotation = ref + det.rotation poweratminus2 = interp(rotation,self.resistorhorn[0],self.resistorhorn[1]) if det.type == 'helix': ref = refrotationhelix rotation = ref + det.rotation #special case for nono: if det.name.lower()=='nono': poweratminus2 = -29.2 else: poweratminus2 = interp(rotation,self.resistorhelix[0],self.resistorhelix[1]) #now get the voltage difference between -2V and the voltage at install if whatbaseline == 'install': deltav = utils.adctov_board(det.meanBL) - (-2) elif whatbaseline == 'monit': deltav = utils.adctov_board(det.meanBLyear) - (-2) poweratinstall = poweratminus2 + self.boardslope*deltav return poweratinstall
def producepowerwaveform(self, wf): vfeamp = utils.adctov_board(wf.amp) powerdet = (vfeamp-self.det.board_k)/self.det.board_slope pdbm = (powerdet - self.det.pd_k)/self.det.pd_slope watt = utils.dbmtowatt(pdbm) newwf = waveform.Waveform(wf.time,watt,'an_watt') return newwf
def producepowerwaveform(self, wf): vfeamp = utils.adctov_board(wf.amp) powerdet = (vfeamp- (-8))/4 # powerdet = (vfeamp-self.det.board_k)/self.det.board_slope pdbm = (powerdet - self.det.m3_offset)/self.det.m3_slope watt = utils.dbmtowatt(pdbm) newwf = waveform.Waveform(wf.time,watt,'an_watt') # newwf = waveform.Waveform(wf.time,powerdet,'an_watt') return newwf
def producepowerwaveform(self, wf): vfeamp = utils.adctov_board(wf.amp) fewf = waveform.Waveform(wf.time,vfeamp,'an_fe') if self.det.type == 'norsat' or self.det.type=='helix': # fewf = self.switchsignaldirection(fewf) powerdet = (vfeamp-constant.boardoffsetGD)/constant.boardslopeGD else: powerdet = (vfeamp-self.det.board_k)/self.det.board_slope # vfeamp = fewf.amp # powerdet = (vfeamp+8)/4 # pdbm = (powerdet - self.det.m2_offset)/self.det.m2_slope pdbm = (powerdet - self.det.m3_offset)/self.det.m3_slope watt = utils.dbmtowatt(pdbm) newwf = waveform.Waveform(wf.time,watt,'an_watt') # newwf = waveform.Waveform(wf.time,vfeamp,'an_watt') # newwf = waveform.Waveform(wf.time,powerdet,'an_watt') return newwf
cal.fillpotardata() cal.reset() #fill the installation information cal.filldetectors('horn') cal.filldetectors('helix') phorn = np.array([]) errhorn = np.array([]) namehorn = np.array([]) phelix = np.array([]) errhelix = np.array([]) namehelix = np.array([]) for det in cal.horndet: cal.seterrorrotation(det,delrotation) errBL = utils.adctov_board(det.stdBLyear)*(+cal.boardslope) errtotdb = utils.quadraticerrordB(det.errorrotation,errBL) phorn = np.append(phorn, cal.getpoweratinstall(det,'monit')) errhorn = np.append(errhorn, errtotdb) namehorn = np.append(namehorn, det.name) # print det.name, ': err rotation = ' , "%.2f" % det.errorrotation, ' error baseline = ' "%.2f" % errBL, ' error tot = ', "%.2f" % errtotdb for det in cal.helixdet: cal.seterrorrotation(det,delrotation) errBL = utils.adctov_board(det.stdBLyear)*(cal.boardslope) errtotdb = utils.quadraticerrordB(det.errorrotation,errBL) phelix = np.append(phelix, cal.getpoweratinstall(det,'monit')) errhelix = np.append(errhelix, errtotdb) namehelix = np.append(namehelix, det.name) # print det.name, ': err rotation = ' , "%.2f" % det.errorrotation, ' error baseline = ' "%.2f" % errBL, ' error tot = ', "%.2f" % errtotdb
import os import sys cwd = os.getcwd() classpath = cwd + '/../classes/' utilspath = cwd + '/../utils/' sys.path.append(utilspath) sys.path.append(classpath) import utils import utils import detector import calibration basefolder = cwd + '/../../data/' cal = calibration.Calibration(datafolder = basefolder) #first fill the calibration of the adjustable resistor cal.fillpotardata() dethorn = cal.filldetectors('horn') dethelix = cal.filldetectors('helix') adc = [0,500,1024] print 'adc to v front end: ', utils.adctov_fe(adc[0]), ' ' , utils.adctov_fe(adc[1]), ' ' , utils.adctov_fe(adc[2]) print 'adc to v board: ', utils.adctov_board(adc[0]), ' ' , utils.adctov_board(adc[1]), ' ' , utils.adctov_board(adc[2]) print 'size of dets = ', len(cal.horndet) for det in cal.horndet: print det.type, ' ', det.name, ' ', det.tankid , ' ', det.zenith, ' ' , det.azimuth, ' ' , det.antid, ' ' , det.elecid, ' ' , det.rotation , ' ', det.meanBL print ' ' for det in cal.helixdet: print det.type , ' ', det.name, ' ', det.tankid , ' ', det.zenith, ' ' , det.azimuth, ' ' , det.antid, ' ' , det.elecid, ' ' , det.rotation , ' ', det.meanBL
patinstallhorn = np.append(patinstallhorn, cal.getpoweratinstall(det, typeofbaseline)) zenithhorn = np.append(zenithhorn, det.zenith) azhorn = np.append(azhorn, det.azimuth) for det in cal.helixdet: patinstallhelix = np.append(patinstallhelix, cal.getpoweratinstall(det, typeofbaseline)) zenithhelix = np.append(zenithhelix, det.zenith) azhelix = np.append(azhelix, det.azimuth) fig1 = plt.figure(figsize=(8, 8)) n, bins, patches = plt.hist(patinstallhorn, 10, facecolor="green", alpha=0.75, label="horn") n1, bins1, patches1 = plt.hist(patinstallhelix, 10, facecolor="red", alpha=0.75, label="helix") plt.xlabel("power at installation [dBm]", fontsize=15) plt.ylabel("entries", fontsize=15) plt.legend(fontsize=15) plt.show() ## write down the values (for the notebook) print " helix detectors (in dBm):" for det in cal.helixdet: print det.name, " ", "%.2f" % cal.getpoweratinstall(det, typeofbaseline), " +/- ", "%.2f" % ( utils.adctov_board(det.stdBLyear) * (cal.boardslope) ) print "\n horn detectors (in dBm):" for det in cal.horndet: print det.name, " ", "%.2f" % cal.getpoweratinstall(det, typeofbaseline), " +/- ", "%.2f" % ( utils.adctov_board(det.stdBLyear) * (cal.boardslope) )