Skip to content

Commit 1ae3ba5

Browse files
authored
Merge pull request #651 from ratt-ru/issue-650
remove scabha from wsclean cab (For now)
2 parents e370ed9 + f120066 commit 1ae3ba5

3 files changed

Lines changed: 51 additions & 24 deletions

File tree

examples/simulation_pipeline.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
log_dir=os.path.join(OUTPUT, "logs"),
2828
)
2929

30-
pipeline.JOB_TYPE = "docker"
30+
#pipeline.JOB_TYPE = "docker"
3131

3232
# 1: Make empty MS
3333
pipeline.add("cab/simms", # Executor image to start container from
@@ -100,6 +100,8 @@
100100
# Perform 1000 iterarions of clean (Deconvolution)
101101
"niter": 1000,
102102
"pol" : "I",
103+
"multiscale": True,
104+
"multiscale-scales" : [0,2],
103105
},
104106
label="Imaging MS, robust={:d}".format(robust),
105107
cpus=2,

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
],
1414

1515
PACKAGE_NAME = "stimela"
16-
__version__ = "1.6.4"
16+
__version__ = "1.6.5"
1717

1818
setup(name=PACKAGE_NAME,
1919
version=__version__,
Lines changed: 47 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
1-
# -*- coding: future_fstrings -*-
2-
import sys
3-
from scabha import config, parameters_dict, prun
1+
import os
2+
import sys
3+
import re
4+
import yaml
5+
import subprocess
6+
import shlex
7+
import glob
48

9+
CONFIG = os.environ['CONFIG']
10+
INPUT = os.environ['INPUT']
11+
OUTPUT = os.environ['OUTPUT']
12+
MSDIR = os.environ['MSDIR']
13+
14+
with open(CONFIG, "r") as _std:
15+
cab = yaml.safe_load(_std)
16+
17+
params = cab['parameters']
18+
junk = cab["junk"]
519
args = []
6-
for name, value in parameters_dict.items():
20+
21+
for param in params:
22+
name = param['name']
23+
value = param['value']
24+
725
if name == 'msname':
826
if isinstance(value, str):
927
mslist = value
@@ -21,28 +39,35 @@
2139
value = '{0}asec'.format(value)
2240

2341
elif name in 'size trim nwlayers-for-size beam-shape channel-range interval'.split():
24-
if isinstance(value, (int, float)):
25-
value = [value]*2
26-
elif isinstance(value, list):
42+
if isinstance(value, int):
43+
value = '{0} {0}'.format(value)
44+
elif hasattr(value, '__iter__'):
2745
if len(value) == 1:
28-
value = value*2
46+
value.append(value[0])
47+
value = ' '.join(map(str, value))
48+
49+
elif name in 'spws multiscale-scales pol'.split():
50+
if hasattr(value, '__iter__'):
51+
value = ','.join(map(str, value))
2952

3053
if value is True:
31-
arg = [f'{config.prefix}{name}']
54+
arg = '{0}{1}'.format(cab['prefix'], name)
3255
else:
33-
if isinstance(value, list):
34-
value = list(map(str, value))
35-
elif isinstance(value, str):
36-
value = value.split()
37-
elif not isinstance(value, str):
38-
value = [str(value)]
39-
else:
40-
value = [value]
41-
arg = [f'{config.prefix}{name}' ] + value
56+
arg = '{0}{1} {2}'.format(cab['prefix'], name, value)
4257

43-
args += arg
58+
args.append(arg)
4459

45-
args = [config.binary] + args + [mslist]
60+
_runc = " ".join([cab["binary"]] + args + [mslist])
4661

47-
if prun(args) is not 0:
48-
sys.exit(1)
62+
try:
63+
subprocess.check_call(shlex.split(_runc))
64+
finally:
65+
for item in junk:
66+
for dest in [OUTPUT, MSDIR]: # these are the only writable volumes in the container
67+
items = glob.glob("{dest}/{item}".format(**locals()))
68+
for f in items:
69+
if os.path.isfile(f):
70+
os.remove(f)
71+
elif os.path.isdir(f):
72+
shutil.rmtree(f)
73+
# Leave other types

0 commit comments

Comments
 (0)