dasksf 0.2.0__tar.gz → 1.2.3__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.
- {dasksf-0.2.0 → dasksf-1.2.3}/PKG-INFO +4 -5
- {dasksf-0.2.0 → dasksf-1.2.3}/pyproject.toml +4 -3
- {dasksf-0.2.0 → dasksf-1.2.3}/src/dasksf/mypipe.py +39 -19
- {dasksf-0.2.0 → dasksf-1.2.3}/LICENSE +0 -0
- {dasksf-0.2.0 → dasksf-1.2.3}/README.md +0 -0
- {dasksf-0.2.0 → dasksf-1.2.3}/src/dasksf/__init__.py +0 -0
- {dasksf-0.2.0 → dasksf-1.2.3}/src/dasksf/def_cluster.py +0 -0
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: dasksf
|
|
3
|
-
Version:
|
|
3
|
+
Version: 1.2.3
|
|
4
4
|
Summary: Radio astronomy source finding using dask and plugging in other source finders
|
|
5
5
|
License: BSD-3-Clause
|
|
6
6
|
Author: vla22
|
|
7
7
|
Author-email: vla22@cam.ac.uk
|
|
8
|
-
Requires-Python: >=3.
|
|
8
|
+
Requires-Python: >=3.14,<4.0
|
|
9
9
|
Classifier: License :: OSI Approved :: BSD License
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
13
11
|
Requires-Dist: dask[complete] (>=2025.2.0,<2026.0.0)
|
|
14
12
|
Requires-Dist: distributed (>=2025.2.0,<2026.0.0)
|
|
15
|
-
Requires-Dist: fits2tmp (>=0.
|
|
13
|
+
Requires-Dist: fits2tmp (>=1.0.2,<2.0.0)
|
|
14
|
+
Requires-Dist: numpy (==2.1.2)
|
|
16
15
|
Description-Content-Type: text/markdown
|
|
17
16
|
|
|
18
17
|
# dasksf
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
[project]
|
|
3
3
|
name = "dasksf"
|
|
4
|
-
version = "
|
|
4
|
+
version = "1.2.3"
|
|
5
5
|
description = "Radio astronomy source finding using dask and plugging in other source finders"
|
|
6
6
|
authors = [
|
|
7
7
|
{ name ="vla22", email= "vla22@cam.ac.uk"},
|
|
@@ -11,10 +11,11 @@ readme = "README.md"
|
|
|
11
11
|
repository = "https://gitlab.developers.cam.ac.uk/phy/ra/vla22-phd/dasksf"
|
|
12
12
|
|
|
13
13
|
[tool.poetry.dependencies]
|
|
14
|
-
python = "^3.
|
|
14
|
+
python = "^3.14"
|
|
15
15
|
dask = {extras = ["complete"], version = "^2025.2.0"}
|
|
16
16
|
distributed = "^2025.2.0"
|
|
17
|
-
|
|
17
|
+
numpy = "=2.1.2"
|
|
18
|
+
fits2tmp = "^1.0.2"
|
|
18
19
|
|
|
19
20
|
[project.scripts]
|
|
20
21
|
def_cluster = "dasksf.def_cluster:main"
|
|
@@ -7,6 +7,7 @@ from dask.distributed import performance_report, get_task_stream
|
|
|
7
7
|
from dask import delayed
|
|
8
8
|
from dask.diagnostics import Profiler, ResourceProfiler, CacheProfiler, visualize
|
|
9
9
|
from datetime import timedelta
|
|
10
|
+
import time
|
|
10
11
|
import tempfile
|
|
11
12
|
import shutil
|
|
12
13
|
from functools import reduce
|
|
@@ -30,7 +31,6 @@ class Pipeline:
|
|
|
30
31
|
self.tmpdir = tmpdir
|
|
31
32
|
self.sofia_params = sofia_params
|
|
32
33
|
self.im_shape = [int(x) for x in im_shape.split(",")]
|
|
33
|
-
print(self.im_shape)
|
|
34
34
|
self.overlap = [int(x) for x in overlap.split(",")]
|
|
35
35
|
self.im_as_slice = []
|
|
36
36
|
for i in range(len(self.im_shape)):
|
|
@@ -47,6 +47,9 @@ class Pipeline:
|
|
|
47
47
|
else:
|
|
48
48
|
self.chunks = self.chunk_info
|
|
49
49
|
self.ch_pix = "auto"
|
|
50
|
+
self.overlap_pix = 0
|
|
51
|
+
for i in range(int(self.n_dims)):
|
|
52
|
+
self.overlap_pix = self.overlap[i] + self.overlap_pix
|
|
50
53
|
if "fits" in self.data:
|
|
51
54
|
self.filetype = "fits"
|
|
52
55
|
elif "zarr" in self.data:
|
|
@@ -67,45 +70,61 @@ class Pipeline:
|
|
|
67
70
|
self.outputlog.addHandler(output_handler)
|
|
68
71
|
|
|
69
72
|
def run_sof(self, filename):
|
|
70
|
-
|
|
73
|
+
try:
|
|
74
|
+
a = subprocess.run(["sofia", self.sofia_params, "input.data="+filename, "output.directory="+self.tmpdir])
|
|
75
|
+
subprocess.run(["rm", "-r", filename])
|
|
76
|
+
return a.returncode
|
|
77
|
+
except Exception as e:
|
|
78
|
+
self.mainlog.error(e)
|
|
79
|
+
return
|
|
71
80
|
|
|
72
81
|
def dedupe(self, file1, file2):
|
|
73
82
|
if "_cat.xml" not in file1:
|
|
74
83
|
file1 = file1 + "_cat.xml"
|
|
75
84
|
if "_cat.xml" not in file2:
|
|
76
85
|
file2 = file2 + "_cat.xml"
|
|
86
|
+
tempfile.tempdir = self.tmpdir
|
|
77
87
|
f = tempfile.NamedTemporaryFile(delete=False)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
88
|
+
try:
|
|
89
|
+
subprocess.run(["stilts", "tskymatch2", "in1="+file1, "in2="+file2, "join=1or2", "out="+f.name + "_cat.xml", "error=1"])
|
|
90
|
+
subprocess.run(["rm", file1])
|
|
91
|
+
subprocess.run(["rm", file2])
|
|
92
|
+
return f.name + "_cat.xml"
|
|
93
|
+
except Exception as e:
|
|
94
|
+
self.mainlog.error(e, "input_files=", file1, file2)
|
|
95
|
+
with open(file1, 'rb') as tf, open(self.outputdir + file1, 'wb') as destfil:
|
|
96
|
+
shutil.copyfileobj(tf, destfil)
|
|
97
|
+
with open(file2, 'rb') as tf, open(self.outputdir + file2, 'wb') as destfil:
|
|
98
|
+
shutil.copyfileobj(tf, destfil)
|
|
99
|
+
|
|
81
100
|
def run_sofia_pipeline(self):
|
|
82
|
-
print(self.im_as_slice)
|
|
83
101
|
client = self.client
|
|
84
102
|
start_time = time.monotonic()
|
|
85
|
-
#
|
|
86
|
-
with
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
print(filelist)
|
|
103
|
+
# performance_report(filename=self.outputdir + "perf_report.html"),
|
|
104
|
+
with Profiler() as prof, ResourceProfiler(dt=0.05) as rprof, CacheProfiler() as cprof, get_task_stream(plot="save", filename=(self.outputdir + "task_stream.html")) as ts:
|
|
105
|
+
filelist = []
|
|
106
|
+
f2t.fits2tmp.fakefits2tmpfiles(self.filetype, self.data, self.tmpdir, self.im_shape, self.header_loc, self.chunks, self.overlap, fpaths=filelist)
|
|
90
107
|
scatter_files = client.scatter(filelist)
|
|
91
108
|
load_time = time.monotonic()
|
|
92
109
|
outlist = []
|
|
93
110
|
for i in filelist:
|
|
94
|
-
|
|
95
|
-
|
|
111
|
+
try:
|
|
112
|
+
a = self.run_sof(i)
|
|
113
|
+
if a == 0:
|
|
114
|
+
outlist.append(i[i.index('/'):])
|
|
115
|
+
except Exception as e:
|
|
116
|
+
self.mainlog.error(e)
|
|
96
117
|
calc_done = time.monotonic()
|
|
97
118
|
output = client.gather(outlist)
|
|
98
|
-
|
|
99
|
-
fin_cat = reduce(self.dedupe, output)
|
|
119
|
+
fincat = reduce(self.dedupe, output)
|
|
100
120
|
end_time = time.monotonic()
|
|
101
|
-
|
|
102
|
-
with open(fin_cat + "_cat.xml", 'rb') as tf, open(self.outputdir + "/combined_catalogue.xml", 'wb') as destfil:
|
|
121
|
+
with open(fincat, 'rb') as tf, open(self.outputdir + "/combined_catalogue"+ str(time.time_ns()) +".xml", 'wb') as destfil:
|
|
103
122
|
shutil.copyfileobj(tf, destfil)
|
|
104
123
|
self.outputlog.info(
|
|
105
|
-
", %s, %s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s",
|
|
124
|
+
", %s, %s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s",
|
|
106
125
|
#%s, %s, %s",
|
|
107
126
|
str(self.platform),
|
|
108
|
-
|
|
127
|
+
#str(self.dask_version),
|
|
109
128
|
str(self.workflow),
|
|
110
129
|
str(self.nodes),
|
|
111
130
|
str(self.n_workers),
|
|
@@ -114,6 +133,7 @@ class Pipeline:
|
|
|
114
133
|
self.n_dims,
|
|
115
134
|
self.im_pix,
|
|
116
135
|
self.ch_pix,
|
|
136
|
+
self.overlap_pix,
|
|
117
137
|
self.filetype,
|
|
118
138
|
str(timedelta(seconds = calc_done - start_time)),
|
|
119
139
|
str(timedelta(seconds = load_time - start_time)),
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|