pspipe 0.12__tar.gz → 0.13__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.
- {pspipe-0.12 → pspipe-0.13}/PKG-INFO +2 -2
- {pspipe-0.12 → pspipe-0.13}/pspipe/settings.py +19 -2
- {pspipe-0.12 → pspipe-0.13}/pspipe/tasks.py +71 -12
- {pspipe-0.12 → pspipe-0.13}/pspipe/templates/default_settings.toml +7 -0
- {pspipe-0.12 → pspipe-0.13}/pyproject.toml +2 -2
- {pspipe-0.12 → pspipe-0.13}/LICENSE +0 -0
- {pspipe-0.12 → pspipe-0.13}/README.md +0 -0
- {pspipe-0.12 → pspipe-0.13}/pspipe/__init__.py +0 -0
- {pspipe-0.12 → pspipe-0.13}/pspipe/database.py +0 -0
- {pspipe-0.12 → pspipe-0.13}/pspipe/obsdata.py +0 -0
- {pspipe-0.12 → pspipe-0.13}/pspipe/templates/config/eor_bins_a12.parset +0 -0
- {pspipe-0.12 → pspipe-0.13}/pspipe/templates/config/eor_bins_alo.parset +0 -0
- {pspipe-0.12 → pspipe-0.13}/pspipe/templates/config/eor_bins_hba.parset +0 -0
- {pspipe-0.12 → pspipe-0.13}/pspipe/templates/config/eor_bins_nenufar.parset +0 -0
- {pspipe-0.12 → pspipe-0.13}/pspipe/templates/config/flagger.parset +0 -0
- {pspipe-0.12 → pspipe-0.13}/pspipe/templates/config/flagger_pre_combine.parset +0 -0
- {pspipe-0.12 → pspipe-0.13}/pspipe/templates/config/gpr_config_a12.parset +0 -0
- {pspipe-0.12 → pspipe-0.13}/pspipe/templates/config/gpr_config_hba.parset +0 -0
- {pspipe-0.12 → pspipe-0.13}/pspipe/templates/config/gpr_config_nenufar.parset +0 -0
- {pspipe-0.12 → pspipe-0.13}/pspipe/templates/config/gpr_config_v.parset +0 -0
- {pspipe-0.12 → pspipe-0.13}/pspipe/templates/config/ps_config_a12.parset +0 -0
- {pspipe-0.12 → pspipe-0.13}/pspipe/templates/config/ps_config_alo.parset +0 -0
- {pspipe-0.12 → pspipe-0.13}/pspipe/templates/config/ps_config_hba.parset +0 -0
- {pspipe-0.12 → pspipe-0.13}/pspipe/templates/config/ps_config_nenufar.parset +0 -0
- {pspipe-0.12 → pspipe-0.13}/pspipe/templates/default_a12.toml +0 -0
- {pspipe-0.12 → pspipe-0.13}/pspipe/templates/default_alo.toml +0 -0
- {pspipe-0.12 → pspipe-0.13}/pspipe/templates/default_hba.toml +0 -0
- {pspipe-0.12 → pspipe-0.13}/pspipe/templates/default_nenufar.toml +0 -0
- {pspipe-0.12 → pspipe-0.13}/pspipe/tools/__init__.py +0 -0
- {pspipe-0.12 → pspipe-0.13}/pspipe/tools/psdb.py +0 -0
- {pspipe-0.12 → pspipe-0.13}/pspipe/tools/pspipe.py +0 -0
- {pspipe-0.12 → pspipe-0.13}/pspipe/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pspipe
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.13
|
|
4
4
|
Summary: Power spectra pipeline for Cosmic Dawn, Epoch of Reionization radio interferometric experiments
|
|
5
5
|
License-Expression: GPL-3.0-or-later
|
|
6
6
|
License-File: LICENSE
|
|
@@ -18,7 +18,7 @@ Provides-Extra: docs
|
|
|
18
18
|
Provides-Extra: ml-gpr
|
|
19
19
|
Requires-Dist: astropy (>6.0)
|
|
20
20
|
Requires-Dist: click (>=8.0)
|
|
21
|
-
Requires-Dist: libpipe (>=0.
|
|
21
|
+
Requires-Dist: libpipe (>=0.9)
|
|
22
22
|
Requires-Dist: myst-parser (>=2) ; extra == "docs"
|
|
23
23
|
Requires-Dist: ps-eor (>=1.0)
|
|
24
24
|
Requires-Dist: ps-eor[ml-gpr] (>=1.0) ; extra == "ml-gpr"
|
|
@@ -5,13 +5,20 @@
|
|
|
5
5
|
import os
|
|
6
6
|
|
|
7
7
|
import astropy.units as u
|
|
8
|
-
from libpipe import futils
|
|
8
|
+
from libpipe import futils, worker
|
|
9
9
|
from libpipe.settings import BaseSettings
|
|
10
10
|
|
|
11
11
|
# Lazy loaded:
|
|
12
12
|
# - ps_eor.datacube in Settings.validate_vis_cube()
|
|
13
13
|
from . import utils
|
|
14
14
|
|
|
15
|
+
|
|
16
|
+
def worker_resources(s_worker):
|
|
17
|
+
'''worker.resources as {category: {'cpus': .., 'mem': ..}}, or None.'''
|
|
18
|
+
resources = s_worker.get('resources') or {}
|
|
19
|
+
return {k: dict(v) for k, v in resources.items()} or None
|
|
20
|
+
|
|
21
|
+
|
|
15
22
|
TEMPLATE_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'templates')
|
|
16
23
|
|
|
17
24
|
TEMPLATE_NAMES = ['a12', 'nenufar', 'hba', 'alo']
|
|
@@ -51,9 +58,19 @@ class Settings(BaseSettings):
|
|
|
51
58
|
def validate_worker(self, val_fct):
|
|
52
59
|
val_fct(isinstance(self.worker.max_concurrent, int), 'max_concurrent')
|
|
53
60
|
val_fct(not self.worker.env_file or futils.is_file(self.worker.env_file), 'env_file')
|
|
54
|
-
val_fct(self.worker.get('max_time')
|
|
61
|
+
val_fct(not self.worker.get('max_time')
|
|
55
62
|
or (isinstance(self.worker.max_time, (int, float)) and self.worker.max_time > 0),
|
|
56
63
|
'max_time')
|
|
64
|
+
slurm_nodes = self.worker.get('slurm_nodes') or 0
|
|
65
|
+
val_fct(isinstance(slurm_nodes, int) and slurm_nodes >= 0, 'slurm_nodes')
|
|
66
|
+
try:
|
|
67
|
+
resources = worker.resolve_resources(worker_resources(self.worker))
|
|
68
|
+
except (ValueError, TypeError):
|
|
69
|
+
resources = None
|
|
70
|
+
val_fct(resources is not None, 'resources')
|
|
71
|
+
categories = self.worker.get('categories') or {}
|
|
72
|
+
val_fct(resources is None or all(c in resources for c in categories.values()),
|
|
73
|
+
'categories')
|
|
57
74
|
|
|
58
75
|
def validate_merge_ms(self, val_fct):
|
|
59
76
|
val_fct(isinstance(self.merge_ms.apply_aoflagger, bool), 'apply_aoflagger')
|
|
@@ -14,7 +14,7 @@ import astropy.io.fits as pf
|
|
|
14
14
|
import numpy as np
|
|
15
15
|
from libpipe import futils, worker
|
|
16
16
|
|
|
17
|
-
from . import database, utils
|
|
17
|
+
from . import database, settings, utils
|
|
18
18
|
|
|
19
19
|
CWD = os.getcwd()
|
|
20
20
|
|
|
@@ -48,6 +48,11 @@ def get_target_host(in_file, worker_settings):
|
|
|
48
48
|
|
|
49
49
|
class AbstractSubTask:
|
|
50
50
|
|
|
51
|
+
# Task type (worker.categories key, usage summary) and resource category as a job step of an
|
|
52
|
+
# allocation (worker.slurm_nodes): small, medium, high_mem, cpu or heavy
|
|
53
|
+
label = None
|
|
54
|
+
category = 'heavy'
|
|
55
|
+
|
|
51
56
|
def __init__(self, settings_obj, exec_name):
|
|
52
57
|
self.settings = settings_obj
|
|
53
58
|
self.exec_name = exec_name
|
|
@@ -74,23 +79,24 @@ class AbstractTask:
|
|
|
74
79
|
self.name = name
|
|
75
80
|
self.settings = settings_obj.copy()
|
|
76
81
|
self.settings.worker.update(worker_kargs)
|
|
77
|
-
s_worker = self.settings.worker
|
|
78
82
|
|
|
79
83
|
if not self.settings.validate('worker'):
|
|
80
84
|
raise ValueError('Invalid worker settings.')
|
|
81
85
|
|
|
82
|
-
self.worker =
|
|
86
|
+
self.worker = self._worker_pool(name)
|
|
87
|
+
|
|
88
|
+
def _worker_pool(self, name):
|
|
89
|
+
s_worker = self.settings.worker
|
|
90
|
+
# 0 and '' (the defaults) leave max_time unset and slurm_options from the environment
|
|
91
|
+
return worker.get_worker_pool(
|
|
83
92
|
name, nodes=s_worker.nodes, max_concurrent=s_worker.max_concurrent,
|
|
84
|
-
env_file=s_worker.env_file, max_time=s_worker.get('max_time'),
|
|
85
|
-
slurm_options=s_worker.get('slurm_options')
|
|
93
|
+
env_file=s_worker.env_file, max_time=s_worker.get('max_time') or None,
|
|
94
|
+
slurm_options=s_worker.get('slurm_options') or None,
|
|
95
|
+
slurm_nodes=s_worker.get('slurm_nodes') or None,
|
|
96
|
+
resources=settings.worker_resources(s_worker))
|
|
86
97
|
|
|
87
98
|
def init_for_new_task(self, post_task_name):
|
|
88
|
-
|
|
89
|
-
self.worker = worker.get_worker_pool(post_task_name, nodes=s_worker.nodes,
|
|
90
|
-
max_concurrent=s_worker.max_concurrent,
|
|
91
|
-
env_file=s_worker.env_file,
|
|
92
|
-
max_time=s_worker.get('max_time'),
|
|
93
|
-
slurm_options=s_worker.get('slurm_options'))
|
|
99
|
+
self.worker = self._worker_pool(post_task_name)
|
|
94
100
|
|
|
95
101
|
def add_sub_task(self, sub_task, run_on_host=None):
|
|
96
102
|
log_file = sub_task.get_log_file()
|
|
@@ -103,8 +109,10 @@ class AbstractTask:
|
|
|
103
109
|
cmd = sub_task.build_command()
|
|
104
110
|
if self.settings.debug:
|
|
105
111
|
print(cmd)
|
|
112
|
+
label = sub_task.label or sub_task.exec_name
|
|
113
|
+
category = (self.settings.worker.get('categories') or {}).get(label, sub_task.category)
|
|
106
114
|
self.worker.add(cmd, output_file=log_file, done_callback=sub_task.done_callback,
|
|
107
|
-
run_on_host=run_on_host)
|
|
115
|
+
run_on_host=run_on_host, category=category, label=label)
|
|
108
116
|
|
|
109
117
|
def run(self, obs_ids):
|
|
110
118
|
raise NotImplementedError()
|
|
@@ -128,6 +136,9 @@ class AbstractTask:
|
|
|
128
136
|
|
|
129
137
|
class ImagingSubTask(AbstractSubTask):
|
|
130
138
|
|
|
139
|
+
label = 'image'
|
|
140
|
+
category = 'heavy'
|
|
141
|
+
|
|
131
142
|
def __init__(self, settings_obj, obs_id, inp_ms_files, even=False, odd=False, index=0,
|
|
132
143
|
even_odd=False):
|
|
133
144
|
AbstractSubTask.__init__(self, settings_obj, settings_obj.image.imager)
|
|
@@ -368,6 +379,9 @@ class ImagingTask(AbstractTask):
|
|
|
368
379
|
|
|
369
380
|
class GenVisCubeSubTask(AbstractSubTask):
|
|
370
381
|
|
|
382
|
+
label = 'gen_vis_cube'
|
|
383
|
+
category = 'small'
|
|
384
|
+
|
|
371
385
|
def __init__(self, settings_obj, obs_id, stokes, even=False, odd=False, lst_idx=None):
|
|
372
386
|
AbstractSubTask.__init__(self, settings_obj, 'pstool gen_vis_cube')
|
|
373
387
|
self.obs_id = obs_id
|
|
@@ -423,6 +437,9 @@ class GenVisCubeSubTask(AbstractSubTask):
|
|
|
423
437
|
|
|
424
438
|
class EvenOddToSumDiffSubTask(AbstractSubTask):
|
|
425
439
|
|
|
440
|
+
label = 'even_odd_to_sum_diff'
|
|
441
|
+
category = 'small'
|
|
442
|
+
|
|
426
443
|
def __init__(self, settings_obj, obs_id, stokes, lst_idx=None):
|
|
427
444
|
AbstractSubTask.__init__(self, settings_obj, 'pstool even_odd_to_sum_diff')
|
|
428
445
|
self.obs_id = obs_id
|
|
@@ -523,6 +540,9 @@ class GenVisCubeTask(AbstractTask):
|
|
|
523
540
|
|
|
524
541
|
|
|
525
542
|
class ConcatMSSubTask(AbstractSubTask):
|
|
543
|
+
|
|
544
|
+
label = 'concat_ms'
|
|
545
|
+
category = 'medium'
|
|
526
546
|
"""
|
|
527
547
|
Subtask that calls the CLI 'mstool concat <MS...> <OUT.MS>'
|
|
528
548
|
to concatenate MS files in time.
|
|
@@ -604,6 +624,9 @@ class ConcatMSTask(AbstractTask):
|
|
|
604
624
|
|
|
605
625
|
class MergeMSSubTask(AbstractSubTask):
|
|
606
626
|
|
|
627
|
+
label = 'merge_ms'
|
|
628
|
+
category = 'heavy'
|
|
629
|
+
|
|
607
630
|
def __init__(self, settings_obj, ms_files, obs_id_out):
|
|
608
631
|
AbstractSubTask.__init__(self, settings_obj, 'DP3')
|
|
609
632
|
self.db = database.Database(self.settings)
|
|
@@ -718,6 +741,9 @@ class MergeMSTask(AbstractTask):
|
|
|
718
741
|
|
|
719
742
|
class AOFlaggerSubTask(AbstractSubTask):
|
|
720
743
|
|
|
744
|
+
label = 'ao_flag'
|
|
745
|
+
category = 'medium'
|
|
746
|
+
|
|
721
747
|
def __init__(self, settings_obj, ms_file):
|
|
722
748
|
AbstractSubTask.__init__(self, settings_obj, 'DP3')
|
|
723
749
|
self.ms_file = ms_file
|
|
@@ -771,6 +797,9 @@ class AOFlaggerTask(AbstractTask):
|
|
|
771
797
|
|
|
772
798
|
class DP3SubTask(AbstractSubTask):
|
|
773
799
|
|
|
800
|
+
label = 'dp3'
|
|
801
|
+
category = 'heavy'
|
|
802
|
+
|
|
774
803
|
def __init__(self, settings_obj, ms_file):
|
|
775
804
|
AbstractSubTask.__init__(self, settings_obj, 'DP3')
|
|
776
805
|
self.ms_file = ms_file
|
|
@@ -818,6 +847,9 @@ class DP3Task(AbstractTask):
|
|
|
818
847
|
|
|
819
848
|
class MakePSSubTask(AbstractSubTask):
|
|
820
849
|
|
|
850
|
+
label = 'make_ps'
|
|
851
|
+
category = 'small'
|
|
852
|
+
|
|
821
853
|
def __init__(self, settings_obj, obs_id, lst_idx=None):
|
|
822
854
|
AbstractSubTask.__init__(self, settings_obj, 'pstool make_ps')
|
|
823
855
|
self.obs_id = obs_id
|
|
@@ -881,6 +913,9 @@ class MakePSTask(AbstractTask):
|
|
|
881
913
|
|
|
882
914
|
class RunGPRSubTask(AbstractSubTask):
|
|
883
915
|
|
|
916
|
+
label = 'run_gpr'
|
|
917
|
+
category = 'cpu'
|
|
918
|
+
|
|
884
919
|
def __init__(self, settings_obj, obs_id, lst_idx=None):
|
|
885
920
|
AbstractSubTask.__init__(self, settings_obj, 'pstool run_gpr')
|
|
886
921
|
self.obs_id = obs_id
|
|
@@ -951,6 +986,9 @@ class RunGPRTask(AbstractTask):
|
|
|
951
986
|
|
|
952
987
|
class RunMLGPRSubTask(AbstractSubTask):
|
|
953
988
|
|
|
989
|
+
label = 'run_ml_gpr'
|
|
990
|
+
category = 'cpu'
|
|
991
|
+
|
|
954
992
|
def __init__(self, settings_obj, obs_id, lst_idx=None):
|
|
955
993
|
AbstractSubTask.__init__(self, settings_obj, 'pstool run_ml_gpr')
|
|
956
994
|
self.obs_id = obs_id
|
|
@@ -1024,6 +1062,9 @@ class RunMLGPRTask(AbstractTask):
|
|
|
1024
1062
|
|
|
1025
1063
|
class RunMLGPRInjSubTask(AbstractSubTask):
|
|
1026
1064
|
|
|
1065
|
+
label = 'run_ml_gpr_inj'
|
|
1066
|
+
category = 'cpu'
|
|
1067
|
+
|
|
1027
1068
|
def __init__(self, settings_obj, obs_id, var_21_over_noise, x1, x2, lst_idx=None):
|
|
1028
1069
|
AbstractSubTask.__init__(self, settings_obj, 'pstool run_ml_gpr_inj')
|
|
1029
1070
|
self.obs_id = obs_id
|
|
@@ -1230,6 +1271,9 @@ class CombineTask(AbstractTask):
|
|
|
1230
1271
|
|
|
1231
1272
|
class RunFlaggerSubTask(AbstractSubTask):
|
|
1232
1273
|
|
|
1274
|
+
label = 'run_flagger'
|
|
1275
|
+
category = 'small'
|
|
1276
|
+
|
|
1233
1277
|
def __init__(self, settings_obj, obs_id):
|
|
1234
1278
|
AbstractSubTask.__init__(self, settings_obj, 'pstool run_flagger')
|
|
1235
1279
|
self.vis_rev = database.VisRevision(self.settings)
|
|
@@ -1244,6 +1288,9 @@ class RunFlaggerSubTask(AbstractSubTask):
|
|
|
1244
1288
|
|
|
1245
1289
|
class VisToSphSubTask(AbstractSubTask):
|
|
1246
1290
|
|
|
1291
|
+
label = 'vis_to_sph'
|
|
1292
|
+
category = 'small'
|
|
1293
|
+
|
|
1247
1294
|
def __init__(self, settings_obj, obs_id_out, stokes, h5_input, h5_out, h5_flag):
|
|
1248
1295
|
AbstractSubTask.__init__(self, settings_obj, 'pstool vis_to_sph')
|
|
1249
1296
|
self.vis_rev = database.VisRevision(self.settings)
|
|
@@ -1318,6 +1365,9 @@ class VisToSphTask(AbstractTask):
|
|
|
1318
1365
|
|
|
1319
1366
|
class ApplyFlagSubTask(AbstractSubTask):
|
|
1320
1367
|
|
|
1368
|
+
label = 'apply_flag'
|
|
1369
|
+
category = 'small'
|
|
1370
|
+
|
|
1321
1371
|
def __init__(self, settings_obj, ms_file, h5_file):
|
|
1322
1372
|
AbstractSubTask.__init__(self, settings_obj, 'flagtool restore')
|
|
1323
1373
|
self.ms_file = ms_file
|
|
@@ -1405,6 +1455,9 @@ class RestoreFlagTask(AbstractTask):
|
|
|
1405
1455
|
|
|
1406
1456
|
class DelayFlaggerSubTask(AbstractSubTask):
|
|
1407
1457
|
|
|
1458
|
+
label = 'delay_flagger'
|
|
1459
|
+
category = 'medium'
|
|
1460
|
+
|
|
1408
1461
|
def __init__(self, settings_obj, ms_file):
|
|
1409
1462
|
AbstractSubTask.__init__(self, settings_obj, 'flagtool delay_flagger')
|
|
1410
1463
|
self.ms_file = ms_file
|
|
@@ -1462,6 +1515,9 @@ class DelayFlagger(AbstractTask):
|
|
|
1462
1515
|
|
|
1463
1516
|
class VisFlaggerSubTask(AbstractSubTask):
|
|
1464
1517
|
|
|
1518
|
+
label = 'vis_flagger'
|
|
1519
|
+
category = 'medium'
|
|
1520
|
+
|
|
1465
1521
|
def __init__(self, settings_obj, ms_file):
|
|
1466
1522
|
AbstractSubTask.__init__(self, settings_obj, 'flagtool vis_flagger')
|
|
1467
1523
|
self.ms_file = ms_file
|
|
@@ -1513,6 +1569,9 @@ class VisFlagger(AbstractTask):
|
|
|
1513
1569
|
|
|
1514
1570
|
class SSINSSubTask(AbstractSubTask):
|
|
1515
1571
|
|
|
1572
|
+
label = 'ssins'
|
|
1573
|
+
category = 'medium'
|
|
1574
|
+
|
|
1516
1575
|
def __init__(self, settings_obj, ms_file):
|
|
1517
1576
|
AbstractSubTask.__init__(self, settings_obj, 'flagtool ssins')
|
|
1518
1577
|
self.ms_file = ms_file
|
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pspipe"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.13"
|
|
8
8
|
description = "Power spectra pipeline for Cosmic Dawn, Epoch of Reionization radio interferometric experiments"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "GPL-3.0-or-later"
|
|
@@ -20,7 +20,7 @@ dependencies = [
|
|
|
20
20
|
"tables>=3.2",
|
|
21
21
|
"tabulate>=0.8",
|
|
22
22
|
"ps-eor>=1.0",
|
|
23
|
-
"libpipe>=0.
|
|
23
|
+
"libpipe>=0.9",
|
|
24
24
|
"python-casacore>=3.0",
|
|
25
25
|
]
|
|
26
26
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|