@@ -70,9 +70,9 PREFIX = 'experiment' | |||||
70 | @click.argument('command', default='run', required=True) |
|
70 | @click.argument('command', default='run', required=True) | |
71 | @click.argument('nextcommand', default=None, required=False, type=str) |
|
71 | @click.argument('nextcommand', default=None, required=False, type=str) | |
72 | def main(command, nextcommand, version): |
|
72 | def main(command, nextcommand, version): | |
73 | """COMMAND LINE INTERFACE FOR SIGNAL CHAIN - JICAMARCA RADIO OBSERVATORY \n |
|
73 | """COMMAND LINE INTERFACE FOR SIGNAL CHAIN - JICAMARCA RADIO OBSERVATORY V3.0\n | |
74 | Available commands.\n |
|
74 | Available commands.\n | |
75 |
|
|
75 | xml: runs a schain XML generated file\n | |
76 | run: runs any python script starting 'experiment_'\n |
|
76 | run: runs any python script starting 'experiment_'\n | |
77 | generate: generates a template schain script\n |
|
77 | generate: generates a template schain script\n | |
78 | search: return avilable operations, procs or arguments of the give operation/proc\n""" |
|
78 | search: return avilable operations, procs or arguments of the give operation/proc\n""" | |
@@ -153,16 +153,24 def runschain(nextcommand): | |||||
153 |
|
153 | |||
154 | def basicInputs(): |
|
154 | def basicInputs(): | |
155 | inputs = {} |
|
155 | inputs = {} | |
156 | inputs['desc'] = click.prompt( |
|
|||
157 | 'Enter a description', default="A schain project", type=str) |
|
|||
158 | inputs['name'] = click.prompt( |
|
156 | inputs['name'] = click.prompt( | |
159 | 'Name of the project', default="project", type=str) |
|
157 | 'Name of the project', default="project", type=str) | |
|
158 | inputs['desc'] = click.prompt( | |||
|
159 | 'Enter a description', default="A schain project", type=str) | |||
|
160 | inputs['multiprocess'] = click.prompt( | |||
|
161 | '''Select data type: | |||
|
162 | ||||
|
163 | - Voltage (*.r): [1] | |||
|
164 | - Spectra (*.pdata): [2] | |||
|
165 | - Voltage and Spectra (*.r): [3] | |||
|
166 | ||||
|
167 | -->''', type=int) | |||
160 | inputs['path'] = click.prompt('Data path', default=os.getcwd( |
|
168 | inputs['path'] = click.prompt('Data path', default=os.getcwd( | |
161 | ), type=click.Path(exists=True, resolve_path=True)) |
|
169 | ), type=click.Path(exists=True, resolve_path=True)) | |
162 | inputs['startDate'] = click.prompt( |
|
170 | inputs['startDate'] = click.prompt( | |
163 | 'Start date', default='1970/01/01', type=str) |
|
171 | 'Start date', default='1970/01/01', type=str) | |
164 | inputs['endDate'] = click.prompt( |
|
172 | inputs['endDate'] = click.prompt( | |
165 |
'End date', default='201 |
|
173 | 'End date', default='2018/12/31', type=str) | |
166 | inputs['startHour'] = click.prompt( |
|
174 | inputs['startHour'] = click.prompt( | |
167 | 'Start hour', default='00:00:00', type=str) |
|
175 | 'Start hour', default='00:00:00', type=str) | |
168 | inputs['endHour'] = click.prompt('End hour', default='23:59:59', type=str) |
|
176 | inputs['endHour'] = click.prompt('End hour', default='23:59:59', type=str) | |
@@ -172,13 +180,13 def basicInputs(): | |||||
172 |
|
180 | |||
173 | def generate(): |
|
181 | def generate(): | |
174 | inputs = basicInputs() |
|
182 | inputs = basicInputs() | |
175 | inputs['multiprocess'] = click.confirm('Is this a multiprocess script?') |
|
183 | ||
176 | if inputs['multiprocess']: |
|
184 | if inputs['multiprocess'] == 1: | |
177 | inputs['nProcess'] = click.prompt( |
|
185 | current = templates.voltage.format(**inputs) | |
178 | 'How many process?', default=cpu_count(), type=int) |
|
186 | elif inputs['multiprocess'] == 2: | |
179 |
current = templates. |
|
187 | current = templates.spectra.format(**inputs) | |
180 | else: |
|
188 | elif inputs['multiprocess'] == 3: | |
181 |
current = templates. |
|
189 | current = templates.voltagespectra.format(**inputs) | |
182 | scriptname = '{}_{}.py'.format(PREFIX, inputs['name']) |
|
190 | scriptname = '{}_{}.py'.format(PREFIX, inputs['name']) | |
183 | script = open(scriptname, 'w') |
|
191 | script = open(scriptname, 'w') | |
184 | try: |
|
192 | try: |
@@ -1,10 +1,13 | |||||
1 | basic = '''from schainpy.controller import Project |
|
1 | voltage = '''import os, sys, time | |
|
2 | from schainpy.controller import Project | |||
2 |
|
3 | |||
|
4 | ||||
|
5 | def main(): | |||
3 | desc = "{desc}" |
|
6 | desc = "{desc}" | |
4 |
|
|
7 | controller = Project() | |
5 |
|
|
8 | controller.setup(id='200', name="{name}", description=desc) | |
6 |
|
9 | |||
7 |
|
|
10 | read_unit = controller.addReadUnit(datatype='Voltage', | |
8 | path="{path}", |
|
11 | path="{path}", | |
9 | startDate="{startDate}", |
|
12 | startDate="{startDate}", | |
10 | endDate="{endDate}", |
|
13 | endDate="{endDate}", | |
@@ -12,27 +15,203 voltage_reader = project.addReadUnit(datatype='VoltageReader', | |||||
12 | endTime="{endHour}", |
|
15 | endTime="{endHour}", | |
13 | online=0, |
|
16 | online=0, | |
14 | verbose=1, |
|
17 | verbose=1, | |
15 |
|
|
18 | walk=0, | |
|
19 | delay=180, | |||
16 | ) |
|
20 | ) | |
17 |
|
21 | |||
18 | voltage_proc = project.addProcUnit(datatype='VoltageProc', inputId=voltage_reader.getId()) |
|
22 | code = '[[1, 1, -1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1]]' | |
|
23 | nCode = '128' | |||
|
24 | nBaud = '3' | |||
|
25 | ||||
|
26 | ||||
|
27 | proc_voltage = controller.addProcUnit(name='VoltageProc', inputId=read_unit.getId()) | |||
|
28 | ||||
|
29 | op1 = proc_voltage.addOperation(name='selectChannels', optype='self') | |||
|
30 | op1.addParameter(name='channelList', value='0, 1, 2, 3', format='intlist') | |||
|
31 | ||||
|
32 | op2 = proc_voltage.addOperation(name='filterByHeights', optype='self') | |||
|
33 | op2.addParameter(name='window', value='4', format='int') | |||
|
34 | ||||
|
35 | op3 = proc_voltage.addOperation(name='ProfileSelector', optype='other') | |||
|
36 | op3.addParameter(name='profileRangeList', value='32, 159', format='intList') | |||
|
37 | ||||
|
38 | op4 = proc_voltage.addOperation(name='Decoder', optype='other') | |||
|
39 | op4.addParameter(name='code', value=code, format='intlist') | |||
|
40 | op4.addParameter(name='nCode', value=nCode, format='int') | |||
|
41 | op4.addParameter(name='nBaud', value=nBaud, format='int') | |||
|
42 | op4.addParameter(name='mode', value='0', format='int') | |||
|
43 | ||||
|
44 | op5 = proc_voltage.addOperation(name='Scope', optype='external') | |||
|
45 | op5.addParameter(name='id', value='30', format='int') | |||
|
46 | ||||
19 |
|
47 | |||
20 | profile = voltage_proc.addOperation(name='ProfileSelector', optype='other') |
|
|||
21 | profile.addParameter(name='profileRangeList', value='120,183', format='intlist') |
|
|||
22 |
|
48 | |||
23 | rti = voltage_proc.addOperation(name='RTIPlot', optype='other') |
|
|||
24 | rti.addParameter(name='wintitle', value='Jicamarca Radio Observatory', format='str') |
|
|||
25 | rti.addParameter(name='showprofile', value='0', format='int') |
|
|||
26 | rti.addParameter(name='xmin', value='0', format='int') |
|
|||
27 | rti.addParameter(name='xmax', value='24', format='int') |
|
|||
28 | rti.addParameter(name='figpath', value="{figpath}", format='str') |
|
|||
29 | rti.addParameter(name='wr_period', value='5', format='int') |
|
|||
30 | rti.addParameter(name='exp_code', value='22', format='int') |
|
|||
31 |
|
49 | |||
32 |
|
50 | |||
33 | project.start() |
|
51 | controller.start() | |
|
52 | ||||
|
53 | if __name__ == '__main__': | |||
|
54 | import time | |||
|
55 | start_time = time.time() | |||
|
56 | main() | |||
|
57 | print("--- %s seconds ---" % (time.time() - start_time)) | |||
|
58 | ||||
34 | ''' |
|
59 | ''' | |
35 |
|
60 | |||
|
61 | ||||
|
62 | spectra = '''import os, sys, time | |||
|
63 | from schainpy.controller import Project | |||
|
64 | ||||
|
65 | ||||
|
66 | def main(): | |||
|
67 | desc = "{desc}" | |||
|
68 | controller = Project() | |||
|
69 | controller.setup(id='300', name="{name}", description=desc) | |||
|
70 | ||||
|
71 | read_unit = controller.addReadUnit(datatype='Spectra', | |||
|
72 | path="{path}", | |||
|
73 | startDate="{startDate}", | |||
|
74 | endDate="{endDate}", | |||
|
75 | startTime="{startHour}", | |||
|
76 | endTime="{endHour}", | |||
|
77 | online=0, | |||
|
78 | verbose=1, | |||
|
79 | walk=0, | |||
|
80 | delay=180, | |||
|
81 | ) | |||
|
82 | ||||
|
83 | proc_spectra = controller.addProcUnit(datatype='Spectra', inputId=read_unit.getId()) | |||
|
84 | proc_spectra.addParameter(name='nFFTPoints', value='128', format='int') | |||
|
85 | proc_spectra.addParameter(name='nProfiles', value='128', format='int') | |||
|
86 | proc_spectra.addParameter(name='pairsList', value='(0, 1), (2, 3)', format='pairslist') | |||
|
87 | ||||
|
88 | op1 = proc_spectra.addOperation(name='IncohInt', optype='other') | |||
|
89 | op1.addParameter(name='n', value='4', format='int') | |||
|
90 | ||||
|
91 | op2 = proc_spectra.addOperation(name='CrossSpectraPlot', optype='external') | |||
|
92 | op2.addParameter(name='id', value='10', format='int') | |||
|
93 | op2.addParameter(name='zmin', value='10.0', format='float') | |||
|
94 | op2.addParameter(name='zmax', value='35.0', format='float') | |||
|
95 | ||||
|
96 | ||||
|
97 | op3 = proc_spectra.addOperation(name='RTIPlot', optype='external') | |||
|
98 | op3.addParameter(name='id', value='20', format='int') | |||
|
99 | op3.addParameter(name='wintitle', value='RTI', format='str') | |||
|
100 | op3.addParameter(name='xmin', value='0', format='float') | |||
|
101 | op3.addParameter(name='xmax', value='24', format='float') | |||
|
102 | op3.addParameter(name='zmin', value='12', format='int') | |||
|
103 | op3.addParameter(name='zmax', value='32', format='int') | |||
|
104 | op3.addParameter(name='showprofile', value='1', format='int') | |||
|
105 | op3.addParameter(name='timerange', value=str(24*60*60), format='int') | |||
|
106 | ||||
|
107 | op4 = proc_spectra.addOperation(name='CoherenceMap', optype='external') | |||
|
108 | op4.addParameter(name='id', value='30', format='int') | |||
|
109 | op4.addParameter(name='xmin', value='0.0', format='float') | |||
|
110 | op4.addParameter(name='xmax', value='24.0', format='float') | |||
|
111 | ||||
|
112 | ||||
|
113 | controller.start() | |||
|
114 | ||||
|
115 | if __name__ == '__main__': | |||
|
116 | import time | |||
|
117 | start_time = time.time() | |||
|
118 | main() | |||
|
119 | print("--- %s seconds ---" % (time.time() - start_time)) | |||
|
120 | ||||
|
121 | ''' | |||
|
122 | ||||
|
123 | voltagespectra = '''import os, sys, time | |||
|
124 | from schainpy.controller import Project | |||
|
125 | ||||
|
126 | ||||
|
127 | def main(): | |||
|
128 | desc = "{desc}" | |||
|
129 | controller = Project() | |||
|
130 | controller.setup(id='400', name="{name}", description=desc) | |||
|
131 | ||||
|
132 | read_unit = controller.addReadUnit(datatype='Voltage', | |||
|
133 | path="{path}", | |||
|
134 | startDate="{startDate}", | |||
|
135 | endDate="{endDate}", | |||
|
136 | startTime="{startHour}", | |||
|
137 | endTime="{endHour}", | |||
|
138 | online=0, | |||
|
139 | verbose=1, | |||
|
140 | walk=0, | |||
|
141 | delay=180, | |||
|
142 | ) | |||
|
143 | ||||
|
144 | code = '[[1, 1, -1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1]]' | |||
|
145 | nCode = '128' | |||
|
146 | nBaud = '3' | |||
|
147 | ||||
|
148 | ||||
|
149 | proc_voltage = controller.addProcUnit(name='VoltageProc', inputId=read_unit.getId()) | |||
|
150 | ||||
|
151 | op1 = proc_voltage.addOperation(name='selectChannels', optype='self') | |||
|
152 | op1.addParameter(name='channelList', value='0, 1, 2, 3', format='intlist') | |||
|
153 | ||||
|
154 | op2 = proc_voltage.addOperation(name='filterByHeights', optype='self') | |||
|
155 | op2.addParameter(name='window', value='4', format='int') | |||
|
156 | ||||
|
157 | op3 = proc_voltage.addOperation(name='ProfileSelector', optype='other') | |||
|
158 | op3.addParameter(name='profileRangeList', value='32, 159', format='intList') | |||
|
159 | ||||
|
160 | op4 = proc_voltage.addOperation(name='Decoder', optype='other') | |||
|
161 | op4.addParameter(name='code', value=code, format='intlist') | |||
|
162 | op4.addParameter(name='nCode', value=nCode, format='int') | |||
|
163 | op4.addParameter(name='nBaud', value=nBaud, format='int') | |||
|
164 | op4.addParameter(name='mode', value='0', format='int') | |||
|
165 | ||||
|
166 | ||||
|
167 | ||||
|
168 | proc_spectra = controller.addProcUnit(datatype='Spectra', inputId=proc_voltage.getId()) | |||
|
169 | proc_spectra.addParameter(name='nFFTPoints', value='128', format='int') | |||
|
170 | proc_spectra.addParameter(name='nProfiles', value='128', format='int') | |||
|
171 | proc_spectra.addParameter(name='pairsList', value='(0, 1), (2, 3)', format='pairslist') | |||
|
172 | ||||
|
173 | op5 = proc_spectra.addOperation(name='IncohInt', optype='other') | |||
|
174 | op5.addParameter(name='n', value='4', format='int') | |||
|
175 | ||||
|
176 | op6 = proc_spectra.addOperation(name='CrossSpectraPlot', optype='external') | |||
|
177 | op6.addParameter(name='id', value='10', format='int') | |||
|
178 | op6.addParameter(name='zmin', value='10.0', format='float') | |||
|
179 | op6.addParameter(name='zmax', value='35.0', format='float') | |||
|
180 | ||||
|
181 | ||||
|
182 | op7 = proc_spectra.addOperation(name='RTIPlot', optype='external') | |||
|
183 | op7.addParameter(name='id', value='20', format='int') | |||
|
184 | op7.addParameter(name='wintitle', value='RTI', format='str') | |||
|
185 | op7.addParameter(name='xmin', value='0', format='float') | |||
|
186 | op7.addParameter(name='xmax', value='24', format='float') | |||
|
187 | op7.addParameter(name='zmin', value='12', format='int') | |||
|
188 | op7.addParameter(name='zmax', value='32', format='int') | |||
|
189 | op7.addParameter(name='showprofile', value='1', format='int') | |||
|
190 | op7.addParameter(name='timerange', value=str(24*60*60), format='int') | |||
|
191 | ||||
|
192 | op8 = proc_spectra.addOperation(name='CoherenceMap', optype='external') | |||
|
193 | op8.addParameter(name='id', value='30', format='int') | |||
|
194 | op8.addParameter(name='xmin', value='0.0', format='float') | |||
|
195 | op8.addParameter(name='xmax', value='24.0', format='float') | |||
|
196 | ||||
|
197 | ||||
|
198 | controller.start() | |||
|
199 | ||||
|
200 | if __name__ == '__main__': | |||
|
201 | import time | |||
|
202 | start_time = time.time() | |||
|
203 | main() | |||
|
204 | print("--- %s seconds ---" % (time.time() - start_time)) | |||
|
205 | ||||
|
206 | ''' | |||
|
207 | ||||
|
208 | ||||
|
209 | ||||
|
210 | ||||
|
211 | ||||
|
212 | ||||
|
213 | ||||
|
214 | ||||
36 | multiprocess = '''from schainpy.controller import Project, MPProject |
|
215 | multiprocess = '''from schainpy.controller import Project, MPProject | |
37 | from time import sleep |
|
216 | from time import sleep | |
38 | desc = "{desc}" |
|
217 | desc = "{desc}" | |
@@ -61,10 +240,10 sleep(2) | |||||
61 | ################ |
|
240 | ################ | |
62 | # DATA EMITTER # |
|
241 | # DATA EMITTER # | |
63 | ################ |
|
242 | ################ | |
64 |
|
|
243 | controller = Project() | |
65 |
|
|
244 | controller.setup(id='200', name="{name}", description=desc) | |
66 |
|
245 | |||
67 |
spectra_reader = |
|
246 | spectra_reader = controller.addReadUnit(datatype='SpectraReader', | |
68 | path="{path}", |
|
247 | path="{path}", | |
69 | startDate={startDate}, |
|
248 | startDate={startDate}, | |
70 | endDate={endDate}, |
|
249 | endDate={endDate}, | |
@@ -75,16 +254,16 spectra_reader = project.addReadUnit(datatype='SpectraReader', | |||||
75 | walk=1, |
|
254 | walk=1, | |
76 | ) |
|
255 | ) | |
77 |
|
256 | |||
78 |
spectra_proc = |
|
257 | spectra_proc = controller.addProcUnit(datatype='Spectra', inputId=spectra_reader.getId()) | |
79 |
|
258 | |||
80 |
parameters_proc = |
|
259 | parameters_proc = controller.addProcUnit(datatype='ParametersProc', inputId=spectra_proc.getId()) | |
81 | moments = parameters_proc.addOperation(name='SpectralMoments', optype='other') |
|
260 | moments = parameters_proc.addOperation(name='SpectralMoments', optype='other') | |
82 |
|
261 | |||
83 | publish = parameters_proc.addOperation(name='PublishData', optype='other') |
|
262 | publish = parameters_proc.addOperation(name='PublishData', optype='other') | |
84 | publish.addParameter(name='zeromq', value=1, format='int') |
|
263 | publish.addParameter(name='zeromq', value=1, format='int') | |
85 | publish.addParameter(name='verbose', value=0, format='bool') |
|
264 | publish.addParameter(name='verbose', value=0, format='bool') | |
86 |
|
265 | |||
87 |
MPProject( |
|
266 | MPProject(controller, 16) | |
88 |
|
267 | |||
89 |
|
268 | |||
90 | ''' |
|
269 | ''' |
@@ -289,7 +289,7 class ParameterConf(): | |||||
289 |
|
289 | |||
290 | def printattr(self): |
|
290 | def printattr(self): | |
291 |
|
291 | |||
292 | print('Parameter[%s]: name = %s, value = %s, format = %s' % (self.id, self.name, self.value, self.format)) |
|
292 | print('Parameter[%s]: name = %s, value = %s, format = %s, project_id = %s' % (self.id, self.name, self.value, self.format, self.project_id)) | |
293 |
|
293 | |||
294 | class OperationConf(): |
|
294 | class OperationConf(): | |
295 |
|
295 | |||
@@ -422,12 +422,13 class OperationConf(): | |||||
422 | for parmConfObj in self.parmConfObjList: |
|
422 | for parmConfObj in self.parmConfObjList: | |
423 | parmConfObj.makeXml(opElement) |
|
423 | parmConfObj.makeXml(opElement) | |
424 |
|
424 | |||
425 | def readXml(self, opElement): |
|
425 | def readXml(self, opElement, project_id): | |
426 |
|
426 | |||
427 | self.id = opElement.get('id') |
|
427 | self.id = opElement.get('id') | |
428 | self.name = opElement.get('name') |
|
428 | self.name = opElement.get('name') | |
429 | self.type = opElement.get('type') |
|
429 | self.type = opElement.get('type') | |
430 | self.priority = opElement.get('priority') |
|
430 | self.priority = opElement.get('priority') | |
|
431 | self.project_id = str(project_id) #yong | |||
431 |
|
432 | |||
432 | # Compatible with old signal chain version |
|
433 | # Compatible with old signal chain version | |
433 | # Use of 'run' method instead 'init' |
|
434 | # Use of 'run' method instead 'init' | |
@@ -453,11 +454,12 class OperationConf(): | |||||
453 |
|
454 | |||
454 | def printattr(self): |
|
455 | def printattr(self): | |
455 |
|
456 | |||
456 | print('%s[%s]: name = %s, type = %s, priority = %s' % (self.ELEMENTNAME, |
|
457 | print('%s[%s]: name = %s, type = %s, priority = %s, project_id = %s' % (self.ELEMENTNAME, | |
457 | self.id, |
|
458 | self.id, | |
458 | self.name, |
|
459 | self.name, | |
459 | self.type, |
|
460 | self.type, | |
460 |
self.priority |
|
461 | self.priority, | |
|
462 | self.project_id)) | |||
461 |
|
463 | |||
462 | for parmConfObj in self.parmConfObjList: |
|
464 | for parmConfObj in self.parmConfObjList: | |
463 | parmConfObj.printattr() |
|
465 | parmConfObj.printattr() | |
@@ -634,12 +636,13 class ProcUnitConf(): | |||||
634 | for opConfObj in self.opConfObjList: |
|
636 | for opConfObj in self.opConfObjList: | |
635 | opConfObj.makeXml(procUnitElement) |
|
637 | opConfObj.makeXml(procUnitElement) | |
636 |
|
638 | |||
637 | def readXml(self, upElement): |
|
639 | def readXml(self, upElement, project_id): | |
638 |
|
640 | |||
639 | self.id = upElement.get('id') |
|
641 | self.id = upElement.get('id') | |
640 | self.name = upElement.get('name') |
|
642 | self.name = upElement.get('name') | |
641 | self.datatype = upElement.get('datatype') |
|
643 | self.datatype = upElement.get('datatype') | |
642 | self.inputId = upElement.get('inputId') |
|
644 | self.inputId = upElement.get('inputId') | |
|
645 | self.project_id = str(project_id) | |||
643 |
|
646 | |||
644 | if self.ELEMENTNAME == 'ReadUnit': |
|
647 | if self.ELEMENTNAME == 'ReadUnit': | |
645 | self.datatype = self.datatype.replace('Reader', '') |
|
648 | self.datatype = self.datatype.replace('Reader', '') | |
@@ -656,16 +659,17 class ProcUnitConf(): | |||||
656 |
|
659 | |||
657 | for opElement in opElementList: |
|
660 | for opElement in opElementList: | |
658 | opConfObj = OperationConf() |
|
661 | opConfObj = OperationConf() | |
659 | opConfObj.readXml(opElement) |
|
662 | opConfObj.readXml(opElement, project_id) | |
660 | self.opConfObjList.append(opConfObj) |
|
663 | self.opConfObjList.append(opConfObj) | |
661 |
|
664 | |||
662 | def printattr(self): |
|
665 | def printattr(self): | |
663 |
|
666 | |||
664 | print('%s[%s]: name = %s, datatype = %s, inputId = %s' % (self.ELEMENTNAME, |
|
667 | print('%s[%s]: name = %s, datatype = %s, inputId = %s, project_id = %s' % (self.ELEMENTNAME, | |
665 | self.id, |
|
668 | self.id, | |
666 | self.name, |
|
669 | self.name, | |
667 | self.datatype, |
|
670 | self.datatype, | |
668 |
self.inputId |
|
671 | self.inputId, | |
|
672 | self.project_id)) | |||
669 |
|
673 | |||
670 | for opConfObj in self.opConfObjList: |
|
674 | for opConfObj in self.opConfObjList: | |
671 | opConfObj.printattr() |
|
675 | opConfObj.printattr() | |
@@ -846,11 +850,12 class ReadUnitConf(ProcUnitConf): | |||||
846 |
|
850 | |||
847 | return opObj |
|
851 | return opObj | |
848 |
|
852 | |||
849 | def readXml(self, upElement): |
|
853 | def readXml(self, upElement, project_id): | |
850 |
|
854 | |||
851 | self.id = upElement.get('id') |
|
855 | self.id = upElement.get('id') | |
852 | self.name = upElement.get('name') |
|
856 | self.name = upElement.get('name') | |
853 | self.datatype = upElement.get('datatype') |
|
857 | self.datatype = upElement.get('datatype') | |
|
858 | self.project_id = str(project_id) #yong | |||
854 |
|
859 | |||
855 | if self.ELEMENTNAME == 'ReadUnit': |
|
860 | if self.ELEMENTNAME == 'ReadUnit': | |
856 | self.datatype = self.datatype.replace('Reader', '') |
|
861 | self.datatype = self.datatype.replace('Reader', '') | |
@@ -861,7 +866,7 class ReadUnitConf(ProcUnitConf): | |||||
861 |
|
866 | |||
862 | for opElement in opElementList: |
|
867 | for opElement in opElementList: | |
863 | opConfObj = OperationConf() |
|
868 | opConfObj = OperationConf() | |
864 | opConfObj.readXml(opElement) |
|
869 | opConfObj.readXml(opElement, project_id) | |
865 | self.opConfObjList.append(opConfObj) |
|
870 | self.opConfObjList.append(opConfObj) | |
866 |
|
871 | |||
867 | if opConfObj.name == 'run': |
|
872 | if opConfObj.name == 'run': | |
@@ -1109,7 +1114,7 class Project(Process): | |||||
1109 |
|
1114 | |||
1110 | for readUnitElement in readUnitElementList: |
|
1115 | for readUnitElement in readUnitElementList: | |
1111 | readUnitConfObj = ReadUnitConf() |
|
1116 | readUnitConfObj = ReadUnitConf() | |
1112 | readUnitConfObj.readXml(readUnitElement) |
|
1117 | readUnitConfObj.readXml(readUnitElement, self.id) | |
1113 | self.procUnitConfObjDict[readUnitConfObj.getId()] = readUnitConfObj |
|
1118 | self.procUnitConfObjDict[readUnitConfObj.getId()] = readUnitConfObj | |
1114 |
|
1119 | |||
1115 | procUnitElementList = self.projectElement.iter( |
|
1120 | procUnitElementList = self.projectElement.iter( | |
@@ -1117,7 +1122,7 class Project(Process): | |||||
1117 |
|
1122 | |||
1118 | for procUnitElement in procUnitElementList: |
|
1123 | for procUnitElement in procUnitElementList: | |
1119 | procUnitConfObj = ProcUnitConf() |
|
1124 | procUnitConfObj = ProcUnitConf() | |
1120 | procUnitConfObj.readXml(procUnitElement) |
|
1125 | procUnitConfObj.readXml(procUnitElement, self.id) | |
1121 | self.procUnitConfObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
1126 | self.procUnitConfObjDict[procUnitConfObj.getId()] = procUnitConfObj | |
1122 |
|
1127 | |||
1123 | self.filename = abs_file |
|
1128 | self.filename = abs_file | |
@@ -1126,9 +1131,10 class Project(Process): | |||||
1126 |
|
1131 | |||
1127 | def __str__(self): |
|
1132 | def __str__(self): | |
1128 |
|
1133 | |||
1129 | print('Project[%s]: name = %s, description = %s' % (self.id, |
|
1134 | print('Project[%s]: name = %s, description = %s, project_id = %s' % (self.id, | |
1130 | self.name, |
|
1135 | self.name, | |
1131 |
self.description |
|
1136 | self.description, | |
|
1137 | self.project_id)) | |||
1132 |
|
1138 | |||
1133 | for procUnitConfObj in self.procUnitConfObjDict.values(): |
|
1139 | for procUnitConfObj in self.procUnitConfObjDict.values(): | |
1134 | print(procUnitConfObj) |
|
1140 | print(procUnitConfObj) |
@@ -91,9 +91,9 class BLTRParamReader(JRODataReader, ProcessingUnit): | |||||
91 |
|
91 | |||
92 | ext = '.sswma' |
|
92 | ext = '.sswma' | |
93 |
|
93 | |||
94 |
def __init__(self |
|
94 | def __init__(self): | |
95 |
|
95 | |||
96 |
ProcessingUnit.__init__(self |
|
96 | ProcessingUnit.__init__(self) | |
97 |
|
97 | |||
98 | self.dataOut = Parameters() |
|
98 | self.dataOut = Parameters() | |
99 | self.counter_records = 0 |
|
99 | self.counter_records = 0 | |
@@ -245,7 +245,7 class BLTRParamReader(JRODataReader, ProcessingUnit): | |||||
245 | self.nranges = header_rec['nranges'][0] |
|
245 | self.nranges = header_rec['nranges'][0] | |
246 | self.fp.seek(pointer) |
|
246 | self.fp.seek(pointer) | |
247 | self.height = numpy.empty((self.nmodes, self.nranges)) |
|
247 | self.height = numpy.empty((self.nmodes, self.nranges)) | |
248 | self.snr = numpy.empty((self.nmodes, self.nchannels, self.nranges)) |
|
248 | self.snr = numpy.empty((self.nmodes, int(self.nchannels), self.nranges)) | |
249 | self.buffer = numpy.empty((self.nmodes, 3, self.nranges)) |
|
249 | self.buffer = numpy.empty((self.nmodes, 3, self.nranges)) | |
250 | self.flagDiscontinuousBlock = 0 |
|
250 | self.flagDiscontinuousBlock = 0 | |
251 |
|
251 | |||
@@ -267,9 +267,9 class BLTRParamReader(JRODataReader, ProcessingUnit): | |||||
267 |
|
267 | |||
268 | header_structure = numpy.dtype( |
|
268 | header_structure = numpy.dtype( | |
269 | REC_HEADER_STRUCTURE.descr + [ |
|
269 | REC_HEADER_STRUCTURE.descr + [ | |
270 | ('antenna_coord', 'f4', (2, self.nchannels)), |
|
270 | ('antenna_coord', 'f4', (2, int(self.nchannels))), | |
271 | ('rx_gains', 'u4', (self.nchannels,)), |
|
271 | ('rx_gains', 'u4', (int(self.nchannels),)), | |
272 | ('rx_analysis', 'u4', (self.nchannels,)) |
|
272 | ('rx_analysis', 'u4', (int(self.nchannels),)) | |
273 | ] |
|
273 | ] | |
274 | ) |
|
274 | ) | |
275 |
|
275 | |||
@@ -295,6 +295,7 class BLTRParamReader(JRODataReader, ProcessingUnit): | |||||
295 | status_value - Array data is set to NAN for values that are not equal to status_value |
|
295 | status_value - Array data is set to NAN for values that are not equal to status_value | |
296 |
|
296 | |||
297 | ''' |
|
297 | ''' | |
|
298 | self.nchannels = int(self.nchannels) | |||
298 |
|
299 | |||
299 | data_structure = numpy.dtype( |
|
300 | data_structure = numpy.dtype( | |
300 | DATA_STRUCTURE.descr + [ |
|
301 | DATA_STRUCTURE.descr + [ | |
@@ -365,3 +366,4 class BLTRParamReader(JRODataReader, ProcessingUnit): | |||||
365 | self.set_output() |
|
366 | self.set_output() | |
366 |
|
367 | |||
367 | return 1 |
|
368 | return 1 | |
|
369 | No newline at end of file |
@@ -76,12 +76,13 class BLTRParametersProc(ProcessingUnit): | |||||
76 | self.dataOut.data_param[i][SNRavgdB <= snr_threshold] = numpy.nan |
|
76 | self.dataOut.data_param[i][SNRavgdB <= snr_threshold] = numpy.nan | |
77 |
|
77 | |||
78 | # TODO |
|
78 | # TODO | |
|
79 | @MPDecorator | |||
79 | class OutliersFilter(Operation): |
|
80 | class OutliersFilter(Operation): | |
80 |
|
81 | |||
81 |
def __init__(self |
|
82 | def __init__(self): | |
82 | ''' |
|
83 | ''' | |
83 | ''' |
|
84 | ''' | |
84 |
Operation.__init__(self |
|
85 | Operation.__init__(self) | |
85 |
|
86 | |||
86 | def run(self, svalue2, method, factor, filter, npoints=9): |
|
87 | def run(self, svalue2, method, factor, filter, npoints=9): | |
87 | ''' |
|
88 | ''' |
@@ -136,6 +136,8 class SpectraProc(ProcessingUnit): | |||||
136 |
|
136 | |||
137 | if self.dataIn.type == "Voltage": |
|
137 | if self.dataIn.type == "Voltage": | |
138 |
|
138 | |||
|
139 | self.dataOut.flagNoData = True | |||
|
140 | ||||
139 | if nFFTPoints == None: |
|
141 | if nFFTPoints == None: | |
140 | raise ValueError("This SpectraProc.run() need nFFTPoints input variable") |
|
142 | raise ValueError("This SpectraProc.run() need nFFTPoints input variable") | |
141 |
|
143 | |||
@@ -943,7 +945,6 class IncohInt(Operation): | |||||
943 | dataOut.data_spc = avgdata_spc |
|
945 | dataOut.data_spc = avgdata_spc | |
944 | dataOut.data_cspc = avgdata_cspc |
|
946 | dataOut.data_cspc = avgdata_cspc | |
945 | dataOut.data_dc = avgdata_dc |
|
947 | dataOut.data_dc = avgdata_dc | |
946 |
|
||||
947 | dataOut.nIncohInt *= self.n |
|
948 | dataOut.nIncohInt *= self.n | |
948 | dataOut.utctime = avgdatatime |
|
949 | dataOut.utctime = avgdatatime | |
949 | dataOut.flagNoData = False |
|
950 | dataOut.flagNoData = False |
@@ -229,13 +229,13 class VoltageProc(ProcessingUnit): | |||||
229 | """ |
|
229 | """ | |
230 | Si la data es obtenida por bloques, dimension = [nChannels, nProfiles, nHeis] |
|
230 | Si la data es obtenida por bloques, dimension = [nChannels, nProfiles, nHeis] | |
231 | """ |
|
231 | """ | |
232 | buffer = self.dataOut.data[:, :, 0:self.dataOut.nHeights-r] |
|
232 | buffer = self.dataOut.data[:, :, 0:int(self.dataOut.nHeights-r)] | |
233 | buffer = buffer.reshape(self.dataOut.nChannels,self.dataOut.nProfiles,self.dataOut.nHeights/window,window) |
|
233 | buffer = buffer.reshape(self.dataOut.nChannels,self.dataOut.nProfiles,self.dataOut.nHeights/window,window) | |
234 | buffer = numpy.sum(buffer,3) |
|
234 | buffer = numpy.sum(buffer,3) | |
235 |
|
235 | |||
236 | else: |
|
236 | else: | |
237 | buffer = self.dataOut.data[:,0:self.dataOut.nHeights-r] |
|
237 | buffer = self.dataOut.data[:,0:int(self.dataOut.nHeights-r)] | |
238 | buffer = buffer.reshape(self.dataOut.nChannels,self.dataOut.nHeights/window,window) |
|
238 | buffer = buffer.reshape(self.dataOut.nChannels,int(self.dataOut.nHeights/window),int(window)) | |
239 | buffer = numpy.sum(buffer,2) |
|
239 | buffer = numpy.sum(buffer,2) | |
240 |
|
240 | |||
241 | self.dataOut.data = buffer |
|
241 | self.dataOut.data = buffer | |
@@ -799,7 +799,6 class ProfileConcat(Operation): | |||||
799 | self.start_index = self.start_index + self.nHeights |
|
799 | self.start_index = self.start_index + self.nHeights | |
800 |
|
800 | |||
801 | def run(self, dataOut, m): |
|
801 | def run(self, dataOut, m): | |
802 |
|
||||
803 | dataOut.flagNoData = True |
|
802 | dataOut.flagNoData = True | |
804 |
|
803 | |||
805 | if not self.isConfig: |
|
804 | if not self.isConfig: | |
@@ -908,7 +907,7 class ProfileSelector(Operation): | |||||
908 | dataOut.profileIndex = dataOut.nProfiles - 1 |
|
907 | dataOut.profileIndex = dataOut.nProfiles - 1 | |
909 | dataOut.flagNoData = False |
|
908 | dataOut.flagNoData = False | |
910 |
|
909 | |||
911 |
return |
|
910 | return dataOut | |
912 |
|
911 | |||
913 | """ |
|
912 | """ | |
914 | data dimension = [nChannels, nHeis] |
|
913 | data dimension = [nChannels, nHeis] | |
@@ -924,7 +923,7 class ProfileSelector(Operation): | |||||
924 | dataOut.flagNoData = False |
|
923 | dataOut.flagNoData = False | |
925 |
|
924 | |||
926 | self.incProfileIndex() |
|
925 | self.incProfileIndex() | |
927 |
return |
|
926 | return dataOut | |
928 |
|
927 | |||
929 | if profileRangeList != None: |
|
928 | if profileRangeList != None: | |
930 |
|
929 | |||
@@ -939,7 +938,7 class ProfileSelector(Operation): | |||||
939 | dataOut.flagNoData = False |
|
938 | dataOut.flagNoData = False | |
940 |
|
939 | |||
941 | self.incProfileIndex() |
|
940 | self.incProfileIndex() | |
942 |
return |
|
941 | return dataOut | |
943 |
|
942 | |||
944 | if rangeList != None: |
|
943 | if rangeList != None: | |
945 |
|
944 | |||
@@ -967,7 +966,7 class ProfileSelector(Operation): | |||||
967 |
|
966 | |||
968 | break |
|
967 | break | |
969 |
|
968 | |||
970 |
return |
|
969 | return dataOut | |
971 |
|
970 | |||
972 |
|
971 | |||
973 | if beam != None: #beam is only for AMISR data |
|
972 | if beam != None: #beam is only for AMISR data | |
@@ -977,7 +976,7 class ProfileSelector(Operation): | |||||
977 |
|
976 | |||
978 | self.incProfileIndex() |
|
977 | self.incProfileIndex() | |
979 |
|
978 | |||
980 |
return |
|
979 | return dataOut | |
981 |
|
980 | |||
982 | raise ValueError("ProfileSelector needs profileList, profileRangeList or rangeList parameter") |
|
981 | raise ValueError("ProfileSelector needs profileList, profileRangeList or rangeList parameter") | |
983 |
|
982 |
General Comments 0
You need to be logged in to leave comments.
Login now