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