예제 #1
0
파일: getSpeed.py 프로젝트: kpws/MuonLab
def err1(dt,I):
    t=np.linspace(t1,t2,1000)
    return sum((photonPDF(t-dt)*I-speedExp.pdf(t))**2)
예제 #2
0
파일: getSpeed.py 프로젝트: kpws/MuonLab
def err2(v,I):
    t=np.linspace(t2,t3,1000)
    return sum((muonPDF(t-dt,v)*I-speedExp.pdf(t))**2)
예제 #3
0
파일: getSpeed.py 프로젝트: kpws/MuonLab
from peakShapes import photonPDF, muonPDF
import speedExp
import pylab as pl
import numpy as np
from scipy import trapz
from scipy.optimize import fmin

c=2.99792458e8

t=np.linspace(-40e-9,40e-9,2500)
pl.plot(t, speedExp.pdf(t),'k',label='Experimental')

t1=6.6e-9
t2=1.66e-8
t3=3.6e-8

#for x in [t1,t2,t3]:
#    pl.plot([x]*2,[0,1e8],'-k')

#dt=how much p2 is delayed compared to p1
def err1(dt,I):
    t=np.linspace(t1,t2,1000)
    return sum((photonPDF(t-dt)*I-speedExp.pdf(t))**2)

def err2(v,I):
    t=np.linspace(t2,t3,1000)
    return sum((muonPDF(t-dt,v)*I-speedExp.pdf(t))**2)


t=np.linspace(t1,t2,1000)
#I1=sum(speedExp.pdf(t))*(t[1]-t[0])