@@ -70,9 +70,9 PREFIX = 'experiment' | |||
|
70 | 70 | @click.argument('command', default='run', required=True) |
|
71 | 71 | @click.argument('nextcommand', default=None, required=False, type=str) |
|
72 | 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 | 74 | Available commands.\n |
|
75 |
|
|
|
75 | xml: runs a schain XML generated file\n | |
|
76 | 76 | run: runs any python script starting 'experiment_'\n |
|
77 | 77 | generate: generates a template schain script\n |
|
78 | 78 | search: return avilable operations, procs or arguments of the give operation/proc\n""" |
@@ -153,16 +153,24 def runschain(nextcommand): | |||
|
153 | 153 | |
|
154 | 154 | def basicInputs(): |
|
155 | 155 | inputs = {} |
|
156 | inputs['desc'] = click.prompt( | |
|
157 | 'Enter a description', default="A schain project", type=str) | |
|
158 | 156 | inputs['name'] = click.prompt( |
|
159 | 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 | 168 | inputs['path'] = click.prompt('Data path', default=os.getcwd( |
|
161 | 169 | ), type=click.Path(exists=True, resolve_path=True)) |
|
162 | 170 | inputs['startDate'] = click.prompt( |
|
163 | 171 | 'Start date', default='1970/01/01', type=str) |
|
164 | 172 | inputs['endDate'] = click.prompt( |
|
165 |
'End date', default='201 |
|
|
173 | 'End date', default='2018/12/31', type=str) | |
|
166 | 174 | inputs['startHour'] = click.prompt( |
|
167 | 175 | 'Start hour', default='00:00:00', type=str) |
|
168 | 176 | inputs['endHour'] = click.prompt('End hour', default='23:59:59', type=str) |
@@ -172,13 +180,13 def basicInputs(): | |||
|
172 | 180 | |
|
173 | 181 | def generate(): |
|
174 | 182 | inputs = basicInputs() |
|
175 | inputs['multiprocess'] = click.confirm('Is this a multiprocess script?') | |
|
176 | if inputs['multiprocess']: | |
|
177 | inputs['nProcess'] = click.prompt( | |
|
178 | 'How many process?', default=cpu_count(), type=int) | |
|
179 |
current = templates. |
|
|
180 | else: | |
|
181 |
current = templates. |
|
|
183 | ||
|
184 | if inputs['multiprocess'] == 1: | |
|
185 | current = templates.voltage.format(**inputs) | |
|
186 | elif inputs['multiprocess'] == 2: | |
|
187 | current = templates.spectra.format(**inputs) | |
|
188 | elif inputs['multiprocess'] == 3: | |
|
189 | current = templates.voltagespectra.format(**inputs) | |
|
182 | 190 | scriptname = '{}_{}.py'.format(PREFIX, inputs['name']) |
|
183 | 191 | script = open(scriptname, 'w') |
|
184 | 192 | try: |
@@ -1,38 +1,217 | |||
|
1 | basic = '''from schainpy.controller import Project | |
|
1 | voltage = '''import os, sys, time | |
|
2 | from schainpy.controller import Project | |
|
3 | ||
|
4 | ||
|
5 | def main(): | |
|
6 | desc = "{desc}" | |
|
7 | controller = Project() | |
|
8 | controller.setup(id='200', name="{name}", description=desc) | |
|
9 | ||
|
10 | read_unit = controller.addReadUnit(datatype='Voltage', | |
|
11 | path="{path}", | |
|
12 | startDate="{startDate}", | |
|
13 | endDate="{endDate}", | |
|
14 | startTime="{startHour}", | |
|
15 | endTime="{endHour}", | |
|
16 | online=0, | |
|
17 | verbose=1, | |
|
18 | walk=0, | |
|
19 | delay=180, | |
|
20 | ) | |
|
21 | ||
|
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 | ||
|
47 | ||
|
48 | ||
|
49 | ||
|
50 | ||
|
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)) | |
|
2 | 58 | |
|
3 | desc = "{desc}" | |
|
4 | project = Project() | |
|
5 | project.setup(id='200', name="{name}", description=desc) | |
|
6 | ||
|
7 | voltage_reader = project.addReadUnit(datatype='VoltageReader', | |
|
8 | path="{path}", | |
|
9 | startDate="{startDate}", | |
|
10 | endDate="{endDate}", | |
|
11 | startTime="{startHour}", | |
|
12 | endTime="{endHour}", | |
|
13 | online=0, | |
|
14 | verbose=1, | |
|
15 | walk=1, | |
|
16 | ) | |
|
17 | ||
|
18 | voltage_proc = project.addProcUnit(datatype='VoltageProc', inputId=voltage_reader.getId()) | |
|
19 | ||
|
20 | profile = voltage_proc.addOperation(name='ProfileSelector', optype='other') | |
|
21 | profile.addParameter(name='profileRangeList', value='120,183', format='intlist') | |
|
22 | ||
|
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 | ||
|
32 | ||
|
33 | project.start() | |
|
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 | 215 | multiprocess = '''from schainpy.controller import Project, MPProject |
|
37 | 216 | from time import sleep |
|
38 | 217 | desc = "{desc}" |
@@ -61,10 +240,10 sleep(2) | |||
|
61 | 240 | ################ |
|
62 | 241 | # DATA EMITTER # |
|
63 | 242 | ################ |
|
64 |
|
|
|
65 |
|
|
|
243 | controller = Project() | |
|
244 | controller.setup(id='200', name="{name}", description=desc) | |
|
66 | 245 | |
|
67 |
spectra_reader = |
|
|
246 | spectra_reader = controller.addReadUnit(datatype='SpectraReader', | |
|
68 | 247 | path="{path}", |
|
69 | 248 | startDate={startDate}, |
|
70 | 249 | endDate={endDate}, |
@@ -75,16 +254,16 spectra_reader = project.addReadUnit(datatype='SpectraReader', | |||
|
75 | 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 | 260 | moments = parameters_proc.addOperation(name='SpectralMoments', optype='other') |
|
82 | 261 | |
|
83 | 262 | publish = parameters_proc.addOperation(name='PublishData', optype='other') |
|
84 | 263 | publish.addParameter(name='zeromq', value=1, format='int') |
|
85 | 264 | publish.addParameter(name='verbose', value=0, format='bool') |
|
86 | 265 | |
|
87 |
MPProject( |
|
|
266 | MPProject(controller, 16) | |
|
88 | 267 | |
|
89 | 268 | |
|
90 | 269 | ''' |
@@ -275,7 +275,7 class ParameterConf(): | |||
|
275 | 275 | parmElement.set('name', self.name) |
|
276 | 276 | parmElement.set('value', self.value) |
|
277 | 277 | parmElement.set('format', self.format) |
|
278 | ||
|
278 | ||
|
279 | 279 | def readXml(self, parmElement): |
|
280 | 280 | |
|
281 | 281 | self.id = parmElement.get('id') |
@@ -289,7 +289,7 class ParameterConf(): | |||
|
289 | 289 | |
|
290 | 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 | 294 | class OperationConf(): |
|
295 | 295 | |
@@ -422,12 +422,13 class OperationConf(): | |||
|
422 | 422 | for parmConfObj in self.parmConfObjList: |
|
423 | 423 | parmConfObj.makeXml(opElement) |
|
424 | 424 | |
|
425 | def readXml(self, opElement): | |
|
425 | def readXml(self, opElement, project_id): | |
|
426 | 426 | |
|
427 | 427 | self.id = opElement.get('id') |
|
428 | 428 | self.name = opElement.get('name') |
|
429 | 429 | self.type = opElement.get('type') |
|
430 | 430 | self.priority = opElement.get('priority') |
|
431 | self.project_id = str(project_id) #yong | |
|
431 | 432 | |
|
432 | 433 | # Compatible with old signal chain version |
|
433 | 434 | # Use of 'run' method instead 'init' |
@@ -453,11 +454,12 class OperationConf(): | |||
|
453 | 454 | |
|
454 | 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 | 458 | self.id, |
|
458 | 459 | self.name, |
|
459 | 460 | self.type, |
|
460 |
self.priority |
|
|
461 | self.priority, | |
|
462 | self.project_id)) | |
|
461 | 463 | |
|
462 | 464 | for parmConfObj in self.parmConfObjList: |
|
463 | 465 | parmConfObj.printattr() |
@@ -465,7 +467,7 class OperationConf(): | |||
|
465 | 467 | def createObject(self): |
|
466 | 468 | |
|
467 | 469 | className = eval(self.name) |
|
468 | ||
|
470 | ||
|
469 | 471 | if self.type == 'other': |
|
470 | 472 | opObj = className() |
|
471 | 473 | elif self.type == 'external': |
@@ -634,12 +636,13 class ProcUnitConf(): | |||
|
634 | 636 | for opConfObj in self.opConfObjList: |
|
635 | 637 | opConfObj.makeXml(procUnitElement) |
|
636 | 638 | |
|
637 | def readXml(self, upElement): | |
|
639 | def readXml(self, upElement, project_id): | |
|
638 | 640 | |
|
639 | 641 | self.id = upElement.get('id') |
|
640 | 642 | self.name = upElement.get('name') |
|
641 | 643 | self.datatype = upElement.get('datatype') |
|
642 | 644 | self.inputId = upElement.get('inputId') |
|
645 | self.project_id = str(project_id) | |
|
643 | 646 | |
|
644 | 647 | if self.ELEMENTNAME == 'ReadUnit': |
|
645 | 648 | self.datatype = self.datatype.replace('Reader', '') |
@@ -656,16 +659,17 class ProcUnitConf(): | |||
|
656 | 659 | |
|
657 | 660 | for opElement in opElementList: |
|
658 | 661 | opConfObj = OperationConf() |
|
659 | opConfObj.readXml(opElement) | |
|
662 | opConfObj.readXml(opElement, project_id) | |
|
660 | 663 | self.opConfObjList.append(opConfObj) |
|
661 | 664 | |
|
662 | 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 | 668 | self.id, |
|
666 | 669 | self.name, |
|
667 | 670 | self.datatype, |
|
668 |
self.inputId |
|
|
671 | self.inputId, | |
|
672 | self.project_id)) | |
|
669 | 673 | |
|
670 | 674 | for opConfObj in self.opConfObjList: |
|
671 | 675 | opConfObj.printattr() |
@@ -846,11 +850,12 class ReadUnitConf(ProcUnitConf): | |||
|
846 | 850 | |
|
847 | 851 | return opObj |
|
848 | 852 | |
|
849 | def readXml(self, upElement): | |
|
853 | def readXml(self, upElement, project_id): | |
|
850 | 854 | |
|
851 | 855 | self.id = upElement.get('id') |
|
852 | 856 | self.name = upElement.get('name') |
|
853 | 857 | self.datatype = upElement.get('datatype') |
|
858 | self.project_id = str(project_id) #yong | |
|
854 | 859 | |
|
855 | 860 | if self.ELEMENTNAME == 'ReadUnit': |
|
856 | 861 | self.datatype = self.datatype.replace('Reader', '') |
@@ -861,7 +866,7 class ReadUnitConf(ProcUnitConf): | |||
|
861 | 866 | |
|
862 | 867 | for opElement in opElementList: |
|
863 | 868 | opConfObj = OperationConf() |
|
864 | opConfObj.readXml(opElement) | |
|
869 | opConfObj.readXml(opElement, project_id) | |
|
865 | 870 | self.opConfObjList.append(opConfObj) |
|
866 | 871 | |
|
867 | 872 | if opConfObj.name == 'run': |
@@ -1109,7 +1114,7 class Project(Process): | |||
|
1109 | 1114 | |
|
1110 | 1115 | for readUnitElement in readUnitElementList: |
|
1111 | 1116 | readUnitConfObj = ReadUnitConf() |
|
1112 | readUnitConfObj.readXml(readUnitElement) | |
|
1117 | readUnitConfObj.readXml(readUnitElement, self.id) | |
|
1113 | 1118 | self.procUnitConfObjDict[readUnitConfObj.getId()] = readUnitConfObj |
|
1114 | 1119 | |
|
1115 | 1120 | procUnitElementList = self.projectElement.iter( |
@@ -1117,7 +1122,7 class Project(Process): | |||
|
1117 | 1122 | |
|
1118 | 1123 | for procUnitElement in procUnitElementList: |
|
1119 | 1124 | procUnitConfObj = ProcUnitConf() |
|
1120 | procUnitConfObj.readXml(procUnitElement) | |
|
1125 | procUnitConfObj.readXml(procUnitElement, self.id) | |
|
1121 | 1126 | self.procUnitConfObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
1122 | 1127 | |
|
1123 | 1128 | self.filename = abs_file |
@@ -1126,9 +1131,10 class Project(Process): | |||
|
1126 | 1131 | |
|
1127 | 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 | 1135 | self.name, |
|
1131 |
self.description |
|
|
1136 | self.description, | |
|
1137 | self.project_id)) | |
|
1132 | 1138 | |
|
1133 | 1139 | for procUnitConfObj in self.procUnitConfObjDict.values(): |
|
1134 | 1140 | print(procUnitConfObj) |
@@ -91,9 +91,9 class BLTRParamReader(JRODataReader, ProcessingUnit): | |||
|
91 | 91 | |
|
92 | 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 | 98 | self.dataOut = Parameters() |
|
99 | 99 | self.counter_records = 0 |
@@ -245,7 +245,7 class BLTRParamReader(JRODataReader, ProcessingUnit): | |||
|
245 | 245 | self.nranges = header_rec['nranges'][0] |
|
246 | 246 | self.fp.seek(pointer) |
|
247 | 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 | 249 | self.buffer = numpy.empty((self.nmodes, 3, self.nranges)) |
|
250 | 250 | self.flagDiscontinuousBlock = 0 |
|
251 | 251 | |
@@ -267,9 +267,9 class BLTRParamReader(JRODataReader, ProcessingUnit): | |||
|
267 | 267 | |
|
268 | 268 | header_structure = numpy.dtype( |
|
269 | 269 | REC_HEADER_STRUCTURE.descr + [ |
|
270 | ('antenna_coord', 'f4', (2, self.nchannels)), | |
|
271 | ('rx_gains', 'u4', (self.nchannels,)), | |
|
272 | ('rx_analysis', 'u4', (self.nchannels,)) | |
|
270 | ('antenna_coord', 'f4', (2, int(self.nchannels))), | |
|
271 | ('rx_gains', 'u4', (int(self.nchannels),)), | |
|
272 | ('rx_analysis', 'u4', (int(self.nchannels),)) | |
|
273 | 273 | ] |
|
274 | 274 | ) |
|
275 | 275 | |
@@ -295,6 +295,7 class BLTRParamReader(JRODataReader, ProcessingUnit): | |||
|
295 | 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 | 300 | data_structure = numpy.dtype( |
|
300 | 301 | DATA_STRUCTURE.descr + [ |
@@ -364,4 +365,5 class BLTRParamReader(JRODataReader, ProcessingUnit): | |||
|
364 | 365 | |
|
365 | 366 | self.set_output() |
|
366 | 367 | |
|
367 | return 1 No newline at end of file | |
|
368 | return 1 | |
|
369 | No newline at end of file |
@@ -76,12 +76,13 class BLTRParametersProc(ProcessingUnit): | |||
|
76 | 76 | self.dataOut.data_param[i][SNRavgdB <= snr_threshold] = numpy.nan |
|
77 | 77 | |
|
78 | 78 | # TODO |
|
79 | @MPDecorator | |
|
79 | 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 | 87 | def run(self, svalue2, method, factor, filter, npoints=9): |
|
87 | 88 | ''' |
@@ -136,6 +136,8 class SpectraProc(ProcessingUnit): | |||
|
136 | 136 | |
|
137 | 137 | if self.dataIn.type == "Voltage": |
|
138 | 138 | |
|
139 | self.dataOut.flagNoData = True | |
|
140 | ||
|
139 | 141 | if nFFTPoints == None: |
|
140 | 142 | raise ValueError("This SpectraProc.run() need nFFTPoints input variable") |
|
141 | 143 | |
@@ -942,8 +944,7 class IncohInt(Operation): | |||
|
942 | 944 | |
|
943 | 945 | dataOut.data_spc = avgdata_spc |
|
944 | 946 | dataOut.data_cspc = avgdata_cspc |
|
945 | dataOut.data_dc = avgdata_dc | |
|
946 | ||
|
947 | dataOut.data_dc = avgdata_dc | |
|
947 | 948 | dataOut.nIncohInt *= self.n |
|
948 | 949 | dataOut.utctime = avgdatatime |
|
949 | 950 | dataOut.flagNoData = False |
@@ -229,13 +229,13 class VoltageProc(ProcessingUnit): | |||
|
229 | 229 | """ |
|
230 | 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 | 233 | buffer = buffer.reshape(self.dataOut.nChannels,self.dataOut.nProfiles,self.dataOut.nHeights/window,window) |
|
234 | 234 | buffer = numpy.sum(buffer,3) |
|
235 | 235 | |
|
236 | 236 | else: |
|
237 | buffer = self.dataOut.data[:,0:self.dataOut.nHeights-r] | |
|
238 | buffer = buffer.reshape(self.dataOut.nChannels,self.dataOut.nHeights/window,window) | |
|
237 | buffer = self.dataOut.data[:,0:int(self.dataOut.nHeights-r)] | |
|
238 | buffer = buffer.reshape(self.dataOut.nChannels,int(self.dataOut.nHeights/window),int(window)) | |
|
239 | 239 | buffer = numpy.sum(buffer,2) |
|
240 | 240 | |
|
241 | 241 | self.dataOut.data = buffer |
@@ -799,7 +799,6 class ProfileConcat(Operation): | |||
|
799 | 799 | self.start_index = self.start_index + self.nHeights |
|
800 | 800 | |
|
801 | 801 | def run(self, dataOut, m): |
|
802 | ||
|
803 | 802 | dataOut.flagNoData = True |
|
804 | 803 | |
|
805 | 804 | if not self.isConfig: |
@@ -908,7 +907,7 class ProfileSelector(Operation): | |||
|
908 | 907 | dataOut.profileIndex = dataOut.nProfiles - 1 |
|
909 | 908 | dataOut.flagNoData = False |
|
910 | 909 | |
|
911 |
return |
|
|
910 | return dataOut | |
|
912 | 911 | |
|
913 | 912 | """ |
|
914 | 913 | data dimension = [nChannels, nHeis] |
@@ -924,7 +923,7 class ProfileSelector(Operation): | |||
|
924 | 923 | dataOut.flagNoData = False |
|
925 | 924 | |
|
926 | 925 | self.incProfileIndex() |
|
927 |
return |
|
|
926 | return dataOut | |
|
928 | 927 | |
|
929 | 928 | if profileRangeList != None: |
|
930 | 929 | |
@@ -939,7 +938,7 class ProfileSelector(Operation): | |||
|
939 | 938 | dataOut.flagNoData = False |
|
940 | 939 | |
|
941 | 940 | self.incProfileIndex() |
|
942 |
return |
|
|
941 | return dataOut | |
|
943 | 942 | |
|
944 | 943 | if rangeList != None: |
|
945 | 944 | |
@@ -967,7 +966,7 class ProfileSelector(Operation): | |||
|
967 | 966 | |
|
968 | 967 | break |
|
969 | 968 | |
|
970 |
return |
|
|
969 | return dataOut | |
|
971 | 970 | |
|
972 | 971 | |
|
973 | 972 | if beam != None: #beam is only for AMISR data |
@@ -977,7 +976,7 class ProfileSelector(Operation): | |||
|
977 | 976 | |
|
978 | 977 | self.incProfileIndex() |
|
979 | 978 | |
|
980 |
return |
|
|
979 | return dataOut | |
|
981 | 980 | |
|
982 | 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