#return Convolve(AvgIRF, Exp(Time, Amp, LifeTime))+Convolve(AvgIRF, Exp(Time+12.5, Amp, LifeTime)) + 1.0*AvgIRF*ScatterAmp #FuncToFit = partial(FitFunc, AvgIRF) FitData = AlignedRaw['Channel_1'] Results = FitFunc(Time, FitData, FitRaw, LastIndex=argmax(Time > 10.0), VarGuesses = [max(FitData), 4.0, FitData[0], 2.0*10.0**8.0]) #print FitExp(Time, AlignedRaw[Sum], GateIndex=argmax(Time > 0.1), LastIndex=argmax(Time > 9.0)) print Results """ # AlignedRaw.ChangeColName("Channel_4", "Fit_{Sum}") # AlignedRaw = AlignedRaw.DeleteCol('Channel_1') # AlignedRaw = AlignedRaw.DeleteCol('Channel_2') # AlignedRaw["Fit_{Sum}"] = FitRaw(Time, Results[0], Results[1], Results[2], Results[3]) Data._SetItems() Data = Data.ViewAsType(Dtype) from Common.Helpers import Smooth Normed = ChannelizedArray(Length, 2, Dtype) for Index in Data.keys(): Nonzero = Norm[Index].nonzero() Normed[Index][Nonzero] = Data[Index][Nonzero] / Norm[Index][Nonzero] Normed[Index] = roll(Normed[Index], (Shift + DataShift - argmax(Normed[Index]))) #Normed[Index] = Smooth(Normed[Index],100, 101) Normed[Index] = Normed[Index] / sum(Normed[Index])
for g in file_handle.walk_groups(): if g == file_handle.root: continue Result = search('(.*(mg water).*) \(Group\)', str(g)) if Result == None or Result.group(1) == '': continue if g.TAC_Gain.read() == 3 and g.ChannelCount.read() == 2: if g._DataType.read() == "ADCData": Data.append(ADCData(PyTablesGroup=g)) ChannelCount += g.ChannelCount.read() from DataContainer.StorageArray import ChannelizedArray TotalNormInt = ChannelizedArray(len(Data[0].ADC_Intervals), 2, 'uint64') TotalNormInt._Data = file_handle.get_node('/TotalNorm')._RawBinned.read() TotalNormInt._SetItems() TotalNorm = ChannelizedArray(len(Data[0].ADC_Intervals), 2, 'float64') """ Scatter Data: (Removed) /2013-08-28 exp 4 mg water 150 degree light (Removed) /2013-08-28 exp 5 mg water 150 degree light again last time objective dried out (Removed) /2013-08-28 exp 6 mg water 150 degree light again /2013-09-05 exp 4 mg water 150 pol /2013-09-05 exp 5 mg water 240 pol /2013-09-05 exp 6 mg water 200 pol /2013-09-05 exp 7 mg water cp """ Data = array(Data[3:]) from numpy import sum, roll, argmax, diff
BufferExps = [ '/2013-09-02 exp 10 buffer 150 pol', '/2013-09-02 exp 11 buffer 240 pol', '/2013-09-02 exp 12 buffer 200 pol', '/2013-09-02 exp 13 buffer cp' ] from TTSPCfromBH.DataCalc import ADCData Data = list() for Exp in BufferExps: group = file_handle.get_node(Exp) Data.append(ADCData(PyTablesGroup=group)) from DataContainer.StorageArray import ChannelizedArray TotalNormInt = ChannelizedArray(len(Data[0].ADC_Intervals), 2, 'uint64') TotalNormInt._Data = file_handle.get_node('/TotalNorm')._RawBinned.read() TotalNormInt._SetItems() TotalNorm = ChannelizedArray(len(Data[0].ADC_Intervals), 2, 'float64') file_handle.close() from numpy import sum, roll, argmax SummedBuffer = ChannelizedArray(len(Data[0].ADC_Intervals), 2, 'float64') NoTAC_Norm_SummedBuffer = ChannelizedArray(len(Data[0].ADC_Intervals), 2, 'float64') for D in Data: Temp = ChannelizedArray(len(Data[0].ADC_Intervals), 2, 'float64') for Index in NoTAC_Norm_SummedBuffer.keys(): Nonzero = D._RawBinned[Index].nonzero() Temp[Index][Nonzero] = (1.0 * D._RawBinned[Index][Nonzero]) Temp[Index] = roll(Temp[Index], (Shift - argmax(Temp[Index])))