@@ -1,7 +1,7 | |||||
1 | import os |
|
1 | import os | |
2 | import datetime |
|
2 | import datetime | |
3 | import numpy |
|
3 | import numpy | |
4 |
|
4 | import inspect | ||
5 | from figure import Figure, isRealtime, isTimeInHourRange |
|
5 | from figure import Figure, isRealtime, isTimeInHourRange | |
6 | from plotting_codes import * |
|
6 | from plotting_codes import * | |
7 |
|
7 | |||
@@ -642,7 +642,6 class ParametersPlot(Figure): | |||||
642 | save=False, figpath='./', lastone=0,figfile=None, ftp=False, wr_period=1, show=True, |
|
642 | save=False, figpath='./', lastone=0,figfile=None, ftp=False, wr_period=1, show=True, | |
643 | server=None, folder=None, username=None, password=None, |
|
643 | server=None, folder=None, username=None, password=None, | |
644 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): |
|
644 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): | |
645 |
|
||||
646 | """ |
|
645 | """ | |
647 |
|
646 | |||
648 | Input: |
|
647 | Input: | |
@@ -792,7 +791,7 class Parameters1Plot(Figure): | |||||
792 | self.__nsubplots = 1 |
|
791 | self.__nsubplots = 1 | |
793 |
|
792 | |||
794 | self.WIDTH = 800 |
|
793 | self.WIDTH = 800 | |
795 |
self.HEIGHT = 1 |
|
794 | self.HEIGHT = 180 | |
796 | self.WIDTHPROF = 120 |
|
795 | self.WIDTHPROF = 120 | |
797 | self.HEIGHTPROF = 0 |
|
796 | self.HEIGHTPROF = 0 | |
798 | self.counter_imagwr = 0 |
|
797 | self.counter_imagwr = 0 | |
@@ -857,7 +856,7 class Parameters1Plot(Figure): | |||||
857 | save=False, figpath='./', lastone=0,figfile=None, ftp=False, wr_period=1, show=True, |
|
856 | save=False, figpath='./', lastone=0,figfile=None, ftp=False, wr_period=1, show=True, | |
858 | server=None, folder=None, username=None, password=None, |
|
857 | server=None, folder=None, username=None, password=None, | |
859 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): |
|
858 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): | |
860 |
|
859 | #print inspect.getargspec(self.run).args | ||
861 | """ |
|
860 | """ | |
862 |
|
861 | |||
863 | Input: |
|
862 | Input: |
@@ -3,6 +3,30 | |||||
3 | $Author: murco $ |
|
3 | $Author: murco $ | |
4 | $Id: jroproc_base.py 1 2012-11-12 18:56:07Z murco $ |
|
4 | $Id: jroproc_base.py 1 2012-11-12 18:56:07Z murco $ | |
5 | ''' |
|
5 | ''' | |
|
6 | import inspect | |||
|
7 | from fuzzywuzzy import process | |||
|
8 | ||||
|
9 | def checkKwargs(method, kwargs): | |||
|
10 | currentKwargs = kwargs | |||
|
11 | choices = inspect.getargspec(method).args | |||
|
12 | try: | |||
|
13 | choices.remove('self') | |||
|
14 | except Exception as e: | |||
|
15 | pass | |||
|
16 | ||||
|
17 | try: | |||
|
18 | choices.remove('dataOut') | |||
|
19 | except Exception as e: | |||
|
20 | pass | |||
|
21 | ||||
|
22 | for kwarg in kwargs: | |||
|
23 | fuzz = process.extractOne(kwarg, choices) | |||
|
24 | print fuzz | |||
|
25 | if fuzz is None: | |||
|
26 | continue | |||
|
27 | if fuzz[1] < 100: | |||
|
28 | raise Exception('\x1b[2;30;43mDid you mean {} instead of {} in {}? \x1b[0m'. | |||
|
29 | format(fuzz[0], kwarg, method.__self__.__class__.__name__)) | |||
6 |
|
30 | |||
7 | class ProcessingUnit(object): |
|
31 | class ProcessingUnit(object): | |
8 |
|
32 | |||
@@ -41,14 +65,18 class ProcessingUnit(object): | |||||
41 |
|
65 | |||
42 | self.args = args |
|
66 | self.args = args | |
43 | self.kwargs = kwargs |
|
67 | self.kwargs = kwargs | |
|
68 | checkKwargs(self.run, kwargs) | |||
|
69 | ||||
|
70 | def getAllowedArgs(self): | |||
|
71 | return inspect.getargspec(self.run).args | |||
44 |
|
72 | |||
45 | def addOperationKwargs(self, objId, **kwargs): |
|
73 | def addOperationKwargs(self, objId, **kwargs): | |
46 | ''' |
|
74 | ''' | |
47 | ''' |
|
75 | ''' | |
48 |
|
76 | |||
49 | self.operationKwargs[objId] = kwargs |
|
77 | self.operationKwargs[objId] = kwargs | |
50 |
|
78 | |||
51 |
|
79 | |||
52 | def addOperation(self, opObj, objId): |
|
80 | def addOperation(self, opObj, objId): | |
53 |
|
81 | |||
54 | """ |
|
82 | """ | |
@@ -117,16 +145,16 class ProcessingUnit(object): | |||||
117 | #Executing the self method |
|
145 | #Executing the self method | |
118 |
|
146 | |||
119 | if hasattr(self, 'mp'): |
|
147 | if hasattr(self, 'mp'): | |
120 |
if name=='run': |
|
148 | if name=='run': | |
121 |
if self.mp is False: |
|
149 | if self.mp is False: | |
122 | self.mp = True |
|
150 | self.mp = True | |
123 | self.start() |
|
151 | self.start() | |
124 |
else: |
|
152 | else: | |
125 |
methodToCall(**self.operationKwargs[opId]) |
|
153 | methodToCall(**self.operationKwargs[opId]) | |
126 | else: |
|
154 | else: | |
127 |
if name=='run': |
|
155 | if name=='run': | |
128 | methodToCall(**self.kwargs) |
|
156 | methodToCall(**self.kwargs) | |
129 |
else: |
|
157 | else: | |
130 | methodToCall(**self.operationKwargs[opId]) |
|
158 | methodToCall(**self.operationKwargs[opId]) | |
131 |
|
159 | |||
132 | if self.dataOut is None: |
|
160 | if self.dataOut is None: | |
@@ -280,6 +308,10 class Operation(object): | |||||
280 | self.__buffer = None |
|
308 | self.__buffer = None | |
281 | self.isConfig = False |
|
309 | self.isConfig = False | |
282 | self.kwargs = kwargs |
|
310 | self.kwargs = kwargs | |
|
311 | checkKwargs(self.run, kwargs) | |||
|
312 | ||||
|
313 | def getAllowedArgs(self): | |||
|
314 | return inspect.getargspec(self.run).args | |||
283 |
|
315 | |||
284 | def setup(self): |
|
316 | def setup(self): | |
285 |
|
317 |
@@ -11,11 +11,11 def fiber(cursor, skip, q, dt): | |||||
11 | controllerObj.setup(id='191', name='test01', description=desc) |
|
11 | controllerObj.setup(id='191', name='test01', description=desc) | |
12 |
|
12 | |||
13 | readUnitConfObj = controllerObj.addReadUnit(datatype='SpectraReader', |
|
13 | readUnitConfObj = controllerObj.addReadUnit(datatype='SpectraReader', | |
14 |
path='/home/nanosat/data/ |
|
14 | path='/home/nanosat/data/julia', | |
15 | startDate=dt, |
|
15 | startDate=dt, | |
16 | endDate=dt, |
|
16 | endDate=dt, | |
17 | startTime="00:00:00", |
|
17 | startTime="00:00:00", | |
18 |
endTi |
|
18 | endTie="23:59:59", | |
19 | online=0, |
|
19 | online=0, | |
20 | #set=1426485881, |
|
20 | #set=1426485881, | |
21 | delay=10, |
|
21 | delay=10, | |
@@ -29,8 +29,8 def fiber(cursor, skip, q, dt): | |||||
29 | # #opObj11 = readUnitConfObj.addOperation(name='printNumberOfBlock') |
|
29 | # #opObj11 = readUnitConfObj.addOperation(name='printNumberOfBlock') | |
30 | # |
|
30 | # | |
31 | procUnitConfObj2 = controllerObj.addProcUnit(datatype='Spectra', inputId=readUnitConfObj.getId()) |
|
31 | procUnitConfObj2 = controllerObj.addProcUnit(datatype='Spectra', inputId=readUnitConfObj.getId()) | |
32 |
# |
|
32 | # procUnitConfObj2.addParameter(name='nipp', value='5', format='int') | |
33 | # |
|
33 | ||
34 | procUnitConfObj3 = controllerObj.addProcUnit(datatype='ParametersProc', inputId=readUnitConfObj.getId()) |
|
34 | procUnitConfObj3 = controllerObj.addProcUnit(datatype='ParametersProc', inputId=readUnitConfObj.getId()) | |
35 | opObj11 = procUnitConfObj3.addOperation(name='SpectralMoments', optype='other') |
|
35 | opObj11 = procUnitConfObj3.addOperation(name='SpectralMoments', optype='other') | |
36 |
|
36 | |||
@@ -44,10 +44,19 def fiber(cursor, skip, q, dt): | |||||
44 | # opObj11.addParameter(name='save', value='1', format='int') |
|
44 | # opObj11.addParameter(name='save', value='1', format='int') | |
45 | # opObj11.addParameter(name='figpath', value=figpath, format='str') |
|
45 | # opObj11.addParameter(name='figpath', value=figpath, format='str') | |
46 |
|
46 | |||
47 |
|
|
47 | opObj11 = procUnitConfObj3.addOperation(name='Parameters1Plot', optype='other') | |
48 |
|
|
48 | opObj11.addParameter(name='channelList', value='0', format='intList') | |
49 | # opObj11.addParameter(name='wintitzmaxle', value='HF_Jicamarca', format='str') |
|
49 | ||
50 |
|
|
50 | opObj11.addParameter(name='id', value='2000', format='int') | |
|
51 | # opObj11.addParameter(name='colormap', value='0', format='bool') | |||
|
52 | opObj11.addParameter(name='onlySNR', value='1', format='bool') | |||
|
53 | opObj11.addParameter(name='DOP', value='0', format='bool') | |||
|
54 | # opObj11.addParameter(name='showSNR', value='1', format='bool') | |||
|
55 | # opObj11.addParameter(name='SNRthresh', value='0', format='int') | |||
|
56 | # opObj11.addParameter(name='SNRmin', value='-10', format='int') | |||
|
57 | # opObj11.addParameter(name='SNRmax', value='30', format='int') | |||
|
58 | ||||
|
59 | # opObj11.addParameter(name='showSNR', value='1', format='int') | |||
51 | # # opObj11.addParameter(name='channelList', value='0', format='intlist') |
|
60 | # # opObj11.addParameter(name='channelList', value='0', format='intlist') | |
52 | # # opObj11.addParameter(name='xmin', value='0', format='float') |
|
61 | # # opObj11.addParameter(name='xmin', value='0', format='float') | |
53 | # opObj11.addParameter(name='xmin', value='0', format='float') |
|
62 | # opObj11.addParameter(name='xmin', value='0', format='float') |
@@ -1,1 +1,1 | |||||
1 |
<Project description="HF_EXAMPLE" id="191" name="test01"><ReadUnit datatype="SpectraReader" id="1911" inputId="0" name="SpectraReader"><Operation id="19111" name="run" priority="1" type="self"><Parameter format="str" id="191111" name="datatype" value="SpectraReader" /><Parameter format="str" id="191112" name="path" value="/home/nanosat/data/ |
|
1 | <Project description="HF_EXAMPLE" id="191" name="test01"><ReadUnit datatype="SpectraReader" id="1911" inputId="0" name="SpectraReader"><Operation id="19111" name="run" priority="1" type="self"><Parameter format="str" id="191111" name="datatype" value="SpectraReader" /><Parameter format="str" id="191112" name="path" value="/home/nanosat/data/julia" /><Parameter format="date" id="191113" name="startDate" value="2015/09/26" /><Parameter format="date" id="191114" name="endDate" value="2015/09/26" /><Parameter format="time" id="191115" name="startTime" value="00:00:00" /><Parameter format="time" id="191116" name="endTime" value="23:59:59" /><Parameter format="int" id="191118" name="cursor" value="0" /><Parameter format="int" id="191119" name="skip" value="0" /><Parameter format="int" id="191120" name="delay" value="10" /><Parameter format="int" id="191121" name="walk" value="1" /><Parameter format="int" id="191122" name="online" value="0" /></Operation></ReadUnit><ProcUnit datatype="ParametersProc" id="1913" inputId="1911" name="ParametersProc"><Operation id="19131" name="run" priority="1" type="self" /><Operation id="19132" name="SpectralMoments" priority="2" type="other" /><Operation id="19133" name="Parameters1Plot" priority="3" type="other"><Parameter format="intlist" id="191331" name="channelList" value="0" /><Parameter format="int" id="191332" name="id" value="2000" /><Parameter format="bool" id="191333" name="olySNR" value="1" /><Parameter format="bool" id="191334" name="DOP" value="0" /></Operation><Operation id="19134" name="PublishData" priority="4" type="other"><Parameter format="int" id="191341" name="zeromq" value="1" /><Parameter format="int" id="191342" name="delay" value="1" /></Operation></ProcUnit><ProcUnit datatype="Spectra" id="1912" inputId="1911" name="SpectraProc"><Operation id="19121" name="run" priority="1" type="self" /></ProcUnit></Project> No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now