예제 #1
0
import numpy as np
import matplotlib.pyplot as plt
from utils import read_mca
figsize = (12, 8)
data20, live_time = read_mca("../data/calib_detector_gain20_5peaks.mca")
data50, live_time = read_mca("../data/calib_detector_gain50_5peaks.mca")
data100, live_time = read_mca("../data/calib_detector_gain100_4peaks.mca")
channels = np.arange(len(data20))
#Pulse heights from Christians notes
pulseHeights20 = np.array([10.3, 20.3, 39.6, 70., 110.])  #mV
pulseHeights50 = np.array([5., 10.0, 20., 40., 50.])  #mV
pulseHeights100 = np.array([2., 5.0, 10.0, 19.6])  #mV
#By eye estimates where the peaks roughly are
peaksrough20 = np.array([25, 72, 152, 276, 436])
peaksrough50 = np.array([36, 90, 193, 388, 494])
peaksrough100 = np.array([15, 76, 175, 371])

plt.figure(1)
plt.step(channels, data20, lw=2, where='mid', label="Calibration Data")
plt.figure(2)
plt.step(channels, data50, lw=2, where='mid', label="Calibration Data")
plt.figure(3)
plt.step(channels, data100, lw=2, where='mid', label="Calibration Data")


#Gaussian function
def gauss_function(x, a, x0, sigma):
    return a * np.exp(-(x - x0)**2 / (2 * sigma**2))


# program
예제 #2
0
import numpy as np
import matplotlib.pyplot as plt
from utils import read_mca

if (__name__ == '__main__'):
    import sys
    file_names = sys.argv[1:]
    plt.figure()
    for f in file_names:
        data, live_time = read_mca(f)

        plt.step(range(len(data)),
                 data / live_time,
                 where='mid',
                 label="%s live time %f s" % (f, live_time))
    #channel np.array(range(len(data)))
    #mask = (channel>300) & (channel<400)
    #chargsum = sum(np.array(data)[mask])
    #print(chargsum)
    plt.legend()
    plt.xlabel("Channel", size=20)
    plt.ylabel("Rate [Hz]", size=20)
    plt.yscale('log')
    plt.show()
예제 #3
0
import numpy as np
import matplotlib.pyplot as plt
from utils import read_mca


if(__name__ == '__main__'):
    import sys
    file_names = sys.argv[1:]
    plt.figure()
    for f in file_names:
        data,live_time = read_mca(f)

        plt.step(range(len(data)),data/live_time,where='mid',label= "%s live time %f s"%(f,live_time))
    #channel np.array(range(len(data)))
    #mask = (channel>300) & (channel<400)
    #chargsum = sum(np.array(data)[mask])
    #print(chargsum)
    plt.legend()
    plt.xlabel("Channel",size=20)
    plt.ylabel("Rate [Hz]",size=20)
    plt.yscale('log')
    plt.show()
예제 #4
0
import numpy as np
import matplotlib.pyplot as plt
from utils import read_mca
figsize = (12,8)
data20,live_time = read_mca("../data/calib_detector_gain20_5peaks.mca")
data50,live_time = read_mca("../data/calib_detector_gain50_5peaks.mca")
data100,live_time = read_mca("../data/calib_detector_gain100_4peaks.mca")
channels = np.arange(len(data20))
#Pulse heights from Christians notes
pulseHeights20 = np.array([10.3,20.3,39.6,70.,110.])#mV
pulseHeights50 = np.array([5.,10.0,20.,40.,50.])#mV
pulseHeights100 = np.array([2.,5.0,10.0,19.6])#mV
#By eye estimates where the peaks roughly are
peaksrough20 = np.array([25,72,152,276,436])
peaksrough50 = np.array([36,90,193,388,494])
peaksrough100 = np.array([15,76,175,371])

plt.figure(1)
plt.step(channels,data20, lw = 2, where='mid',label= "Calibration Data")
plt.figure(2)
plt.step(channels,data50, lw = 2, where='mid',label= "Calibration Data")
plt.figure(3)
plt.step(channels,data100, lw = 2, where='mid',label= "Calibration Data")


#Gaussian function
def gauss_function(x, a, x0, sigma):
    return a*np.exp(-(x-x0)**2/(2*sigma**2))


# program