ewoksid02 0.1.0__py3-none-any.whl

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.
Files changed (54) hide show
  1. ewoksid02/__init__.py +0 -0
  2. ewoksid02/ocl/__init__.py +0 -0
  3. ewoksid02/resources/__init__.py +8 -0
  4. ewoksid02/resources/saxs_loop.json +96 -0
  5. ewoksid02/resources/template_saxs.yaml +37 -0
  6. ewoksid02/scripts/__init__.py +0 -0
  7. ewoksid02/scripts/__main__.py +70 -0
  8. ewoksid02/scripts/parsers.py +224 -0
  9. ewoksid02/scripts/saxs/__init__.py +0 -0
  10. ewoksid02/scripts/saxs/main.py +255 -0
  11. ewoksid02/scripts/saxs/slurm_python_post_script.py +3 -0
  12. ewoksid02/scripts/saxs/slurm_python_pre_script.py +5 -0
  13. ewoksid02/scripts/utils.py +21 -0
  14. ewoksid02/scripts/xpcs/__init__.py +0 -0
  15. ewoksid02/scripts/xpcs/__main__.py +3 -0
  16. ewoksid02/tasks/__init__.py +7 -0
  17. ewoksid02/tasks/averagetask.py +179 -0
  18. ewoksid02/tasks/azimuthaltask.py +272 -0
  19. ewoksid02/tasks/cavingtask.py +170 -0
  20. ewoksid02/tasks/dahuprocessingtask.py +71 -0
  21. ewoksid02/tasks/end.py +35 -0
  22. ewoksid02/tasks/id02processingtask.py +2582 -0
  23. ewoksid02/tasks/looptask.py +672 -0
  24. ewoksid02/tasks/metadatatask.py +879 -0
  25. ewoksid02/tasks/normalizationtask.py +204 -0
  26. ewoksid02/tasks/scalerstask.py +46 -0
  27. ewoksid02/tasks/secondaryscatteringtask.py +159 -0
  28. ewoksid02/tasks/sumtask.py +45 -0
  29. ewoksid02/tests/__init__.py +3 -0
  30. ewoksid02/tests/conftest.py +639 -0
  31. ewoksid02/tests/debug.py +64 -0
  32. ewoksid02/tests/test_2scat_node.py +119 -0
  33. ewoksid02/tests/test_ave_node.py +106 -0
  34. ewoksid02/tests/test_azim_node.py +89 -0
  35. ewoksid02/tests/test_cave_node.py +118 -0
  36. ewoksid02/tests/test_norm_node.py +190 -0
  37. ewoksid02/tests/test_saxs.py +69 -0
  38. ewoksid02/tests/test_sumtask.py +10 -0
  39. ewoksid02/tests/utils.py +514 -0
  40. ewoksid02/utils/__init__.py +22 -0
  41. ewoksid02/utils/average.py +158 -0
  42. ewoksid02/utils/blissdata.py +1157 -0
  43. ewoksid02/utils/caving.py +851 -0
  44. ewoksid02/utils/cupyutils.py +42 -0
  45. ewoksid02/utils/io.py +722 -0
  46. ewoksid02/utils/normalization.py +804 -0
  47. ewoksid02/utils/pyfai.py +424 -0
  48. ewoksid02/utils/secondaryscattering.py +597 -0
  49. ewoksid02-0.1.0.dist-info/METADATA +76 -0
  50. ewoksid02-0.1.0.dist-info/RECORD +54 -0
  51. ewoksid02-0.1.0.dist-info/WHEEL +5 -0
  52. ewoksid02-0.1.0.dist-info/entry_points.txt +5 -0
  53. ewoksid02-0.1.0.dist-info/licenses/LICENSE.md +20 -0
  54. ewoksid02-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,639 @@
1
+ import h5py
2
+ import pytest
3
+ from silx.resources import ExternalResources
4
+
5
+ from ..utils.blissdata import LIMA_URL_TEMPLATE_ID02, get_lima_url_template_args_id02
6
+
7
+ WINDOW_ROI_SIZE = 100
8
+ INDEX_RANGE = [0, 2]
9
+ EIGER2_SHAPE = (2162, 2068)
10
+ NBPT_AZIM = 360
11
+ NBPT_RAD = 1633
12
+ SCAN_NB = 9
13
+ SCAN_NB_SUBSCAN2 = 8
14
+
15
+ URL_BASE = "http://ftp.edna-site.org/ewoks/id02test"
16
+ RESOURCES = ExternalResources("ewoksid02", timeout=60, url_base=URL_BASE)
17
+
18
+ RAW_MASTER_FILE = "RAW_DATA/ewoks/ewoks_20250212-112132/ewoks_20250212-112132.h5"
19
+ RAW_LIMA_FILE = "RAW_DATA/ewoks/ewoks_20250212-112132/ewoks_eiger2_00009_00.h5"
20
+ RAW_SCALERS_FILE = "RAW_DATA/ewoks/ewoks_20250212-112132/ewoks_scalers_00009_00.h5"
21
+
22
+ RAW_LIMA_FILE_SUBSCAN2 = "RAW_DATA/ewoks/ewoks_20250212-112132/ewoks_eiger2_00008_00.h5"
23
+ RAW_SCALERS_FILE_SUBSCAN2 = (
24
+ "RAW_DATA/ewoks/ewoks_20250212-112132/ewoks_scalers_00008_00.h5"
25
+ )
26
+
27
+ FILENAME_PROCESSED_NORM_REFERENCE = (
28
+ "PROCESSED_DATA/ewoks/ewoks_20250212-112132/ewoks_eiger2_00009_00_norm.h5"
29
+ )
30
+ FILENAME_PROCESSED_2SCAT_FULL = (
31
+ "PROCESSED_DATA/ewoks/ewoks_20250212-112132/ewoks_eiger2_00009_00_full_2scat.h5"
32
+ )
33
+ FILENAME_PROCESSED_CAVE_FULL = (
34
+ "PROCESSED_DATA/ewoks/ewoks_20250212-112132/ewoks_eiger2_00009_00_full_cave.h5"
35
+ )
36
+ FILENAME_PROCESSED_AZIM_FULL = (
37
+ "PROCESSED_DATA/ewoks/ewoks_20250212-112132/ewoks_eiger2_00009_00_full_azim.h5"
38
+ )
39
+ FILENAME_PROCESSED_AVE_FULL = (
40
+ "PROCESSED_DATA/ewoks/ewoks_20250212-112132/ewoks_eiger2_00009_00_full_ave.h5"
41
+ )
42
+ FILENAME_PROCESSED_NORM_DAHU_SUBSCAN2 = (
43
+ "PROCESSED_DATA/ewoks/ewoks_20250212-112132/ewoks_eiger2_00008_00_norm.h5"
44
+ )
45
+ FILENAME_PROCESSED_AZIM_DAHU_SUBSCAN2 = (
46
+ "PROCESSED_DATA/ewoks/ewoks_20250212-112132/ewoks_eiger2_00008_00_azim.h5"
47
+ )
48
+ FILENAME_PROCESSED_AVE_DAHU_SUBSCAN2 = (
49
+ "PROCESSED_DATA/ewoks/ewoks_20250212-112132/ewoks_eiger2_00008_00_ave.h5"
50
+ )
51
+
52
+ FILENAME_MASK_GAPS = "PROCESSED_DATA/mask_eiger2_gaps.edf"
53
+ FILENAME_MASK_BEAMSTOP = "PROCESSED_DATA/mask_eiger4m_beamstop.edf"
54
+ FILENAME_FLATFIELD = "PROCESSED_DATA/flat_eiger2_1b1.edf"
55
+ FILENAME_WINDOW_PATTERN = "PROCESSED_DATA/window_norm_cave.h5"
56
+ DETECTOR_EIGER2 = "eiger2"
57
+
58
+
59
+ @pytest.fixture
60
+ def cupy_available():
61
+ try:
62
+ import cupy # noqa: F401
63
+
64
+ return True
65
+ except ImportError:
66
+ return False
67
+
68
+
69
+ @pytest.fixture
70
+ def index_read():
71
+ return INDEX_RANGE
72
+
73
+
74
+ @pytest.fixture
75
+ def eiger2_shape():
76
+ return EIGER2_SHAPE
77
+
78
+
79
+ @pytest.fixture
80
+ def nbpt_rad():
81
+ return NBPT_RAD
82
+
83
+
84
+ @pytest.fixture
85
+ def nbpt_azim():
86
+ return NBPT_AZIM
87
+
88
+
89
+ @pytest.fixture
90
+ def filename_raw_lima():
91
+ return RESOURCES.getfile(RAW_LIMA_FILE)
92
+
93
+
94
+ @pytest.fixture
95
+ def filename_raw_master():
96
+ return RESOURCES.getfile(RAW_MASTER_FILE)
97
+
98
+
99
+ @pytest.fixture
100
+ def filename_raw_scalers():
101
+ return RESOURCES.getfile(RAW_SCALERS_FILE)
102
+
103
+
104
+ @pytest.fixture
105
+ def filename_raw_lima_subscan2():
106
+ return RESOURCES.getfile(RAW_LIMA_FILE_SUBSCAN2)
107
+
108
+
109
+ @pytest.fixture
110
+ def filename_raw_scalers_subscan2():
111
+ return RESOURCES.getfile(RAW_SCALERS_FILE_SUBSCAN2)
112
+
113
+
114
+ @pytest.fixture
115
+ def filename_processed_norm_reference():
116
+ return RESOURCES.getfile(FILENAME_PROCESSED_NORM_REFERENCE)
117
+
118
+
119
+ @pytest.fixture
120
+ def filename_processed_2scat_full():
121
+ return RESOURCES.getfile(FILENAME_PROCESSED_2SCAT_FULL)
122
+
123
+
124
+ @pytest.fixture
125
+ def filename_processed_cave_full():
126
+ return RESOURCES.getfile(FILENAME_PROCESSED_CAVE_FULL)
127
+
128
+
129
+ @pytest.fixture
130
+ def filename_processed_azim_full():
131
+ return RESOURCES.getfile(FILENAME_PROCESSED_AZIM_FULL)
132
+
133
+
134
+ @pytest.fixture
135
+ def filename_processed_ave_full():
136
+ return RESOURCES.getfile(FILENAME_PROCESSED_AVE_FULL)
137
+
138
+
139
+ @pytest.fixture
140
+ def filename_processed_norm_dahu_subscan2():
141
+ return RESOURCES.getfile(FILENAME_PROCESSED_NORM_DAHU_SUBSCAN2)
142
+
143
+
144
+ @pytest.fixture
145
+ def filename_processed_azim_dahu_subscan2():
146
+ return RESOURCES.getfile(FILENAME_PROCESSED_AZIM_DAHU_SUBSCAN2)
147
+
148
+
149
+ @pytest.fixture
150
+ def filename_processed_ave_dahu_subscan2():
151
+ return RESOURCES.getfile(FILENAME_PROCESSED_AVE_DAHU_SUBSCAN2)
152
+
153
+
154
+ @pytest.fixture
155
+ def filename_flatfield():
156
+ return RESOURCES.getfile(FILENAME_FLATFIELD)
157
+
158
+
159
+ @pytest.fixture
160
+ def filename_mask_gaps():
161
+ return RESOURCES.getfile(FILENAME_MASK_GAPS)
162
+
163
+
164
+ @pytest.fixture
165
+ def filename_mask_beamstop():
166
+ return RESOURCES.getfile(FILENAME_MASK_BEAMSTOP)
167
+
168
+
169
+ @pytest.fixture
170
+ def filename_window_pattern():
171
+ return RESOURCES.getfile(FILENAME_WINDOW_PATTERN)
172
+
173
+
174
+ @pytest.fixture
175
+ def window_roi_size():
176
+ return WINDOW_ROI_SIZE
177
+
178
+
179
+ @pytest.fixture
180
+ def inputs_task_generic(filename_raw_lima, filename_raw_master):
181
+ return {
182
+ "detector_name": DETECTOR_EIGER2,
183
+ "filename_data": filename_raw_master,
184
+ "filename_lima": filename_raw_lima,
185
+ "Dummy": -10,
186
+ "DDummy": 0.1,
187
+ "scan_nb": SCAN_NB,
188
+ "subscan": 1,
189
+ "max_slice_size": 50,
190
+ "lima_url_template": LIMA_URL_TEMPLATE_ID02,
191
+ "lima_url_template_args": get_lima_url_template_args_id02(
192
+ scan_number=SCAN_NB,
193
+ detector_name=DETECTOR_EIGER2,
194
+ collection_name="ewoks",
195
+ ),
196
+ "log_level": "info",
197
+ "datatype": "float32",
198
+ "use_cupy": False,
199
+ "save_variance": True,
200
+ "index_range": INDEX_RANGE,
201
+ }
202
+
203
+
204
+ @pytest.fixture
205
+ def inputs_task_generic_subscan2(filename_raw_lima_subscan2, filename_raw_master):
206
+ return {
207
+ "detector_name": DETECTOR_EIGER2,
208
+ "filename_data": filename_raw_master,
209
+ "filename_lima": filename_raw_lima_subscan2,
210
+ "Dummy": -10,
211
+ "DDummy": 0.1,
212
+ "scan_nb": SCAN_NB_SUBSCAN2,
213
+ "subscan": 1,
214
+ "max_slice_size": 50,
215
+ "lima_url_template": LIMA_URL_TEMPLATE_ID02,
216
+ "lima_url_template_args": get_lima_url_template_args_id02(
217
+ scan_number=SCAN_NB,
218
+ detector_name=DETECTOR_EIGER2,
219
+ collection_name="ewoks",
220
+ ),
221
+ "log_level": "info",
222
+ "datatype": "float32",
223
+ "use_cupy": False,
224
+ "save_variance": True,
225
+ "index_range": INDEX_RANGE,
226
+ }
227
+
228
+
229
+ @pytest.fixture
230
+ def inputs_task_norm(filename_mask_gaps, filename_flatfield):
231
+ return {
232
+ "filename_mask": filename_mask_gaps,
233
+ "filename_dark": None,
234
+ "filename_flat": filename_flatfield,
235
+ "algorithm": "cython",
236
+ }
237
+
238
+
239
+ @pytest.fixture
240
+ def inputs_task_2scat(
241
+ filename_window_pattern, filename_mask_gaps, filename_mask_beamstop
242
+ ):
243
+ return {
244
+ "filename_window_wagon": filename_window_pattern,
245
+ "WindowRoiSize": WINDOW_ROI_SIZE,
246
+ "filename_mask_static": filename_mask_gaps,
247
+ "filename_mask_reference": filename_mask_beamstop,
248
+ "algorithm": "numpy",
249
+ "save_secondary_scattering": True,
250
+ "pre_caving": True,
251
+ "flip_caving": False,
252
+ }
253
+
254
+
255
+ @pytest.fixture
256
+ def inputs_task_cave(filename_mask_beamstop):
257
+ return {
258
+ "filename_mask_static": filename_mask_beamstop,
259
+ "algorithm": "numpy",
260
+ "save_variance": False,
261
+ }
262
+
263
+
264
+ @pytest.fixture
265
+ def inputs_task_azim(filename_mask_beamstop):
266
+ return {
267
+ "filename_mask": filename_mask_beamstop,
268
+ "method": ("bbox", "csr", "cython"),
269
+ }
270
+
271
+
272
+ @pytest.fixture
273
+ def inputs_task_ave():
274
+ return {}
275
+
276
+
277
+ @pytest.fixture
278
+ def dataset_signal_norm(filename_processed_norm_reference):
279
+ with h5py.File(filename_processed_norm_reference, "r") as f:
280
+ dataset = f["entry_0000/PyFAI/result_norm/data"][
281
+ INDEX_RANGE[0] : INDEX_RANGE[1]
282
+ ]
283
+ return dataset
284
+
285
+
286
+ @pytest.fixture
287
+ def dataset_sigma_norm(filename_processed_norm_reference):
288
+ with h5py.File(filename_processed_norm_reference, "r") as f:
289
+ dataset = f["entry_0000/PyFAI/result_norm/data_errors"][
290
+ INDEX_RANGE[0] : INDEX_RANGE[1]
291
+ ]
292
+ return dataset
293
+
294
+
295
+ @pytest.fixture
296
+ def dataset_signal_2scat(filename_processed_2scat_full):
297
+ with h5py.File(filename_processed_2scat_full, "r") as f:
298
+ dataset = f["entry_0000/PyFAI/result_2scat/data"][
299
+ INDEX_RANGE[0] : INDEX_RANGE[1]
300
+ ]
301
+ return dataset
302
+
303
+
304
+ @pytest.fixture
305
+ def dataset_sigma_2scat(filename_processed_2scat_full):
306
+ with h5py.File(filename_processed_2scat_full, "r") as f:
307
+ dataset = f["entry_0000/PyFAI/result_2scat/data_errors"][
308
+ INDEX_RANGE[0] : INDEX_RANGE[1]
309
+ ]
310
+ return dataset
311
+
312
+
313
+ @pytest.fixture
314
+ def dataset_signal_cave_new(filename_processed_cave_full):
315
+ with h5py.File(filename_processed_cave_full, "r") as f:
316
+ dataset = f["entry_0000/PyFAI/result_cave/data"][
317
+ INDEX_RANGE[0] : INDEX_RANGE[1]
318
+ ]
319
+ return dataset
320
+
321
+
322
+ @pytest.fixture
323
+ def dataset_sigma_cave_new(filename_processed_cave_full):
324
+ with h5py.File(filename_processed_cave_full, "r") as f:
325
+ dataset = f["entry_0000/PyFAI/result_cave/data_errors"][
326
+ INDEX_RANGE[0] : INDEX_RANGE[1]
327
+ ]
328
+ return dataset
329
+
330
+
331
+ @pytest.fixture
332
+ def dataset_signal_azim_new(filename_processed_azim_full):
333
+ with h5py.File(filename_processed_azim_full, "r") as f:
334
+ dataset = f["entry_0000/PyFAI/result_azim/data"][
335
+ INDEX_RANGE[0] : INDEX_RANGE[1]
336
+ ]
337
+ return dataset
338
+
339
+
340
+ @pytest.fixture
341
+ def dataset_sigma_azim_new(filename_processed_azim_full):
342
+ with h5py.File(filename_processed_azim_full, "r") as f:
343
+ dataset = f["entry_0000/PyFAI/result_azim/data_errors"][
344
+ INDEX_RANGE[0] : INDEX_RANGE[1]
345
+ ]
346
+ return dataset
347
+
348
+
349
+ @pytest.fixture
350
+ def dataset_sumsignal_azim_new(filename_processed_azim_full):
351
+ with h5py.File(filename_processed_azim_full, "r") as f:
352
+ dataset = f["entry_0000/PyFAI/result_azim/sum_signal"][
353
+ INDEX_RANGE[0] : INDEX_RANGE[1]
354
+ ]
355
+ return dataset
356
+
357
+
358
+ @pytest.fixture
359
+ def dataset_sumnorm_azim_new(filename_processed_azim_full):
360
+ with h5py.File(filename_processed_azim_full, "r") as f:
361
+ dataset = f["entry_0000/PyFAI/result_azim/sum_normalization"][
362
+ INDEX_RANGE[0] : INDEX_RANGE[1]
363
+ ]
364
+ return dataset
365
+
366
+
367
+ @pytest.fixture
368
+ def dataset_sumvariance_azim_new(filename_processed_azim_full):
369
+ with h5py.File(filename_processed_azim_full, "r") as f:
370
+ dataset = f["entry_0000/PyFAI/result_azim/sum_variance"][
371
+ INDEX_RANGE[0] : INDEX_RANGE[1]
372
+ ]
373
+ return dataset
374
+
375
+
376
+ @pytest.fixture
377
+ def dataset_radial_array(filename_processed_azim_full):
378
+ with h5py.File(filename_processed_azim_full, "r") as f:
379
+ dataset = f["entry_0000/PyFAI/result_azim/q"][:]
380
+ return dataset
381
+
382
+
383
+ @pytest.fixture
384
+ def dataset_azimuthal_array(filename_processed_azim_full):
385
+ with h5py.File(filename_processed_azim_full, "r") as f:
386
+ dataset = f["entry_0000/PyFAI/result_azim/chi"][:]
387
+ return dataset
388
+
389
+
390
+ @pytest.fixture
391
+ def workflow_norm():
392
+ return {
393
+ "graph": {"id": "workflow_norm"},
394
+ "nodes": [
395
+ {
396
+ "id": "norm",
397
+ "task_type": "class",
398
+ "task_identifier": "ewoksid02.tasks.normalizationtask.NormalizationTask",
399
+ },
400
+ ],
401
+ }
402
+
403
+
404
+ @pytest.fixture
405
+ def workflow_norm_2scat():
406
+ return {
407
+ "graph": {"id": "workflow_norm_2scat"},
408
+ "nodes": [
409
+ {
410
+ "id": "norm",
411
+ "task_type": "class",
412
+ "task_identifier": "ewoksid02.tasks.normalizationtask.NormalizationTask",
413
+ },
414
+ {
415
+ "id": "2scat",
416
+ "task_type": "class",
417
+ "task_identifier": "ewoksid02.tasks.secondaryscatteringtask.SecondaryScatteringTask",
418
+ },
419
+ ],
420
+ "links": [
421
+ {
422
+ "source": "norm",
423
+ "target": "2scat",
424
+ "map_all_data": True,
425
+ },
426
+ ],
427
+ }
428
+
429
+
430
+ @pytest.fixture
431
+ def workflow_norm_2scat_cave():
432
+ return {
433
+ "graph": {"id": "workflow_norm_2scat_cave"},
434
+ "nodes": [
435
+ {
436
+ "id": "norm",
437
+ "task_type": "class",
438
+ "task_identifier": "ewoksid02.tasks.normalizationtask.NormalizationTask",
439
+ },
440
+ {
441
+ "id": "2scat",
442
+ "task_type": "class",
443
+ "task_identifier": "ewoksid02.tasks.secondaryscatteringtask.SecondaryScatteringTask",
444
+ },
445
+ {
446
+ "id": "cave",
447
+ "task_type": "class",
448
+ "task_identifier": "ewoksid02.tasks.cavingtask.CavingBeamstopTask",
449
+ },
450
+ ],
451
+ "links": [
452
+ {
453
+ "source": "norm",
454
+ "target": "2scat",
455
+ "map_all_data": True,
456
+ },
457
+ {
458
+ "source": "2scat",
459
+ "target": "cave",
460
+ "map_all_data": True,
461
+ },
462
+ ],
463
+ }
464
+
465
+
466
+ @pytest.fixture
467
+ def workflow_norm_2scat_cave_azim():
468
+ return {
469
+ "graph": {"id": "workflow_norm_2scat_cave_azim"},
470
+ "nodes": [
471
+ {
472
+ "id": "norm",
473
+ "task_type": "class",
474
+ "task_identifier": "ewoksid02.tasks.normalizationtask.NormalizationTask",
475
+ },
476
+ {
477
+ "id": "2scat",
478
+ "task_type": "class",
479
+ "task_identifier": "ewoksid02.tasks.secondaryscatteringtask.SecondaryScatteringTask",
480
+ },
481
+ {
482
+ "id": "cave",
483
+ "task_type": "class",
484
+ "task_identifier": "ewoksid02.tasks.cavingtask.CavingBeamstopTask",
485
+ },
486
+ {
487
+ "id": "azim",
488
+ "task_type": "class",
489
+ "task_identifier": "ewoksid02.tasks.azimuthaltask.AzimuthalTask",
490
+ },
491
+ ],
492
+ "links": [
493
+ {
494
+ "source": "norm",
495
+ "target": "2scat",
496
+ "map_all_data": True,
497
+ },
498
+ {
499
+ "source": "2scat",
500
+ "target": "cave",
501
+ "map_all_data": True,
502
+ },
503
+ {
504
+ "source": "cave",
505
+ "target": "azim",
506
+ "map_all_data": True,
507
+ },
508
+ ],
509
+ }
510
+
511
+
512
+ @pytest.fixture
513
+ def workflow_norm_2scat_cave_azim_ave():
514
+ return {
515
+ "graph": {"id": "workflow_norm_2scat_cave_azim_ave"},
516
+ "nodes": [
517
+ {
518
+ "id": "norm",
519
+ "task_type": "class",
520
+ "task_identifier": "ewoksid02.tasks.normalizationtask.NormalizationTask",
521
+ },
522
+ {
523
+ "id": "2scat",
524
+ "task_type": "class",
525
+ "task_identifier": "ewoksid02.tasks.secondaryscatteringtask.SecondaryScatteringTask",
526
+ },
527
+ {
528
+ "id": "cave",
529
+ "task_type": "class",
530
+ "task_identifier": "ewoksid02.tasks.cavingtask.CavingBeamstopTask",
531
+ },
532
+ {
533
+ "id": "azim",
534
+ "task_type": "class",
535
+ "task_identifier": "ewoksid02.tasks.azimuthaltask.AzimuthalTask",
536
+ },
537
+ {
538
+ "id": "ave",
539
+ "task_type": "class",
540
+ "task_identifier": "ewoksid02.tasks.averagetask.AverageTask",
541
+ },
542
+ ],
543
+ "links": [
544
+ {
545
+ "source": "norm",
546
+ "target": "2scat",
547
+ "map_all_data": True,
548
+ },
549
+ {
550
+ "source": "2scat",
551
+ "target": "cave",
552
+ "map_all_data": True,
553
+ },
554
+ {
555
+ "source": "cave",
556
+ "target": "azim",
557
+ "map_all_data": True,
558
+ },
559
+ {
560
+ "source": "azim",
561
+ "target": "ave",
562
+ "map_all_data": True,
563
+ },
564
+ ],
565
+ }
566
+
567
+
568
+ @pytest.fixture
569
+ def workflow_saxs_loop():
570
+ return {
571
+ "graph": {"id": "workflow_saxs_loop"},
572
+ "nodes": [
573
+ {
574
+ "id": "norm",
575
+ "task_type": "class",
576
+ "task_identifier": "ewoksid02.tasks.normalizationtask.NormalizationTask",
577
+ "force_start_node": True,
578
+ "default_inputs": [{"name": "reading_node", "value": True}],
579
+ },
580
+ {
581
+ "id": "2scat",
582
+ "task_type": "class",
583
+ "task_identifier": "ewoksid02.tasks.secondaryscatteringtask.SecondaryScatteringTask",
584
+ },
585
+ {
586
+ "id": "cave",
587
+ "task_type": "class",
588
+ "task_identifier": "ewoksid02.tasks.cavingtask.CavingBeamstopTask",
589
+ },
590
+ {
591
+ "id": "azim",
592
+ "task_type": "class",
593
+ "task_identifier": "ewoksid02.tasks.azimuthaltask.AzimuthalTask",
594
+ },
595
+ {
596
+ "id": "ave",
597
+ "task_type": "class",
598
+ "task_identifier": "ewoksid02.tasks.averagetask.AverageTask",
599
+ },
600
+ {
601
+ "id": "scalers",
602
+ "task_type": "class",
603
+ "task_identifier": "ewoksid02.tasks.scalerstask.ScalersTask",
604
+ },
605
+ ],
606
+ "links": [
607
+ {
608
+ "source": "norm",
609
+ "target": "2scat",
610
+ "map_all_data": True,
611
+ "conditions": [{"source_output": "continue_pipeline", "value": True}],
612
+ },
613
+ {
614
+ "source": "2scat",
615
+ "target": "cave",
616
+ "map_all_data": True,
617
+ },
618
+ {
619
+ "source": "cave",
620
+ "target": "azim",
621
+ "map_all_data": True,
622
+ },
623
+ {
624
+ "source": "azim",
625
+ "target": "ave",
626
+ "map_all_data": True,
627
+ },
628
+ {
629
+ "source": "ave",
630
+ "target": "scalers",
631
+ "map_all_data": True,
632
+ },
633
+ {
634
+ "source": "scalers",
635
+ "target": "norm",
636
+ "map_all_data": True,
637
+ },
638
+ ],
639
+ }
@@ -0,0 +1,64 @@
1
+ from ewoksid02.tasks import (
2
+ ID02ProcessingTask,
3
+ NormalizationTask,
4
+ )
5
+ from .conftest import (
6
+ RAW_LIMA_FILE,
7
+ RESOURCES,
8
+ RAW_MASTER_FILE,
9
+ FILENAME_PROCESSED_NORM_NEW,
10
+ )
11
+ from blissdata.redis_engine.scan import Scan
12
+
13
+ inputs_eiger2 = {
14
+ "detector_name": "eiger2",
15
+ "filename_data": RESOURCES.getfile(RAW_MASTER_FILE),
16
+ "filename_lima": RESOURCES.getfile(RAW_LIMA_FILE),
17
+ "scan_nb": 9,
18
+ "subscan": 1,
19
+ "do_process": True,
20
+ "do_save": False,
21
+ }
22
+
23
+
24
+ def _debug_normalizationtask_offline_from_raw(detector_name: str = "eiger2"):
25
+ return NormalizationTask(
26
+ inputs={
27
+ "detector_name": detector_name,
28
+ "filename_data": RESOURCES.getfile(RAW_MASTER_FILE),
29
+ "filename_lima": RESOURCES.getfile(RAW_LIMA_FILE),
30
+ "scan_nb": 9,
31
+ "subscan": 1,
32
+ "do_process": True,
33
+ "do_save": False,
34
+ }
35
+ )
36
+
37
+
38
+ def _debug_normalizationtask_offline_from_processed(detector_name: str = "eiger2"):
39
+ return NormalizationTask(
40
+ inputs={
41
+ "detector_name": detector_name,
42
+ "filename_data": RESOURCES.getfile(FILENAME_PROCESSED_NORM_NEW),
43
+ "do_process": True,
44
+ "do_save": True,
45
+ "processing_filename": "/tmp_14_days/edgar/kkk.h5",
46
+ }
47
+ )
48
+
49
+
50
+ def _debug_processing_task_online(scan: Scan, detector_name: str):
51
+ return ID02ProcessingTask(
52
+ inputs={
53
+ "detector_name": detector_name,
54
+ "scan_memory_url": scan.key,
55
+ "beacon_host": "id02:25000",
56
+ "filename_data": scan.info["filename"],
57
+ "filename_lima": f"{scan.info['images_path'].format(img_acq_device=detector_name)}{'%02d' % 0}.h5",
58
+ "scan_nb": scan.info["scan_nb"],
59
+ "subscan": 1,
60
+ "do_process": False,
61
+ "do_save": False,
62
+ "lima_index_number_format": "%02d",
63
+ }
64
+ )