@@ -0,0 +1,73 | |||||
|
1 | ''' | |||
|
2 | Created on 20/03/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 | self.srcPath = "/home/valentin/Tmp/RAWDATA" | |||
|
28 | self.dstPath = "/home/valentin/Tmp/RAWDATA2" | |||
|
29 | self.startDateTime = datetime.datetime(2009,11,1,00,00,0) #4 | |||
|
30 | self.endDateTime = datetime.datetime(2009,11,30,18,10,0) | |||
|
31 | ||||
|
32 | def createObjects(self): | |||
|
33 | ||||
|
34 | self.Obj = Spectra() | |||
|
35 | self.readerObj = SpectraReader(self.Obj) | |||
|
36 | self.writerObj = SpectraWriter(self.Obj) | |||
|
37 | self.plotObj = Spectrum(self.Obj) | |||
|
38 | ||||
|
39 | if not( self.readerObj.setup(self.srcPath, self.startDateTime, self.endDateTime, expLabel='', online =0) ): | |||
|
40 | sys.exit(0) | |||
|
41 | ||||
|
42 | if not( self.writerObj.setup(path=self.dstPath) ): sys.exit(0) | |||
|
43 | ||||
|
44 | ||||
|
45 | def testSChain(self): | |||
|
46 | ||||
|
47 | ini = time.time() | |||
|
48 | while(True): | |||
|
49 | if self.readerObj.getData(): | |||
|
50 | self.plotObj.plotData( zmin=35, zmax=100, showColorbar=True, showPowerProfile=True) | |||
|
51 | ||||
|
52 | ################################################################################### | |||
|
53 | #time.sleep( 2 ) | |||
|
54 | self.writerObj.putData() | |||
|
55 | ################################################################################### | |||
|
56 | ||||
|
57 | if self.readerObj.flagNoMoreFiles: | |||
|
58 | break | |||
|
59 | ||||
|
60 | if self.readerObj.flagIsNewBlock and self.readerObj.nReadBlocks: | |||
|
61 | print 'Block No %04d, Time: %s' %(self.readerObj.nReadBlocks, | |||
|
62 | datetime.datetime.fromtimestamp(self.readerObj.m_BasicHeader.utc)) | |||
|
63 | #=============================================================== | |||
|
64 | # fin = time.time() | |||
|
65 | # print 'Tiempo de un bloque leido y escrito: [%6.5f]' %(fin - ini) | |||
|
66 | # ini = time.time() | |||
|
67 | #=============================================================== | |||
|
68 | ||||
|
69 | #time.sleep(0.5) | |||
|
70 | self.plotObj.end() | |||
|
71 | ||||
|
72 | if __name__ == '__main__': | |||
|
73 | TestSChain() No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now