@@ -0,0 +1,71 | |||||
|
1 | ''' | |||
|
2 | Created on 23/01/2012 | |||
|
3 | ||||
|
4 | @author $Author$ | |||
|
5 | @version $Id$ | |||
|
6 | ''' | |||
|
7 | import os, sys | |||
|
8 | import time, datetime | |||
|
9 | ||||
|
10 | from Model.JROData import JROData | |||
|
11 | from IO.DataIO import * | |||
|
12 | #=============================================================================== | |||
|
13 | # from Graphics.DataPlot import Osciloscope | |||
|
14 | # | |||
|
15 | # from Model.Spectra import Spectra | |||
|
16 | # from IO.SpectraIO import * | |||
|
17 | # from Graphics.SpectraPlot import Spectrum | |||
|
18 | #=============================================================================== | |||
|
19 | ||||
|
20 | class TestSChain(): | |||
|
21 | ||||
|
22 | ||||
|
23 | def __init__(self): | |||
|
24 | self.setValues() | |||
|
25 | self.createObjects() | |||
|
26 | self.testSChain() | |||
|
27 | pass | |||
|
28 | ||||
|
29 | def setValues(self): | |||
|
30 | ||||
|
31 | self.path = "/home/valentin/Tmp/RAWDATA" | |||
|
32 | self.startDateTime = datetime.datetime(2009,11,2,00,00,0) | |||
|
33 | self.endDateTime = datetime.datetime(2009,11,30,18,10,0) | |||
|
34 | ||||
|
35 | def createObjects(self): | |||
|
36 | ||||
|
37 | self.Obj = JROData() | |||
|
38 | self.readerObj = JRODataReader(self.Obj) | |||
|
39 | #self.plotObj = Spectrum(self.Obj) | |||
|
40 | ||||
|
41 | if not(self.readerObj.setup(self.path, self.startDateTime, self.endDateTime, ext = '.pdata', expLabel='', online =1)): | |||
|
42 | sys.exit(0) | |||
|
43 | ||||
|
44 | def testSChain(self): | |||
|
45 | ||||
|
46 | ini = time.time() | |||
|
47 | while(True): | |||
|
48 | if self.readerObj.getData(): | |||
|
49 | print "", | |||
|
50 | #self.plotObj.plotData(zmin=40, zmax=140, showColorbar=True, showPowerProfile=True) | |||
|
51 | ||||
|
52 | # self.writerObj.putData() | |||
|
53 | ||||
|
54 | ||||
|
55 | if self.readerObj.noMoreFiles: | |||
|
56 | break | |||
|
57 | ||||
|
58 | if self.readerObj.flagIsNewBlock and self.readerObj.nReadBlocks: | |||
|
59 | print 'Block No %04d, Time: %s' %(self.readerObj.nReadBlocks, | |||
|
60 | datetime.datetime.fromtimestamp(self.readerObj.m_BasicHeader.utc),) | |||
|
61 | #=============================================================== | |||
|
62 | # fin = time.time() | |||
|
63 | # print 'Tiempo de un bloque leido y escrito: [%6.5f]' %(fin - ini) | |||
|
64 | # ini = time.time() | |||
|
65 | #=============================================================== | |||
|
66 | ||||
|
67 | #time.sleep(0.5) | |||
|
68 | self.plotObj.end() | |||
|
69 | ||||
|
70 | if __name__ == '__main__': | |||
|
71 | TestSChain() No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now