Ejemplo n.º 1
0
from TTSPCfromBH.NormCalc import Norm
from TTSPCfromBH.TTPhotonDataImport import Data
import numpy

#    try:
#        AL
#    except:

from DataContainer.StorageArray import ChannelizedArray
try:
    PlotArray
except:
    PlotArray = ChannelizedArray(4095, 3, 'float64')

RunName = "C1"
PlotArray.ChangeColName('Channel_1', RunName)
RunName = "C2"
PlotArray.ChangeColName('Channel_2', RunName)
RunName = "Both"
PlotArray.ChangeColName('Channel_3', RunName)
#RunName = "488 High 200"
#PlotArray.ChangeColName('Channel_4', RunName)
#RunName = "H2O 200"
#PlotArray.ChangeColName('Channel_5', RunName)

#FileName = 'exp 10 ncp low count rate 150 pol very long'
#FolderName = 'Single_Molecule_Data/local_data/September/04/'

#DataSet = '/2013-09-02 exp 6 alexa high conc cp'; G = 1.0; BG = 'Water'
#DataSet = '/2013-09-02 exp 5 alexa high conc 200 pol'; G = 2.0; BG = 'Water'
#DataSet = '/2013-09-02 exp 3 alexa high conc 150 pol'; G = 1.5; BG = 'Water'
Ejemplo n.º 2
0
    Result = SignalR + BackgroundR + Offset + BIV

    #return Result/max(Result)
    return Result, SignalR, BackgroundR


try:
    FitNormed
    Channel1
    Channel2
except:
    from ModelTesting import *

from DataContainer.StorageArray import ChannelizedArray
PlotArray = ChannelizedArray(len(Time), 3, 'float64')
PlotArray.ChangeColName('Channel_1', 'r(t)_1')
PlotArray.ChangeColName('Channel_2', 'r(t)_2')
PlotArray.ChangeColName('Channel_3', 'r(t)_{Avg}')

#Vars=[0.0676060977225,
#    4.06009692902,
#    1.00602234087,
#    0.0,
#    -0.14037043243,
#    0.672045359399,
#    0.0,
#    0.0,
#    0.0,
#    0.0,
#    0.0]
Vars = [
Ejemplo n.º 3
0
Archivo: Testing.py Proyecto: vatir/SMD
for Index in Data.keys():
    Nonzero = Norm[Index].nonzero()

    AlignedRaw[Index][Nonzero] = Data[Index][Nonzero] / Norm[Index][Nonzero]
    AlignedRaw[Index] = roll(AlignedRaw[Index],
                             (Shift + DataShift - argmax(AlignedRaw[Index])))

    AlignedRawNonzero[Index] = AlignedRaw[Index].nonzero()[0]
    Nonzero = AlignedRaw[Index].nonzero()[0]
    NonzeroLength = len(Nonzero)

    AlignedRaw[Index][arange(NonzeroLength)] = AlignedRaw[Index][Nonzero]
    AlignedRaw[Index][NonzeroLength:] = 0

Sum = "Channel_{Sum}"
AlignedRaw.ChangeColName("Channel_3", Sum)

AlignedRaw[Sum] = (AlignedRaw['Channel_1'] + AlignedRaw['Channel_2'])
"""
from numpy import inf
AvgIRF = IRF['Channel_1']
def FitRaw(Time, Amp, LifeTime, Offset, ScatterAmp, Start=0, End=len(AvgIRF)):
     
    if LifeTime == 0.0:
        return inf
    return Exp(Time, Amp, LifeTime)+ Exp(Time+12.5, Amp, LifeTime) + 1.0*AvgIRF[Start:End]*ScatterAmp + Offset

    
    #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']
Ejemplo n.º 4
0
    print "Roll Value: %s" % Rolls[i]
    print MethodList[i]
    print Result.x
    print Result.fun
    print "Time: %s" % Times[i]
    print "!------------------------------!"
print "Best Values: %s" % Vars
print "Best Roll Value: %s" % RollValue
print "LowestFuncValue: %s" % LowestFuncValue
print "Method: %s" % MethodValue
print "Time: %s" % BestTime
# ------------------------------------------------
from DataContainer.StorageArray import ChannelizedArray

PlotArray = ChannelizedArray(len(Time), 2, 'float64')
PlotArray.ChangeColName('Channel_1', 'Data')
PlotArray.ChangeColName('Channel_2', 'Fit')
PlotArray['Data'] = Data
PlotArray['Fit'] = FitNormed(Data,
                             Time,
                             Vars[0],
                             Vars[1],
                             Vars[2],
                             RollValue,
                             Start=0,
                             End=len(Time))

Plot = True

if Plot:
    from Display import ForkDisplay
Ejemplo n.º 5
0
#     Show = False
#     if Show:
#         for Plot in Plots:
#                 Plot.show()
#
#     Save = False
#     if Save:
#         for i, Plot in enumerate(Plots):
#             Plot.savefig(str(i)+'.png', dpi=300)

    from DataContainer.StorageArray import ChannelizedArray
    from numpy import arange, exp
    from numpy.random import rand
    Time = arange(0, 4095, 1) * 16.6666 / 4095.0
    Testing = ChannelizedArray(len(Time), 2, 'float64')
    Testing.ChangeColName('Channel_1', 'Data')
    Testing.ChangeColName('Channel_2', 'Fit')
    Testing['Fit'] = exp(-Time / 4.1)
    Testing['Data'] = exp(-Time / 4.1) + (rand(4095) - 0.5) * 0.1 * Time * 0.01

    print "\nPlotting:"
    ForkDisplay(Time,
                Testing,
                Title="Display Testing",
                YAxis="Intensity (Normalized)",
                Residuals=((Testing['Data'], Testing['Fit']), ),
                Corr=True)

    print "\nPlotting:"
    ForkDisplay(Time,
                Testing,
Ejemplo n.º 6
0
    print i

print "Final Values:"
for i, name in enumerate(VarNames):
    print "    %s : %s" % (name, Vars[i])

print "!------------------------------!"
print DataSet
print "LowestFuncValue: %s" % LowestFuncValue
print "Method: %s" % MethodValue
print "Time: %s" % BestTime

# ------------------------------------------------
from DataContainer.StorageArray import ChannelizedArray
PlotArray = ChannelizedArray(len(Time), 6, 'float64')
PlotArray.ChangeColName('Channel_1', 'Data')
PlotArray.ChangeColName('Channel_2', 'Data_{Fit}')
PlotArray.ChangeColName('Channel_3', 'Lifetime_1')
PlotArray.ChangeColName('Channel_4', 'Lifetime_2')
PlotArray.ChangeColName('Channel_5', 'Background')
PlotArray.ChangeColName('Channel_6', 'Fit')

CurrentData = FitChannel1 + Vars[2] * FitChannel2
CurrentData = CurrentData / max(CurrentData)
PlotArray['Data_{Fit}'][:len(CurrentData)] = CurrentData[:len(CurrentData)]

Data = Channel1 + Vars[2] * Channel2
Data = Data / max(Data)

PlotArray['Data'] = Data
PlotArray['Fit'], Temp, PlotArray['Background'] = FitNormed(Data,
Ejemplo n.º 7
0
Decay = r_[zeros(len(Time)), Exp(Time, 1.0, 4.1)]
Convolved = RawConvolveFFT(Decay, AlignedIRF, None)
Convolved0 = RawConvolveFFT(Decay, AlignedIRF0, None)
GConvolved = RawConvolveFFT(Decay, GIRF, None)

TimeOffset = 0.0

IRFI = InterpolatedUnivariateSpline(LongTime, AlignedIRF)
IRFIV = IRFI(LongTime - TimeOffset)
IRFIV = IRFIV / sum(IRFIV)
IRFIVConv = RawConvolveFFT(Decay, IRFIV, None)

Plotting = ChannelizedArray(len(LongTime), 1, 'float64')

Plotting.ChangeColName("Channel_1", "Convolved")
Plotting['Convolved'] = roll(Convolved / max(Convolved), 4095)

Plotting = Plotting.AddCol('Gauss')
Plotting['Gauss'] = GIRF / max(GIRF)

Plotting = Plotting.AddCol('GConv')
Plotting['GConv'] = roll(GConvolved / max(GConvolved), 4095)

#Plotting = Plotting.AddCol('Scatter')
#Plotting['Scatter'] = AlignedIRF/max(AlignedIRF)

Plotting = Plotting.AddCol('IRFIV')
Plotting['IRFIV'] = IRFIV / max(IRFIV)

Plotting = Plotting.AddCol('IRFIV Conv')