@@ -199,6 +199,42 class CombineChannels(Operation): | |||
|
199 | 199 | |
|
200 | 200 | return dataout |
|
201 | 201 | |
|
202 | ||
|
203 | class CombineChannels_V2(Operation): | |
|
204 | '''Digital hybrid implementation''' | |
|
205 | ||
|
206 | def run(self, dataout, ch_list=[], comb_list=[]): | |
|
207 | ''' | |
|
208 | Input: | |
|
209 | ch_list : list of pairs [[0,2],[1,3]] or single-index [[4], [5]] | |
|
210 | comb_list : list of operations ['sum', 'sub', 'none'] | |
|
211 | ''' | |
|
212 | comb_list = [s.strip().lower() for s in comb_list] | |
|
213 | tmp = [] | |
|
214 | is_block = dataout.flagDataAsBlock | |
|
215 | ||
|
216 | for (channels, comb) in zip(ch_list, comb_list): | |
|
217 | i = channels[0] | |
|
218 | ||
|
219 | if comb == 'none': | |
|
220 | data = dataout.data[i, :, :] if is_block else dataout.data[i, :] | |
|
221 | ||
|
222 | elif comb in ('sum', 'sub'): | |
|
223 | j = channels[1] | |
|
224 | a = dataout.data[i, :, :] if is_block else dataout.data[i, :] | |
|
225 | b = dataout.data[j, :, :] if is_block else dataout.data[j, :] | |
|
226 | data = a + b if comb == 'sum' else a - b | |
|
227 | ||
|
228 | else: | |
|
229 | raise ValueError(f"Unknown combination operation: '{comb}'") | |
|
230 | ||
|
231 | tmp.append(data) | |
|
232 | ||
|
233 | dataout.data = numpy.array(tmp) | |
|
234 | dataout.channelList = list(range(len(tmp))) | |
|
235 | return dataout | |
|
236 | ||
|
237 | ||
|
202 | 238 | class selectHeights(Operation): |
|
203 | 239 | |
|
204 | 240 | def run(self, dataOut, minHei=None, maxHei=None, minIndex=None, maxIndex=None): |
General Comments 0
You need to be logged in to leave comments.
Login now