Project:BB Analysis of BATSE GRB

This script is used to do Bayesian Block analysis with the ascii file of BATSE GRB

Author:Enbo Yang(enboyang1990@gmail.com)

Lisence:GPLv2

Module preparing


In [2]:
import numpy as np
import matplotlib.pyplot as plt
from astroML.plotting import hist as bbhist

In [18]:
!ls tte*


tteascii.00603	tteascii.03611	tteascii.05592	tteascii.06385	tteascii.07063
tteascii.00906	tteascii.03940	tteascii.05634	tteascii.06569	tteascii.07599

In [42]:
trig=raw_input('Please input the tigger:')
timedata=np.fromstring(''.join(open('%s.time'%trig,'r').read().splitlines()),sep=' ')

tempbin=(timedata[timedata.size-1]-timedata[0])//64000
tempbin2=(timedata[timedata.size-1]-timedata[0])//1000
fig,axes = plt.subplots(2,1,figsize=(9,6))

axes[0].hist(timedata/1000000,bins=tempbin,color='blue',histtype='step',label='bin=64ms')
axes[0].set_title('Trig#%s(>25keV)'%trig)
axes[0].set_xlabel('Time/second')
axes[0].set_ylabel('Count')
axes[0].legend(loc='best')


axes[1].hist(timedata/1000000,bins=tempbin2,color='blue',histtype='step',normed=1,label='bin=1ms')
bbhist(timedata/1000000,bins='blocks',color='red',histtype='step',normed=1,label='bayesian')
axes[1].legend(loc='best')
axes[1].set_title('Bayesian block')
axes[1].set_xlabel('Time/second')
axes[1].set_ylabel('probablity')
axes[1].set_ylim([0,2])

fig.tight_layout()
fig.savefig('%s.pdf'%trig,dpi=200)


Please input the tigger:07599

In [31]:
!ls *.time


00575.time  00906.time	03940.time  05634.time	06569.time  07599.time
00603.time  03611.time	05592.time  06385.time	07063.time

Get the Trigger Num


In [45]:
trig=raw_input('Please input the tigger:')
timedata=np.fromstring(''.join(open('%s.time'%trig,'r').read().splitlines()),sep=' ')


Please input the tigger:00603

In [46]:
timedata.size


Out[46]:
4523

Do Bayesian Block analysis

During the analysis, we add Knuth bins ,Scott bins and Freedman bins as comparision.

total data


In [17]:
tempbin=(timedata[timedata.size-1]-timedata[0])//64000
tempbin2=(timedata[timedata.size-1]-timedata[0])//1000
fig,axes = plt.subplots(2,1,figsize=(9,6))

axes[0].hist(timedata/1000000,bins=tempbin,color='blue',histtype='step',label='bin=64ms')
axes[0].set_title('Trig#%s(>25keV)'%trig)
axes[0].set_xlabel('Time/second')
axes[0].set_ylabel('Count')
axes[0].legend(loc='best')


axes[1].hist(timedata/1000000,bins=tempbin2,color='blue',histtype='step',normed=1,label='bin=1ms')
bbhist(timedata/1000000,bins='blocks',color='red',histtype='step',normed=1,label='bayesian')
axes[1].legend(loc='best')
axes[1].set_title('Bayesian block')
axes[1].set_xlabel('Time/second')
axes[1].set_ylabel('probablity')
axes[1].set_ylim([0,2])

fig.tight_layout()
fig.savefig('%s.pdf'%trig,dpi=200)



In [25]:
timedata.size


Out[25]:
4523

In [26]:
plt.hist(timedata[0:4000],bins=500,histtype='stepfilled',normed=1,color='blue')
#bbhist(timedata,bins='blocks',histtype='step',normed=1,color='red')


Out[26]:
(array([  8.33656691e-06,   6.06295775e-06,   6.82082747e-06,
         7.57869719e-06,   4.54721831e-06,   3.03147888e-06,
         9.09443663e-06,   7.57869719e-06,   7.57869719e-06,
         9.09443663e-06,   3.78934860e-06,   3.03147888e-06,
         4.54721831e-06,   7.57869719e-06,   6.06295775e-06,
         9.09443663e-06,   2.27360916e-06,   6.82082747e-06,
         1.06101761e-05,   6.06295775e-06,   5.30508803e-06,
         6.82082747e-06,   9.85230635e-06,   5.30508803e-06,
         9.09443663e-06,   9.09443663e-06,   4.54721831e-06,
         6.06295775e-06,   4.54721831e-06,   4.54721831e-06,
         6.06295775e-06,   4.54721831e-06,   6.82082747e-06,
         4.54721831e-06,   8.33656691e-06,   1.06101761e-05,
         4.54721831e-06,   5.30508803e-06,   8.33656691e-06,
         8.33656691e-06,   6.06295775e-06,   8.33656691e-06,
         6.06295775e-06,   1.36416549e-05,   3.03147888e-06,
         7.57869719e-07,   5.30508803e-06,   1.06101761e-05,
         6.82082747e-06,   3.78934860e-06,   5.30508803e-06,
         6.06295775e-06,   5.30508803e-06,   6.06295775e-06,
         7.57869719e-06,   6.06295775e-06,   4.54721831e-06,
         6.06295775e-06,   7.57869719e-06,   6.82082747e-06,
         5.30508803e-06,   4.54721831e-06,   6.06295775e-06,
         2.27360916e-06,   5.30508803e-06,   3.03147888e-06,
         9.85230635e-06,   6.06295775e-06,   9.85230635e-06,
         3.78934860e-06,   3.78934860e-06,   5.30508803e-06,
         2.27360916e-06,   8.33656691e-06,   1.51573944e-06,
         6.06295775e-06,   1.06101761e-05,   6.06295775e-06,
         6.06295775e-06,   6.82082747e-06,   5.30508803e-06,
         3.03147888e-06,   5.30508803e-06,   7.57869719e-06,
         5.30508803e-06,   6.82082747e-06,   4.54721831e-06,
         4.54721831e-06,   6.82082747e-06,   9.85230635e-06,
         6.06295775e-06,   4.54721831e-06,   8.33656691e-06,
         1.06101761e-05,   7.57869719e-06,   6.06295775e-06,
         4.54721831e-06,   5.30508803e-06,   9.09443663e-06,
         6.06295775e-06,   4.54721831e-06,   6.82082747e-06,
         2.27360916e-06,   9.09443663e-06,   6.82082747e-06,
         3.78934860e-06,   8.33656691e-06,   5.30508803e-06,
         6.82082747e-06,   9.09443663e-06,   2.27360916e-06,
         6.82082747e-06,   1.51573944e-06,   1.51573944e-06,
         3.03147888e-06,   5.30508803e-06,   3.78934860e-06,
         4.54721831e-06,   8.33656691e-06,   9.85230635e-06,
         8.33656691e-06,   7.57869719e-06,   5.30508803e-06,
         4.54721831e-06,   5.30508803e-06,   4.54721831e-06,
         6.06295775e-06,   7.57869719e-06,   4.54721831e-06,
         5.30508803e-06,   7.57869719e-06,   7.57869719e-06,
         6.82082747e-06,   1.28837852e-05,   3.78934860e-06,
         4.54721831e-06,   5.30508803e-06,   6.82082747e-06,
         6.06295775e-06,   6.06295775e-06,   7.57869719e-06,
         9.09443663e-06,   7.57869719e-06,   4.54721831e-06,
         3.78934860e-06,   7.57869719e-06,   3.78934860e-06,
         1.13680458e-05,   8.33656691e-06,   5.30508803e-06,
         1.06101761e-05,   9.09443663e-06,   6.06295775e-06,
         9.85230635e-06,   5.30508803e-06,   4.54721831e-06,
         6.82082747e-06,   5.30508803e-06,   7.57869719e-06,
         6.82082747e-06,   8.33656691e-06,   8.33656691e-06,
         6.06295775e-06,   4.54721831e-06,   4.54721831e-06,
         1.13680458e-05,   6.06295775e-06,   5.30508803e-06,
         9.85230635e-06,   5.30508803e-06,   7.57869719e-06,
         3.03147888e-06,   6.06295775e-06,   6.82082747e-06,
         5.30508803e-06,   4.54721831e-06,   6.82082747e-06,
         8.33656691e-06,   6.82082747e-06,   7.57869719e-06,
         3.78934860e-06,   6.82082747e-06,   6.82082747e-06,
         1.51573944e-06,   4.54721831e-06,   2.27360916e-06,
         5.30508803e-06,   5.30508803e-06,   7.57869719e-06,
         8.33656691e-06,   6.06295775e-06,   6.82082747e-06,
         4.54721831e-06,   5.30508803e-06,   6.82082747e-06,
         8.33656691e-06,   5.30508803e-06,   3.03147888e-06,
         6.82082747e-06,   4.54721831e-06,   3.78934860e-06,
         4.54721831e-06,   7.57869719e-06,   6.82082747e-06,
         9.85230635e-06,   9.85230635e-06,   3.78934860e-06,
         8.33656691e-06,   6.06295775e-06,   6.06295775e-06,
         6.06295775e-06,   8.33656691e-06,   5.30508803e-06,
         6.82082747e-06,   8.33656691e-06,   3.78934860e-06,
         7.57869719e-06,   6.06295775e-06,   5.30508803e-06,
         6.06295775e-06,   7.57869719e-06,   6.82082747e-06,
         3.03147888e-06,   4.54721831e-06,   6.06295775e-06,
         6.06295775e-06,   5.30508803e-06,   3.78934860e-06,
         7.57869719e-06,   5.30508803e-06,   9.85230635e-06,
         6.06295775e-06,   6.06295775e-06,   6.82082747e-06,
         8.33656691e-06,   6.82082747e-06,   6.06295775e-06,
         5.30508803e-06,   5.30508803e-06,   7.57869719e-06,
         8.33656691e-06,   4.54721831e-06,   6.06295775e-06,
         8.33656691e-06,   7.57869719e-06,   4.54721831e-06,
         5.30508803e-06,   8.33656691e-06,   6.82082747e-06,
         8.33656691e-06,   7.57869719e-06,   6.82082747e-06,
         6.82082747e-06,   9.09443663e-06,   5.30508803e-06,
         6.82082747e-06,   3.03147888e-06,   2.27360916e-06,
         6.82082747e-06,   3.78934860e-06,   3.03147888e-06,
         6.82082747e-06,   1.51573944e-06,   1.06101761e-05,
         7.57869719e-06,   4.54721831e-06,   3.78934860e-06,
         7.57869719e-06,   7.57869719e-06,   4.54721831e-06,
         3.78934860e-06,   9.09443663e-06,   6.06295775e-06,
         6.06295775e-06,   5.30508803e-06,   6.06295775e-06,
         6.82082747e-06,   5.30508803e-06,   7.57869719e-06,
         3.78934860e-06,   6.06295775e-06,   7.57869719e-06,
         6.82082747e-06,   4.54721831e-06,   3.78934860e-06,
         5.30508803e-06,   3.03147888e-06,   4.54721831e-06,
         6.82082747e-06,   4.54721831e-06,   3.03147888e-06,
         6.06295775e-06,   5.30508803e-06,   3.78934860e-06,
         5.30508803e-06,   4.54721831e-06,   7.57869719e-06,
         9.09443663e-06,   8.33656691e-06,   9.09443663e-06,
         7.57869719e-06,   9.09443663e-06,   6.06295775e-06,
         3.78934860e-06,   3.78934860e-06,   4.54721831e-06,
         6.06295775e-06,   5.30508803e-06,   8.33656691e-06,
         3.78934860e-06,   8.33656691e-06,   3.78934860e-06,
         4.54721831e-06,   4.54721831e-06,   4.54721831e-06,
         4.54721831e-06,   5.30508803e-06,   2.27360916e-06,
         1.06101761e-05,   4.54721831e-06,   6.82082747e-06,
         1.21259155e-05,   7.57869719e-06,   3.78934860e-06,
         6.82082747e-06,   5.30508803e-06,   7.57869719e-06,
         7.57869719e-06,   9.09443663e-06,   6.06295775e-06,
         5.30508803e-06,   9.09443663e-06,   8.33656691e-06,
         4.54721831e-06,   7.57869719e-06,   9.09443663e-06,
         3.03147888e-06,   3.78934860e-06,   3.03147888e-06,
         3.78934860e-06,   1.06101761e-05,   6.06295775e-06,
         4.54721831e-06,   5.30508803e-06,   6.82082747e-06,
         7.57869719e-07,   1.06101761e-05,   3.03147888e-06,
         3.78934860e-06,   4.54721831e-06,   2.27360916e-06,
         3.03147888e-06,   1.51573944e-06,   5.30508803e-06,
         3.78934860e-06,   6.06295775e-06,   6.06295775e-06,
         6.06295775e-06,   3.78934860e-06,   2.27360916e-06,
         5.30508803e-06,   6.82082747e-06,   6.82082747e-06,
         6.82082747e-06,   4.54721831e-06,   4.54721831e-06,
         3.03147888e-06,   9.85230635e-06,   4.54721831e-06,
         7.57869719e-06,   6.82082747e-06,   6.06295775e-06,
         8.33656691e-06,   6.06295775e-06,   3.78934860e-06,
         6.06295775e-06,   3.78934860e-06,   6.06295775e-06,
         4.54721831e-06,   5.30508803e-06,   6.82082747e-06,
         5.30508803e-06,   6.06295775e-06,   5.30508803e-06,
         7.57869719e-06,   3.78934860e-06,   1.51573944e-06,
         4.54721831e-06,   9.85230635e-06,   4.54721831e-06,
         2.27360916e-06,   1.06101761e-05,   2.27360916e-06,
         9.09443663e-06,   7.57869719e-06,   5.30508803e-06,
         5.30508803e-06,   5.30508803e-06,   4.54721831e-06,
         6.82082747e-06,   9.09443663e-06,   4.54721831e-06,
         3.03147888e-06,   6.06295775e-06,   7.57869719e-06,
         5.30508803e-06,   8.33656691e-06,   9.09443663e-06,
         4.54721831e-06,   6.06295775e-06,   6.82082747e-06,
         5.30508803e-06,   7.57869719e-06,   8.33656691e-06,
         4.54721831e-06,   6.82082747e-06,   9.09443663e-06,
         4.54721831e-06,   9.85230635e-06,   6.06295775e-06,
         9.85230635e-06,   4.54721831e-06,   4.54721831e-06,
         3.03147888e-06,   4.54721831e-06,   9.09443663e-06,
         4.54721831e-06,   5.30508803e-06,   2.27360916e-06,
         4.54721831e-06,   5.30508803e-06,   3.03147888e-06,
         7.57869719e-06,   3.03147888e-06,   4.54721831e-06,
         4.54721831e-06,   4.54721831e-06,   7.57869719e-06,
         5.30508803e-06,   7.57869719e-06,   9.09443663e-06,
         7.57869719e-06,   3.78934860e-06,   3.78934860e-06,
         5.30508803e-06,   7.57869719e-06,   3.03147888e-06,
         2.27360916e-06,   8.33656691e-06,   9.85230635e-06,
         7.57869719e-06,   6.06295775e-06,   4.54721831e-06,
         3.78934860e-06,   5.30508803e-06,   8.33656691e-06,
         3.78934860e-06,   5.30508803e-06,   5.30508803e-06,
         8.33656691e-06,   3.78934860e-06,   3.78934860e-06,
         4.54721831e-06,   8.33656691e-06,   7.57869719e-06,
         3.78934860e-06,   7.57869719e-07,   6.06295775e-06,
         4.54721831e-06,   3.78934860e-06,   5.30508803e-06,
         5.30508803e-06,   3.03147888e-06,   3.78934860e-06,
         6.06295775e-06,   7.57869719e-06,   8.33656691e-06,
         6.82082747e-06,   4.54721831e-06,   8.33656691e-06,
         9.09443663e-06,   7.57869719e-06,   9.85230635e-06,
         6.82082747e-06,   1.13680458e-05,   3.03147888e-06,
         6.06295775e-06,   7.57869719e-06,   6.06295775e-06,
         3.78934860e-06,   6.82082747e-06,   7.57869719e-06,
         1.06101761e-05,   6.82082747e-06,   3.78934860e-06,
         4.54721831e-06,   4.54721831e-06,   9.85230635e-06,
         3.03147888e-06,   8.33656691e-06]),
 array([    846.   ,    1175.872,    1505.744,    1835.616,    2165.488,
          2495.36 ,    2825.232,    3155.104,    3484.976,    3814.848,
          4144.72 ,    4474.592,    4804.464,    5134.336,    5464.208,
          5794.08 ,    6123.952,    6453.824,    6783.696,    7113.568,
          7443.44 ,    7773.312,    8103.184,    8433.056,    8762.928,
          9092.8  ,    9422.672,    9752.544,   10082.416,   10412.288,
         10742.16 ,   11072.032,   11401.904,   11731.776,   12061.648,
         12391.52 ,   12721.392,   13051.264,   13381.136,   13711.008,
         14040.88 ,   14370.752,   14700.624,   15030.496,   15360.368,
         15690.24 ,   16020.112,   16349.984,   16679.856,   17009.728,
         17339.6  ,   17669.472,   17999.344,   18329.216,   18659.088,
         18988.96 ,   19318.832,   19648.704,   19978.576,   20308.448,
         20638.32 ,   20968.192,   21298.064,   21627.936,   21957.808,
         22287.68 ,   22617.552,   22947.424,   23277.296,   23607.168,
         23937.04 ,   24266.912,   24596.784,   24926.656,   25256.528,
         25586.4  ,   25916.272,   26246.144,   26576.016,   26905.888,
         27235.76 ,   27565.632,   27895.504,   28225.376,   28555.248,
         28885.12 ,   29214.992,   29544.864,   29874.736,   30204.608,
         30534.48 ,   30864.352,   31194.224,   31524.096,   31853.968,
         32183.84 ,   32513.712,   32843.584,   33173.456,   33503.328,
         33833.2  ,   34163.072,   34492.944,   34822.816,   35152.688,
         35482.56 ,   35812.432,   36142.304,   36472.176,   36802.048,
         37131.92 ,   37461.792,   37791.664,   38121.536,   38451.408,
         38781.28 ,   39111.152,   39441.024,   39770.896,   40100.768,
         40430.64 ,   40760.512,   41090.384,   41420.256,   41750.128,
         42080.   ,   42409.872,   42739.744,   43069.616,   43399.488,
         43729.36 ,   44059.232,   44389.104,   44718.976,   45048.848,
         45378.72 ,   45708.592,   46038.464,   46368.336,   46698.208,
         47028.08 ,   47357.952,   47687.824,   48017.696,   48347.568,
         48677.44 ,   49007.312,   49337.184,   49667.056,   49996.928,
         50326.8  ,   50656.672,   50986.544,   51316.416,   51646.288,
         51976.16 ,   52306.032,   52635.904,   52965.776,   53295.648,
         53625.52 ,   53955.392,   54285.264,   54615.136,   54945.008,
         55274.88 ,   55604.752,   55934.624,   56264.496,   56594.368,
         56924.24 ,   57254.112,   57583.984,   57913.856,   58243.728,
         58573.6  ,   58903.472,   59233.344,   59563.216,   59893.088,
         60222.96 ,   60552.832,   60882.704,   61212.576,   61542.448,
         61872.32 ,   62202.192,   62532.064,   62861.936,   63191.808,
         63521.68 ,   63851.552,   64181.424,   64511.296,   64841.168,
         65171.04 ,   65500.912,   65830.784,   66160.656,   66490.528,
         66820.4  ,   67150.272,   67480.144,   67810.016,   68139.888,
         68469.76 ,   68799.632,   69129.504,   69459.376,   69789.248,
         70119.12 ,   70448.992,   70778.864,   71108.736,   71438.608,
         71768.48 ,   72098.352,   72428.224,   72758.096,   73087.968,
         73417.84 ,   73747.712,   74077.584,   74407.456,   74737.328,
         75067.2  ,   75397.072,   75726.944,   76056.816,   76386.688,
         76716.56 ,   77046.432,   77376.304,   77706.176,   78036.048,
         78365.92 ,   78695.792,   79025.664,   79355.536,   79685.408,
         80015.28 ,   80345.152,   80675.024,   81004.896,   81334.768,
         81664.64 ,   81994.512,   82324.384,   82654.256,   82984.128,
         83314.   ,   83643.872,   83973.744,   84303.616,   84633.488,
         84963.36 ,   85293.232,   85623.104,   85952.976,   86282.848,
         86612.72 ,   86942.592,   87272.464,   87602.336,   87932.208,
         88262.08 ,   88591.952,   88921.824,   89251.696,   89581.568,
         89911.44 ,   90241.312,   90571.184,   90901.056,   91230.928,
         91560.8  ,   91890.672,   92220.544,   92550.416,   92880.288,
         93210.16 ,   93540.032,   93869.904,   94199.776,   94529.648,
         94859.52 ,   95189.392,   95519.264,   95849.136,   96179.008,
         96508.88 ,   96838.752,   97168.624,   97498.496,   97828.368,
         98158.24 ,   98488.112,   98817.984,   99147.856,   99477.728,
         99807.6  ,  100137.472,  100467.344,  100797.216,  101127.088,
        101456.96 ,  101786.832,  102116.704,  102446.576,  102776.448,
        103106.32 ,  103436.192,  103766.064,  104095.936,  104425.808,
        104755.68 ,  105085.552,  105415.424,  105745.296,  106075.168,
        106405.04 ,  106734.912,  107064.784,  107394.656,  107724.528,
        108054.4  ,  108384.272,  108714.144,  109044.016,  109373.888,
        109703.76 ,  110033.632,  110363.504,  110693.376,  111023.248,
        111353.12 ,  111682.992,  112012.864,  112342.736,  112672.608,
        113002.48 ,  113332.352,  113662.224,  113992.096,  114321.968,
        114651.84 ,  114981.712,  115311.584,  115641.456,  115971.328,
        116301.2  ,  116631.072,  116960.944,  117290.816,  117620.688,
        117950.56 ,  118280.432,  118610.304,  118940.176,  119270.048,
        119599.92 ,  119929.792,  120259.664,  120589.536,  120919.408,
        121249.28 ,  121579.152,  121909.024,  122238.896,  122568.768,
        122898.64 ,  123228.512,  123558.384,  123888.256,  124218.128,
        124548.   ,  124877.872,  125207.744,  125537.616,  125867.488,
        126197.36 ,  126527.232,  126857.104,  127186.976,  127516.848,
        127846.72 ,  128176.592,  128506.464,  128836.336,  129166.208,
        129496.08 ,  129825.952,  130155.824,  130485.696,  130815.568,
        131145.44 ,  131475.312,  131805.184,  132135.056,  132464.928,
        132794.8  ,  133124.672,  133454.544,  133784.416,  134114.288,
        134444.16 ,  134774.032,  135103.904,  135433.776,  135763.648,
        136093.52 ,  136423.392,  136753.264,  137083.136,  137413.008,
        137742.88 ,  138072.752,  138402.624,  138732.496,  139062.368,
        139392.24 ,  139722.112,  140051.984,  140381.856,  140711.728,
        141041.6  ,  141371.472,  141701.344,  142031.216,  142361.088,
        142690.96 ,  143020.832,  143350.704,  143680.576,  144010.448,
        144340.32 ,  144670.192,  145000.064,  145329.936,  145659.808,
        145989.68 ,  146319.552,  146649.424,  146979.296,  147309.168,
        147639.04 ,  147968.912,  148298.784,  148628.656,  148958.528,
        149288.4  ,  149618.272,  149948.144,  150278.016,  150607.888,
        150937.76 ,  151267.632,  151597.504,  151927.376,  152257.248,
        152587.12 ,  152916.992,  153246.864,  153576.736,  153906.608,
        154236.48 ,  154566.352,  154896.224,  155226.096,  155555.968,
        155885.84 ,  156215.712,  156545.584,  156875.456,  157205.328,
        157535.2  ,  157865.072,  158194.944,  158524.816,  158854.688,
        159184.56 ,  159514.432,  159844.304,  160174.176,  160504.048,
        160833.92 ,  161163.792,  161493.664,  161823.536,  162153.408,
        162483.28 ,  162813.152,  163143.024,  163472.896,  163802.768,
        164132.64 ,  164462.512,  164792.384,  165122.256,  165452.128,
        165782.   ]),
 <a list of 1 Patch objects>)

Channel data

Read Channel data from file


In [16]:
ch1time=np.genfromtxt('%s.time.CH1'%trig)
ch2time=np.genfromtxt('%s.time.CH2'%trig)
ch3time=np.genfromtxt('%s.time.CH3'%trig)
ch4time=np.genfromtxt('%s.time.CH4'%trig)

'''
(count1,)=ch1time.shape
(count2,)=ch2time.shape
(count3,)=ch3time.shape
(count4,)=ch4time.shape


ch1time=np.reshape(ch1time,[count1,1])
ch2time=np.reshape(ch2time,[count2,1])
ch3time=np.reshape(ch3time,[count3,1])
ch4time=np.reshape(ch4time,[count4,1])
'''


Out[16]:
'\n(count1,)=ch1time.shape\n(count2,)=ch2time.shape\n(count3,)=ch3time.shape\n(count4,)=ch4time.shape\n\n\nch1time=np.reshape(ch1time,[count1,1])\nch2time=np.reshape(ch2time,[count2,1])\nch3time=np.reshape(ch3time,[count3,1])\nch4time=np.reshape(ch4time,[count4,1])\n'

Plot data in one Picture


In [17]:
fig=plt.figure(figsize=(15,11))

# Channel 1 (25~50 keV)

axes=plt.subplot(2,2,1)
axes.hist(ch1time/1000,bins=128,color='blue',normed='True',histtype='step',label='bins=1s')
bbhist(ch1time/1000,bins='blocks',color='red',normed='True',histtype='step',label='bayesian')
axes.legend(loc='best')
axes.set_title('Channel 1')
axes.set_xlabel('Time/second')
axes.set_ylabel('Count Rate($s^{-1}$)')

# Channel 2 (50~150 keV)

axes=plt.subplot(2,2,2)
axes.hist(ch2time/1000,bins=128,color='blue',normed='True',histtype='step',label='bins=1s')
bbhist(ch2time/1000,bins='blocks',color='red',normed='True',histtype='step',label='bayesian')
axes.legend(loc='best')
axes.set_title('Channel 2')
axes.set_xlabel('Time/second')
axes.set_ylabel('Count Rate($s^{-1}$)')

# Channel 3 (150~300 keV)

axes=plt.subplot(2,2,3)
axes.hist(ch3time/1000,bins=128,color='blue',normed='True',histtype='step',label='bins=1s')
bbhist(ch3time/1000,bins='blocks',color='red',normed='True',histtype='step',label='bayesian')
axes.legend(loc='best')
axes.set_title('Channel 3')
axes.set_xlabel('Time/second')
axes.set_ylabel('Count Rate($s^{-1}$)')
axes.set_ylim([0,0.002])

# Channel 4 (>=300 keV)

axes=plt.subplot(2,2,4)
axes.hist(ch4time/1000,bins=128,color='blue',normed='True',histtype='step',label='bins=1s')
bbhist(ch4time/1000,bins='blocks',color='red',normed='True',histtype='step',label='bayesian')
axes.legend(loc='best')
axes.set_title('Channel 4')
axes.set_xlabel('Time/second')
axes.set_ylabel('Count Rate($s^{-1}$)')

fig.tight_layout()
#fig.savefig('%sCH.png'%trig,dpi=200)


Test Part


In [1]:
!pwd


/home/enboyang/temp/test

In [31]:
(timedata[timedata.size-1]-timedata[0])/1000


Out[31]:
2895.078

In [24]:
timedata.size


Out[24]:
24676

In [ ]: