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.
- ewoksid02/__init__.py +0 -0
- ewoksid02/ocl/__init__.py +0 -0
- ewoksid02/resources/__init__.py +8 -0
- ewoksid02/resources/saxs_loop.json +96 -0
- ewoksid02/resources/template_saxs.yaml +37 -0
- ewoksid02/scripts/__init__.py +0 -0
- ewoksid02/scripts/__main__.py +70 -0
- ewoksid02/scripts/parsers.py +224 -0
- ewoksid02/scripts/saxs/__init__.py +0 -0
- ewoksid02/scripts/saxs/main.py +255 -0
- ewoksid02/scripts/saxs/slurm_python_post_script.py +3 -0
- ewoksid02/scripts/saxs/slurm_python_pre_script.py +5 -0
- ewoksid02/scripts/utils.py +21 -0
- ewoksid02/scripts/xpcs/__init__.py +0 -0
- ewoksid02/scripts/xpcs/__main__.py +3 -0
- ewoksid02/tasks/__init__.py +7 -0
- ewoksid02/tasks/averagetask.py +179 -0
- ewoksid02/tasks/azimuthaltask.py +272 -0
- ewoksid02/tasks/cavingtask.py +170 -0
- ewoksid02/tasks/dahuprocessingtask.py +71 -0
- ewoksid02/tasks/end.py +35 -0
- ewoksid02/tasks/id02processingtask.py +2582 -0
- ewoksid02/tasks/looptask.py +672 -0
- ewoksid02/tasks/metadatatask.py +879 -0
- ewoksid02/tasks/normalizationtask.py +204 -0
- ewoksid02/tasks/scalerstask.py +46 -0
- ewoksid02/tasks/secondaryscatteringtask.py +159 -0
- ewoksid02/tasks/sumtask.py +45 -0
- ewoksid02/tests/__init__.py +3 -0
- ewoksid02/tests/conftest.py +639 -0
- ewoksid02/tests/debug.py +64 -0
- ewoksid02/tests/test_2scat_node.py +119 -0
- ewoksid02/tests/test_ave_node.py +106 -0
- ewoksid02/tests/test_azim_node.py +89 -0
- ewoksid02/tests/test_cave_node.py +118 -0
- ewoksid02/tests/test_norm_node.py +190 -0
- ewoksid02/tests/test_saxs.py +69 -0
- ewoksid02/tests/test_sumtask.py +10 -0
- ewoksid02/tests/utils.py +514 -0
- ewoksid02/utils/__init__.py +22 -0
- ewoksid02/utils/average.py +158 -0
- ewoksid02/utils/blissdata.py +1157 -0
- ewoksid02/utils/caving.py +851 -0
- ewoksid02/utils/cupyutils.py +42 -0
- ewoksid02/utils/io.py +722 -0
- ewoksid02/utils/normalization.py +804 -0
- ewoksid02/utils/pyfai.py +424 -0
- ewoksid02/utils/secondaryscattering.py +597 -0
- ewoksid02-0.1.0.dist-info/METADATA +76 -0
- ewoksid02-0.1.0.dist-info/RECORD +54 -0
- ewoksid02-0.1.0.dist-info/WHEEL +5 -0
- ewoksid02-0.1.0.dist-info/entry_points.txt +5 -0
- ewoksid02-0.1.0.dist-info/licenses/LICENSE.md +20 -0
- ewoksid02-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import os
|
|
5
|
+
|
|
6
|
+
import gevent
|
|
7
|
+
import tango
|
|
8
|
+
from ewokscore import Task
|
|
9
|
+
|
|
10
|
+
# Deprecated, to be substituted by the Id02ProcessingTask children
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class SingleDetector(
|
|
14
|
+
Task, input_names=["parameters"], output_names=["files", "runtime", "logging"]
|
|
15
|
+
):
|
|
16
|
+
"""
|
|
17
|
+
Trigger DAHU in the workflow.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
def tango_execute(self, N, *args, **kwargs):
|
|
21
|
+
|
|
22
|
+
for i in range(N):
|
|
23
|
+
try:
|
|
24
|
+
return self._proxy.command_inout(*args, **kwargs)
|
|
25
|
+
except tango.CommunicationFailed:
|
|
26
|
+
if i == N - 1:
|
|
27
|
+
raise
|
|
28
|
+
|
|
29
|
+
gevent.sleep(i**2)
|
|
30
|
+
|
|
31
|
+
def run(self):
|
|
32
|
+
|
|
33
|
+
proxies = ["dau/dahu/2", "dau/dahu/4", "dau/dahu/5", "dau/dahu/1", "dau/dahu/3"]
|
|
34
|
+
|
|
35
|
+
params = self.inputs["parameters"]
|
|
36
|
+
|
|
37
|
+
# Create the output dir as DAHU has trouble to do it properly
|
|
38
|
+
if "output_dir" in params:
|
|
39
|
+
os.makedirs(params["output_dir"], exist_ok=True)
|
|
40
|
+
|
|
41
|
+
for p in proxies:
|
|
42
|
+
try:
|
|
43
|
+
params["dahu_proxy"] = p
|
|
44
|
+
self._proxy = tango.DeviceProxy(p)
|
|
45
|
+
|
|
46
|
+
pset = ["id02.singledetector", json.dumps(params)]
|
|
47
|
+
|
|
48
|
+
jobid = self.tango_execute(2, "startJob", pset)
|
|
49
|
+
except Exception:
|
|
50
|
+
print(f"Unable to submit job on {p}")
|
|
51
|
+
continue
|
|
52
|
+
break
|
|
53
|
+
else:
|
|
54
|
+
raise RuntimeError("Unable to find a DAHU server to submit the job!")
|
|
55
|
+
|
|
56
|
+
print(f"DAHU job id: {jobid} on {p}")
|
|
57
|
+
gevent.sleep(2)
|
|
58
|
+
self.tango_execute(30, "waitJob", jobid)
|
|
59
|
+
|
|
60
|
+
ret = json.loads(self.tango_execute(5, "getJobOutput", jobid))
|
|
61
|
+
|
|
62
|
+
# print(ret)
|
|
63
|
+
|
|
64
|
+
self.outputs["files"] = ret["files"]
|
|
65
|
+
self.outputs["runtime"] = ret["job_runtime"]
|
|
66
|
+
self.outputs["logging"] = ret["logging"]
|
|
67
|
+
|
|
68
|
+
if "error" in ret:
|
|
69
|
+
print(ret["error"])
|
|
70
|
+
|
|
71
|
+
raise RuntimeError(f"DAHU job failed. \n{ret['error']}")
|
ewoksid02/tasks/end.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from ewokscore import Task
|
|
2
|
+
import logging
|
|
3
|
+
import gc
|
|
4
|
+
|
|
5
|
+
logger = logging.getLogger(__name__)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class EndTask(
|
|
9
|
+
Task,
|
|
10
|
+
optional_input_names=[
|
|
11
|
+
"detector_name",
|
|
12
|
+
"scan_memory_url",
|
|
13
|
+
"filename_data",
|
|
14
|
+
"scan_nb",
|
|
15
|
+
"index_range_last",
|
|
16
|
+
"loop_nb",
|
|
17
|
+
],
|
|
18
|
+
output_names=[
|
|
19
|
+
"detector_name",
|
|
20
|
+
"scan_memory_url",
|
|
21
|
+
"filename_data",
|
|
22
|
+
"scan_nb",
|
|
23
|
+
"index_range_last",
|
|
24
|
+
"loop_nb",
|
|
25
|
+
],
|
|
26
|
+
):
|
|
27
|
+
def run(self):
|
|
28
|
+
logger.warning("\n\n\tEndTask. End of the workflow\n")
|
|
29
|
+
self.outputs.detector_name = self.get_input_value("detector_name")
|
|
30
|
+
self.outputs.scan_memory_url = self.get_input_value("scan_memory_url")
|
|
31
|
+
self.outputs.filename_data = self.get_input_value("filename_data")
|
|
32
|
+
self.outputs.scan_nb = self.get_input_value("scan_nb")
|
|
33
|
+
self.outputs.index_range_last = self.get_input_value("index_range_last")
|
|
34
|
+
self.outputs.loop_nb = self.get_input_value("loop_nb")
|
|
35
|
+
gc.collect()
|