cohere-core 4.2.0__tar.gz → 4.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cohere_core-4.2.0 → cohere_core-4.2.2}/PKG-INFO +8 -7
- {cohere_core-4.2.0 → cohere_core-4.2.2}/README.md +3 -2
- {cohere_core-4.2.0 → cohere_core-4.2.2}/cohere_core/controller/AI_guess.py +7 -2
- cohere_core-4.2.2/cohere_core/controller/__init__.py +1 -0
- {cohere_core-4.2.0 → cohere_core-4.2.2}/cohere_core/controller/features.py +55 -62
- {cohere_core-4.2.0 → cohere_core-4.2.2}/cohere_core/controller/op_flow.py +17 -13
- {cohere_core-4.2.0 → cohere_core-4.2.2}/cohere_core/controller/phasing.py +421 -236
- {cohere_core-4.2.0 → cohere_core-4.2.2}/cohere_core/data/alien_tools.py +3 -2
- {cohere_core-4.2.0 → cohere_core-4.2.2}/cohere_core/data/standard_preprocess.py +37 -45
- {cohere_core-4.2.0 → cohere_core-4.2.2}/cohere_core/lib/aflib.py +6 -0
- {cohere_core-4.2.0 → cohere_core-4.2.2}/cohere_core/lib/check_libs.py +6 -0
- {cohere_core-4.2.0 → cohere_core-4.2.2}/cohere_core/lib/cohlib.py +20 -0
- {cohere_core-4.2.0 → cohere_core-4.2.2}/cohere_core/lib/cplib.py +14 -0
- {cohere_core-4.2.0 → cohere_core-4.2.2}/cohere_core/lib/nplib.py +18 -3
- {cohere_core-4.2.0 → cohere_core-4.2.2}/cohere_core/lib/torchlib.py +13 -1
- {cohere_core-4.2.0 → cohere_core-4.2.2}/cohere_core/utilities/config_errors_dict.py +12 -3
- {cohere_core-4.2.0 → cohere_core-4.2.2}/cohere_core/utilities/config_verifier.py +75 -53
- {cohere_core-4.2.0 → cohere_core-4.2.2}/cohere_core/utilities/dvc_utils.py +527 -568
- {cohere_core-4.2.0 → cohere_core-4.2.2}/cohere_core/utilities/ga_utils.py +39 -5
- cohere_core-4.2.2/cohere_core/utilities/utils.py +510 -0
- {cohere_core-4.2.0 → cohere_core-4.2.2}/cohere_core.egg-info/PKG-INFO +8 -7
- {cohere_core-4.2.0 → cohere_core-4.2.2}/cohere_core.egg-info/SOURCES.txt +0 -3
- {cohere_core-4.2.0 → cohere_core-4.2.2}/cohere_core.egg-info/requires.txt +0 -1
- {cohere_core-4.2.0 → cohere_core-4.2.2}/setup.py +4 -9
- cohere_core-4.2.0/cohere_core/controller/__init__.py +0 -3
- cohere_core-4.2.0/cohere_core/controller/reconstruction_coupled.py +0 -71
- cohere_core-4.2.0/cohere_core/controller/reconstruction_single.py +0 -93
- cohere_core-4.2.0/cohere_core/utilities/host_utils.py +0 -36
- cohere_core-4.2.0/cohere_core/utilities/utils.py +0 -988
- {cohere_core-4.2.0 → cohere_core-4.2.2}/LICENSE +0 -0
- {cohere_core-4.2.0 → cohere_core-4.2.2}/cohere_core/__init__.py +0 -0
- {cohere_core-4.2.0 → cohere_core-4.2.2}/cohere_core/data/__init__.py +0 -0
- {cohere_core-4.2.0 → cohere_core-4.2.2}/cohere_core/lib/__init__.py +0 -0
- {cohere_core-4.2.0 → cohere_core-4.2.2}/cohere_core/utilities/__init__.py +0 -0
- {cohere_core-4.2.0 → cohere_core-4.2.2}/cohere_core.egg-info/dependency_links.txt +0 -0
- {cohere_core-4.2.0 → cohere_core-4.2.2}/cohere_core.egg-info/top_level.txt +0 -0
- {cohere_core-4.2.0 → cohere_core-4.2.2}/setup.cfg +0 -0
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: cohere_core
|
|
3
|
-
Version: 4.2.
|
|
3
|
+
Version: 4.2.2
|
|
4
4
|
Home-page: https://github.com/advancedPhotonSource/cohere
|
|
5
5
|
Author: Barbara Frosik, Ross Harder
|
|
6
6
|
Author-email: bfrosik@anl.gov
|
|
7
7
|
Classifier: Intended Audience :: Science/Research
|
|
8
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
12
8
|
Classifier: Programming Language :: Python :: 3.10
|
|
13
9
|
Classifier: Programming Language :: Python :: 3.11
|
|
14
10
|
License-File: LICENSE
|
|
15
11
|
Requires-Dist: numpy<2
|
|
16
12
|
Requires-Dist: scikit-learn
|
|
17
13
|
Requires-Dist: tifffile
|
|
18
|
-
Requires-Dist: gputil
|
|
19
14
|
Requires-Dist: psutil
|
|
20
15
|
Requires-Dist: tqdm
|
|
21
16
|
Requires-Dist: matplotlib
|
|
17
|
+
Dynamic: author
|
|
18
|
+
Dynamic: author-email
|
|
19
|
+
Dynamic: classifier
|
|
20
|
+
Dynamic: home-page
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
Dynamic: requires-dist
|
|
@@ -4,7 +4,7 @@ Project home page: [https://cohere-dev.readthedocs.io/](https://cohere-dev.readt
|
|
|
4
4
|
|
|
5
5
|
The cohere package provides tools for reconstruction of image of a nanoscale structures from data obtained using Bragg Coherent Diffraction Imaging technique.
|
|
6
6
|
|
|
7
|
-
The reconstruction has very good performance, in particular when utilizing GPU. User has a choice to run on cpu or GPU by selecting Python library. Supported libraries: numpy, cupy,
|
|
7
|
+
The reconstruction has very good performance, in particular when utilizing GPU. User has a choice to run on cpu or GPU by selecting Python library. Supported libraries: numpy, cupy, torch. The libraries cupy or torch are installed by user. The solution offers concurrent processing for fast reconstruction of multiple starting points.
|
|
8
8
|
|
|
9
9
|
Important features:
|
|
10
10
|
- Genetic Algorithm (GA) - powerful feature that can deliver good reconstruction result by using GA principles. Based on research "Three-dimensional imaging of dislocation propagation during crystal growth and dissolution, Supplementary Information" by Jesse N. Clark et. al.
|
|
@@ -13,8 +13,9 @@ A trained model must be provided when using this feature. User can download trai
|
|
|
13
13
|
https://g-29c18.fd635.8443.data.globus.org/cherukara/cohere-trained_model.hdf5
|
|
14
14
|
- AutoAlien1 algorithm - a method to remove aliens by automatic means during standard data preprocessing. Based on work "Removal of spurious data in Bragg coherent diffraction imaging: an algorithm for automated data preprocessing" by Kenley Pelzer et. al.
|
|
15
15
|
- Multipeak - support for an experiment where data is collected for adjacent peaks simultaneously and reconstructing this multipeak scenario. The research is in experimental stage. Implemented by Jason (Nick) Porter.
|
|
16
|
+
- chrono CDI - allows the oversampling requirement at each time step to be reduced. The increased time resolution will allow imaging of faster dynamics and of radiation-dose-sensitive samples. Based on work "Coherent diffractive imaging of time-evolving samples with improved temporal resolution" by A. Ulvestat et. al.
|
|
16
17
|
|
|
17
|
-
The tools
|
|
18
|
+
The tools offers a full solution for reading beamline specific experiment data, formatting the data, reconstruction, and visualization. Each of the components can be utilized independently. The project was implemented for the Advanced Photon Source beamline 34-ID-C.
|
|
18
19
|
|
|
19
20
|
Author(s)
|
|
20
21
|
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
# #########################################################################
|
|
2
|
+
# Copyright (c) , UChicago Argonne, LLC. All rights reserved. #
|
|
3
|
+
# #
|
|
4
|
+
# See LICENSE file. #
|
|
5
|
+
# #########################################################################
|
|
6
|
+
|
|
1
7
|
import numpy as np
|
|
2
8
|
import os
|
|
3
9
|
import cohere_core.utilities.utils as ut
|
|
@@ -90,8 +96,7 @@ def shift_com(amp, phi):
|
|
|
90
96
|
|
|
91
97
|
def post_process(amp, phi, th=0.1, uw=0):
|
|
92
98
|
if uw == 1:
|
|
93
|
-
|
|
94
|
-
phi = unwrap_phase(phi)
|
|
99
|
+
phi = np.unwrap(np.unwrap(np.unwrap(phi,0),1),2)
|
|
95
100
|
|
|
96
101
|
mask = np.where(amp > th, 1, 0)
|
|
97
102
|
amp_out = mask * amp
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .phasing import *
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
# #########################################################################
|
|
2
|
+
# Copyright (c) , UChicago Argonne, LLC. All rights reserved. #
|
|
3
|
+
# #
|
|
4
|
+
# See LICENSE file. #
|
|
5
|
+
# #########################################################################
|
|
6
|
+
|
|
1
7
|
import cohere_core.utilities.utils as ut
|
|
2
8
|
import cohere_core.utilities.dvc_utils as dvut
|
|
3
9
|
from abc import ABC, abstractmethod
|
|
@@ -23,14 +29,14 @@ class Pcdi:
|
|
|
23
29
|
if 'pc_LUCY_iterations' in params:
|
|
24
30
|
self.iterations = params['pc_LUCY_iterations']
|
|
25
31
|
else:
|
|
26
|
-
|
|
27
|
-
raise
|
|
32
|
+
msg = 'pc_LUCY_iterations parameter not defined'
|
|
33
|
+
raise ValueError(msg)
|
|
28
34
|
self.normalize = params.get('pc_normalize', True)
|
|
29
35
|
if 'pc_LUCY_kernel' in params:
|
|
30
36
|
self.kernel_area = params['pc_LUCY_kernel']
|
|
31
37
|
else:
|
|
32
|
-
|
|
33
|
-
raise
|
|
38
|
+
msg = 'pc_LUCY_kernel parameter not defined'
|
|
39
|
+
raise ValueError(msg)
|
|
34
40
|
if dir is None:
|
|
35
41
|
self.kernel = None
|
|
36
42
|
else:
|
|
@@ -67,19 +73,8 @@ class Pcdi:
|
|
|
67
73
|
amplitudes = roi_combined_amp
|
|
68
74
|
|
|
69
75
|
if self.type == "LUCY":
|
|
70
|
-
self.lucy_deconvolution(devlib.square(amplitudes), devlib.square(self.roi_data),
|
|
71
|
-
self.iterations)
|
|
72
|
-
|
|
73
|
-
def lucy_deconvolution(self, amplitudes, data, iterations):
|
|
74
|
-
data_mirror = devlib.flip(data)
|
|
75
|
-
for i in range(iterations):
|
|
76
|
-
conv = devlib.fftconvolve(self.kernel, data)
|
|
77
|
-
conv = devlib.where(conv == 0.0, 1.0, conv)
|
|
78
|
-
relative_blurr = amplitudes / conv
|
|
79
|
-
self.kernel = self.kernel * devlib.fftconvolve(relative_blurr, data_mirror)
|
|
80
|
-
self.kernel = devlib.real(self.kernel)
|
|
81
|
-
coh_sum = devlib.sum(devlib.absolute(self.kernel))
|
|
82
|
-
self.kernel = devlib.absolute(self.kernel) / coh_sum
|
|
76
|
+
self.kernel = dvut.lucy_deconvolution(devlib.square(amplitudes), devlib.square(self.roi_data),
|
|
77
|
+
self.kernel, self.iterations)
|
|
83
78
|
|
|
84
79
|
|
|
85
80
|
class TriggeredOp(ABC):
|
|
@@ -205,24 +200,24 @@ class ShrinkWrap(TriggeredOp):
|
|
|
205
200
|
def check_Gauss_type():
|
|
206
201
|
# for now cohere supports only Gauss type, so the following parameters are mandatory
|
|
207
202
|
if 'shrink_wrap_gauss_sigma' not in params:
|
|
208
|
-
|
|
209
|
-
raise
|
|
203
|
+
msg = 'shrink_wrap_gauss_sigma parameter not defined'
|
|
204
|
+
raise ValueError(msg)
|
|
210
205
|
if 'shrink_wrap_threshold' not in params:
|
|
211
|
-
|
|
212
|
-
raise
|
|
206
|
+
msg = 'shrink_wrap_threshold parameter not defined'
|
|
207
|
+
raise ValueError(msg)
|
|
213
208
|
|
|
214
209
|
def check_Gauss1_type():
|
|
215
210
|
# for now cohere supports only Gauss type, so the following parameters are mandatory
|
|
216
211
|
if 'shrink_wrap_gauss_sigma' not in params:
|
|
217
|
-
|
|
218
|
-
raise
|
|
212
|
+
msg = 'shrink_wrap_gauss_sigma parameter not defined'
|
|
213
|
+
raise ValueError(msg)
|
|
219
214
|
if 'shrink_wrap_threshold' not in params:
|
|
220
|
-
|
|
221
|
-
raise
|
|
215
|
+
msg = 'shrink_wrap_threshold parameter not defined'
|
|
216
|
+
raise ValueError(msg)
|
|
222
217
|
|
|
223
218
|
if 'shrink_wrap_type' not in params:
|
|
224
|
-
|
|
225
|
-
raise
|
|
219
|
+
msg = 'shrink_wrap_type parameter not defined'
|
|
220
|
+
raise ValueError(msg)
|
|
226
221
|
|
|
227
222
|
if index is None:
|
|
228
223
|
sw_type = params['shrink_wrap_type']
|
|
@@ -237,38 +232,38 @@ class ShrinkWrap(TriggeredOp):
|
|
|
237
232
|
threshold = params['shrink_wrap_threshold']
|
|
238
233
|
return self.Gauss1SW(sigma, threshold)
|
|
239
234
|
else:
|
|
240
|
-
|
|
241
|
-
raise
|
|
235
|
+
msg = f'{sw_type} shrink wrap type is not supported'
|
|
236
|
+
raise ValueError(msg)
|
|
242
237
|
else:
|
|
243
238
|
if len(params['shrink_wrap_type']) - 1 < index:
|
|
244
|
-
|
|
245
|
-
raise
|
|
239
|
+
msg = f'shrink_wrap_type not defined for sub-trigger {index}'
|
|
240
|
+
raise ValueError(msg)
|
|
246
241
|
sw_type = params['shrink_wrap_type'][index]
|
|
247
242
|
if sw_type == 'GAUSS':
|
|
248
243
|
check_Gauss_type()
|
|
249
244
|
if len(params['shrink_wrap_gauss_sigma']) - 1 < index:
|
|
250
|
-
|
|
251
|
-
raise
|
|
245
|
+
msg = f'shrink_wrap_gauss_sigma not defined for sub-trigger {index}'
|
|
246
|
+
raise ValueError(msg)
|
|
252
247
|
sigma = params['shrink_wrap_gauss_sigma'][index]
|
|
253
248
|
if len(params['shrink_wrap_threshold']) - 1 < index:
|
|
254
|
-
|
|
255
|
-
raise
|
|
249
|
+
msg = f'shrink_wrap_threshold not defined for sub-trigger {index}'
|
|
250
|
+
raise ValueError(msg)
|
|
256
251
|
threshold = params['shrink_wrap_threshold'][index]
|
|
257
252
|
return self.GaussSW(sigma, threshold)
|
|
258
253
|
elif sw_type == 'GAUSS1':
|
|
259
254
|
check_Gauss1_type()
|
|
260
255
|
if len(params['shrink_wrap_gauss_sigma']) - 1 < index:
|
|
261
|
-
|
|
262
|
-
raise
|
|
256
|
+
msg = f'shrink_wrap_gauss_sigma not defined for sub-trigger {index}'
|
|
257
|
+
raise ValueError(msg)
|
|
263
258
|
sigma = params['shrink_wrap_gauss_sigma'][index]
|
|
264
259
|
if len(params['shrink_wrap_threshold']) - 1 < index:
|
|
265
|
-
|
|
266
|
-
raise
|
|
260
|
+
msg = f'shrink_wrap_threshold not defined for sub-trigger {index}'
|
|
261
|
+
raise ValueError(msg)
|
|
267
262
|
threshold = params['shrink_wrap_threshold'][index]
|
|
268
263
|
return self.Gauss1SW(sigma, threshold)
|
|
269
264
|
else:
|
|
270
|
-
|
|
271
|
-
raise
|
|
265
|
+
msg = f'{sw_type} shrink wrap type is not supported'
|
|
266
|
+
raise ValueError(msg)
|
|
272
267
|
|
|
273
268
|
|
|
274
269
|
|
|
@@ -289,22 +284,22 @@ class PhaseConstrain(TriggeredOp):
|
|
|
289
284
|
|
|
290
285
|
def create_obj(self, params, index=None, beg=None, end=None):
|
|
291
286
|
if 'phc_phase_min' not in params:
|
|
292
|
-
|
|
293
|
-
raise
|
|
287
|
+
msg = 'phc_phase_min parameter not defined'
|
|
288
|
+
raise ValueError(msg)
|
|
294
289
|
if 'phc_phase_max' not in params:
|
|
295
|
-
|
|
296
|
-
raise
|
|
290
|
+
msg = 'phc_phase_max parameter not defined'
|
|
291
|
+
raise ValueError(msg)
|
|
297
292
|
if index is None:
|
|
298
293
|
phase_min = params['phc_phase_min']
|
|
299
294
|
phase_max = params['phc_phase_max']
|
|
300
295
|
else:
|
|
301
296
|
if len(params['phc_phase_min']) - 1 < index:
|
|
302
|
-
|
|
303
|
-
raise
|
|
297
|
+
msg = f'phc_phase_min not defined for sub-trigger {index}'
|
|
298
|
+
raise ValueError(msg)
|
|
304
299
|
phase_min = params['phc_phase_min'][index]
|
|
305
300
|
if len(params['phc_phase_max']) - 1 < index:
|
|
306
|
-
|
|
307
|
-
raise
|
|
301
|
+
msg = f'phc_phase_max not defined for sub-trigger {index}'
|
|
302
|
+
raise ValueError(msg)
|
|
308
303
|
phase_max = params['phc_phase_max'][index]
|
|
309
304
|
return self.PhasePHC(phase_min, phase_max)
|
|
310
305
|
|
|
@@ -333,11 +328,11 @@ class LowPassFilter(TriggeredOp):
|
|
|
333
328
|
|
|
334
329
|
def create_obj(self, params, index=None, beg=None, end=None):
|
|
335
330
|
if 'lowpass_filter_sw_threshold' not in params:
|
|
336
|
-
|
|
337
|
-
raise
|
|
331
|
+
msg = 'lowpass_filter_sw_threshold parameter not defined'
|
|
332
|
+
raise ValueError(msg)
|
|
338
333
|
if 'lowpass_filter_range' not in params:
|
|
339
|
-
|
|
340
|
-
raise
|
|
334
|
+
msg = 'lowpass_filter_range parameter not defined'
|
|
335
|
+
raise ValueError(msg)
|
|
341
336
|
# in case of a all_iteration configuration the lowpass filter
|
|
342
337
|
# iteration can be read from lowpass_filter_trigger
|
|
343
338
|
if index is None:
|
|
@@ -348,12 +343,12 @@ class LowPassFilter(TriggeredOp):
|
|
|
348
343
|
else:
|
|
349
344
|
iter_range = (beg, end)
|
|
350
345
|
if len(params['lowpass_filter_range']) - 1 < index:
|
|
351
|
-
|
|
352
|
-
raise
|
|
346
|
+
msg = f'lowpass_filter_range not defined for sub-trigger {index}'
|
|
347
|
+
raise ValueError(msg)
|
|
353
348
|
filter_range = params['lowpass_filter_range'][index]
|
|
354
349
|
if len(params['lowpass_filter_sw_threshold']) - 1 < index:
|
|
355
|
-
|
|
356
|
-
raise
|
|
350
|
+
msg = f'lowpass_filter_sw_threshold not defined for sub-trigger {index}'
|
|
351
|
+
raise ValueError(msg)
|
|
357
352
|
threshold = params['lowpass_filter_sw_threshold'][index]
|
|
358
353
|
if len(filter_range) == 1:
|
|
359
354
|
filter_range.append(1.0)
|
|
@@ -368,11 +363,9 @@ def create(trig_op, params, trig_op_info):
|
|
|
368
363
|
to = LowPassFilter(trig_op)
|
|
369
364
|
|
|
370
365
|
# this function sets self.objs and self.f and creates all objects
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
except:
|
|
375
|
-
return None
|
|
366
|
+
# It may throw exception
|
|
367
|
+
to.create_objs(params, trig_op_info)
|
|
368
|
+
return to
|
|
376
369
|
|
|
377
370
|
|
|
378
371
|
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
# #########################################################################
|
|
2
|
+
# Copyright (c) , UChicago Argonne, LLC. All rights reserved. #
|
|
3
|
+
# #
|
|
4
|
+
# See LICENSE file. #
|
|
5
|
+
# #########################################################################
|
|
6
|
+
|
|
1
7
|
import numpy as np
|
|
2
8
|
import re
|
|
3
9
|
|
|
@@ -8,6 +14,8 @@ algs = {'ER': ('to_reciprocal_space', 'modulus', 'to_direct_space', 'er'),
|
|
|
8
14
|
'HIO': ('to_reciprocal_space', 'modulus', 'to_direct_space', 'hio'),
|
|
9
15
|
'ERpc': ('to_reciprocal_space', 'pc_modulus', 'to_direct_space', 'er'),
|
|
10
16
|
'HIOpc': ('to_reciprocal_space', 'pc_modulus', 'to_direct_space', 'hio'),
|
|
17
|
+
'SF': ('to_reciprocal_space', 'modulus', 'to_direct_space', 'sf'),
|
|
18
|
+
'RAAR': ('to_reciprocal_space', 'modulus', 'to_direct_space', 'raar')
|
|
11
19
|
}
|
|
12
20
|
|
|
13
21
|
# This map keeps the names of triggers that can be configured as sub-trigger, i.e. be a trigger for the iteration span
|
|
@@ -93,8 +101,8 @@ def get_alg_rows(s, pc_conf_start):
|
|
|
93
101
|
repeat = entry[0]
|
|
94
102
|
funs = entry[1].split('.')
|
|
95
103
|
if funs[0] not in algs:
|
|
96
|
-
|
|
97
|
-
raise
|
|
104
|
+
msg = f'algorithm {funs[0]} is not defined in op_flow.py file, algs dict.'
|
|
105
|
+
raise NameError(msg)
|
|
98
106
|
# the pc will not be executed if pc_conf_start is None
|
|
99
107
|
# this code will be revised after each generation has separate config
|
|
100
108
|
if pc_conf_start is None:
|
|
@@ -119,8 +127,8 @@ def get_alg_rows(s, pc_conf_start):
|
|
|
119
127
|
(trig_op, idx) = match.groups(0)
|
|
120
128
|
sub_t = sub_triggers[trig_op]
|
|
121
129
|
if trig_op not in sub_triggers.keys():
|
|
122
|
-
|
|
123
|
-
raise
|
|
130
|
+
msg = f'the sub-trigger {trig_op} must be defined in op_flow.py file, sub_triggers dict.'
|
|
131
|
+
raise NameError(msg)
|
|
124
132
|
if sub_t not in sub_rows:
|
|
125
133
|
sub_rows[sub_t] = []
|
|
126
134
|
sub_rows[sub_t].append((entry[2], entry[0] + entry[2], idx))
|
|
@@ -193,8 +201,8 @@ def fill_sub_trigger_row(sub_iters, sub_trigs, iter_no, last_trig):
|
|
|
193
201
|
index = int(idx)
|
|
194
202
|
sub_trig_idx_row[b:e] = index + 1
|
|
195
203
|
if len(sub_trigs) - 1 < index:
|
|
196
|
-
|
|
197
|
-
raise
|
|
204
|
+
msg = 'not enough entries in sub-trigger'
|
|
205
|
+
raise RuntimeError(msg)
|
|
198
206
|
trigger = sub_trigs[index].copy()
|
|
199
207
|
trigger[0] += b
|
|
200
208
|
if len(trigger) == 2:
|
|
@@ -256,8 +264,7 @@ def get_flow_arr(params, flow_items_list, curr_gen=None):
|
|
|
256
264
|
|
|
257
265
|
if pc_start is not None:
|
|
258
266
|
if pc_start == 0:
|
|
259
|
-
|
|
260
|
-
raise
|
|
267
|
+
raise ValueError('partial coherence is configured in first iteration, allow several ER before.')
|
|
261
268
|
else:
|
|
262
269
|
pc_interval = params['pc_interval']
|
|
263
270
|
params['pc_trigger'] = [pc_start, pc_interval]
|
|
@@ -288,11 +295,8 @@ def get_flow_arr(params, flow_items_list, curr_gen=None):
|
|
|
288
295
|
# determined in algorithm sequence parsing if the triggered operation is configured
|
|
289
296
|
# with sub-triggers or trigger
|
|
290
297
|
if trigger_name in sub_iters.keys():
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
except:
|
|
294
|
-
flow_arr = None
|
|
295
|
-
break
|
|
298
|
+
# may throw exception
|
|
299
|
+
flow_arr[i] = fill_sub_trigger_row(sub_iters[trigger_name], params[trigger_name], iter_no, last_trig)
|
|
296
300
|
# add entry to sub trigger operation dict with key of the trigger mnemonic
|
|
297
301
|
# and the value of a list with the row and sub triggers iterations chunks
|
|
298
302
|
sub_trig_op[trigger_name] = (flow_arr[i], sub_iters[trigger_name])
|