# -*- coding: utf-8 -*- """ Created on Fri Mar 27 10:17:05 2020 @author: giha """ import numpy as np from loader import DataLoad from bar import Bar from edgeCal import EdgeCal from psd import CalNClip, MovingAvg, PSD_hist, FOM_plot, PSD_ergslice from timeHist import TimeHist import matplotlib.pyplot as plt X25 = DataLoad('D:\X25data.p') X26 = DataLoad('D:\X26data.p') ''' X27 = DataLoad('D:\X27data.p') X28 = DataLoad('D:\X28data.p') X29 = DataLoad('D:\X29data.p') X30 = DataLoad('D:\X30data.p') X31 = DataLoad('D:\X31data.p') X32 = DataLoad('D:\X32data.p') ''' plt.close('all') B1cs1 = Bar(X27[0], X27[1]) B2cs1 = Bar(X27[2], X27[3]) B3cs1 = Bar(X27[4], X27[5]) B4cs1 = Bar(X27[6], X27[7])
############################################################################## ############################################################################## ''' X27 = DataLoad('D:\X27data.p') X28 = DataLoad('D:\X28data.p') X29 = DataLoad('D:\X29data.p') X30 = DataLoad('D:\X30data.p') X31 = DataLoad('D:\X31data.p') X32 = DataLoad('D:\X32data.p') ''' plt.close('all') readIn = False if readIn: X27 = DataLoad('D:\X27data.p') X30 = DataLoad('D:\X30data.p') X29 = DataLoad('D:\X29data.p') X28 = DataLoad('D:\X28data.p') csCalData = Bars(X27) nTOFData = Bars(X30) tagCalData = X28 print('Done reading') currentFile = X30 fname = 'X30' ### Calibration and PSD for bars calibrate = False
Short script that reads my data in for debugging my bar PSD stuff """ from loader import DataLoad from bar import Bar from edgeCal import EdgeCal ''' #X17 = DataLoad('D:\\X17data.p') X18 = DataLoad('D:\\X18data-0-20-370.p') #X19 = DataLoad('D:\\X19data.p') ''' ''' X17 = DataLoad('/media/giha/DATA/X17data.p') X18 = DataLoad('/media/giha/DATA/X18data-0-20-370.p') X19 = DataLoad('/media/giha/DATA/X19data.p') ''' X18 = DataLoad('/media/giha/DATA/X18data-0-40-370.p') B1cs1 = Bar(X17[0], X17[1]) B2cs1 = Bar(X17[2], X17[3]) B1cf = Bar(X18[0], X18[1]) B2cf = Bar(X18[2], X18[3]) B1cs2 = Bar(X19[0], X19[1]) B2cs2 = Bar(X19[2], X19[3]) B11 = EdgeCal(B1cs1[0, :], histLabel='B11', xCal=0, integral=True) B12 = EdgeCal(B1cs2[0, :], histLabel='B12', xCal=0, integral=True) B21 = EdgeCal(B2cs1[0, :], histLabel='B21', xCal=0, integral=True) B22 = EdgeCal(B2cs2[0, :], histLabel='B22', xCal=0, integral=True)
barNum = 6 coincWindow = 70 plotLinewidth = 1 figureSize = (7, 4) binEdgesE = np.arange(0, 900, 10) centersE = (binEdgesE[:-1] + binEdgesE[1:]) / 2 readIn = False if readIn: lower = 87 upper = 100 data = [] for i in range(lower, upper + 1): cache = DataLoad('D:\X' + str(i) + 'data.p') data.append(cache) transform = False if transform: datNaiCals = [] datBefCals = [] datAftCals = [] datErgRes = [] for i in range(4): datNaiCals.append(data[i * 4][12]) for i in range(3): datBefCals.append(Bars(data[i * 4 + 1])) datAftCals.append(Bars(data[i * 4 + 3]))
2: [sipm, 0], 3: [3 * sipm, 0], 4: [-2 * sipm, -2 * sipm], 5: [2 * sipm, -2 * sipm] } outfile = 'results\\glassCones.p' plt.close('all') load = False if load: # Load in data and calibrations lightOutputCal = np.loadtxt('figures\\lightOutputCurves.txt') zPosCal = np.loadtxt('figures\\posFit.txt') X69 = DataLoad('D:\X69data.p') barData = Bars(X69) # Convert to bar data # Extract pulse times from bar data barNum = len(barData) eventNums = np.zeros(barNum) # Calibrate and apply PSD cuts loadCal = False if loadCal: csCalDataImageBef = Bars(DataLoad('D:\X68data.p')) csCalDataImageAft = Bars(DataLoad('D:\X70data.p')) psdSigma = 4
return a * np.exp(-(x - x0)**2 / (2 * sigma**2)) def _3rdOrder(x, a, b, c, d): return a * x**3 + b * x**2 + c * x + d read = False if read: lower = 35 upper = 67 dataPos = [] for i in range(upper - lower + 1): cache = DataLoad('D:\X' + str(lower + i) + 'data.p') dataPos.append(cache) pos0 = Bars(dataPos[1]) pos1 = Bars(dataPos[3]) pos2 = Bars(dataPos[6]) pos3 = Bars(dataPos[8]) pos4 = Bars(dataPos[11]) pos5 = Bars(dataPos[14]) pos6 = Bars(dataPos[17]) pos7 = Bars(dataPos[20]) pos8 = Bars(dataPos[23]) pos9 = Bars(dataPos[25]) pos10 = Bars(dataPos[28]) bkg = Bars(dataPos[31]) '''
from loader import DataLoad from bar import Bar from edgeCal import EdgeCal from timeHist import doTimeHist import matplotlib.pyplot as plt import numpy as np from coincFinder import CoincFind plt.close('all') resultPath = 'C:\\Users\\giha\\Documents\\Papers\\glassBars\\' loadData = False if loadData: X23 = DataLoad('D:\\X23data.p') X24 = DataLoad('D:\\X24data.p') doBars = True if doBars: b1cs = Bar(X23[0], X23[1]) b2cs = Bar(X23[2], X23[3]) b1na = Bar(X24[0], X24[1]) b2na = Bar(X24[2], X24[3]) calibrate = True if calibrate: b1Cal = EdgeCal(b1cs[0, :], histLabel='b1', xCal=0, integral=True) b2Cal = EdgeCal(b2cs[0, :], histLabel='b2', xCal=0, integral=True)
timeToBack = lengthToCTime(flightLengthBack) timeToTag = lengthToCTime(flightLengthTag) barNum = 6 fname = 'X73' ############################################################################## ############################################################################## ############################################################################## ############################################################################## plt.close('all') readIn = True if readIn: X71 = DataLoad('D:\X71data.p') X72 = DataLoad('D:\X72data.p') X73 = DataLoad('D:\X73data.p') X74 = DataLoad('D:\X74data.p') tagCalData = X71[12] csOffsetBef = Bars(X72) naTimeRes = X73 naBars = Bars(X73) naTag = X73[12] csOffsetAft = Bars(X74) print('Done reading') ### Calibration and PSD for bars
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Mon Dec 16 13:37:04 2019 @author: giha """ from loader import DataLoad from bar import Bar from edgeCal import EdgeCal from psd import CalNClip, MovingAvg, PSD_hist, FOM_plot, PSD_ergslice from timeHist import TimeHist import matplotlib.pyplot as plt X23 = DataLoad('/media/giha/DATA/X23data.p') X24 = DataLoad('/media/giha/DATA/X24data.p') B1cs = Bar(X23[0], X23[1]) B2cs = Bar(X23[2], X23[3]) B1na = Bar(X24[0], X24[1]) B2na = Bar(X24[2], X24[3]) plt.close('all') B1 = EdgeCal(B1cs[0, :], histLabel='B1', xCal=0, integral=True) B2 = EdgeCal(B2cs[0, :], histLabel='B2', xCal=0, integral=True) cfd = B1na[4, :] - B2na[4, :] ttt = B1na[5, :] - B2na[5, :] tdif = cfd + ttt