Skip to content

Commit 9bb1078

Browse files
authored
Merge pull request #432 from SpheMakh/montage_mosaic
Montage mosaic
2 parents 2778114 + 71db833 commit 9bb1078

4 files changed

Lines changed: 97 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM stimela/montage:1.1.3
2+
MAINTAINER <sphemakh@gmail.com>
3+
ADD src /scratch/code
4+
ENV LOGFILE ${OUTPUT}/logfile.txt
5+
CMD /scratch/code/run.sh
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"task": "montage_mosaic",
3+
"base": "stimela/montage",
4+
"tag": "1.1.3",
5+
"description": "A package that allows continuum (2D) images and spectral (3D) images to be mosaicked together, using montage commands.",
6+
"prefix": "--",
7+
"binary": "montage-mosaic",
8+
"msdir": false,
9+
"parameters": [
10+
{
11+
"info": "State 'continuum' or 'spectral' as the type of mosaic to be made.",
12+
"name": "mosaic-type",
13+
"default": null,
14+
"dtype": "str",
15+
"required": true
16+
},
17+
{
18+
"info": "Include this argument if you wish to use montage for regridding the images and beams (if they have not already been created).",
19+
"name": "domontage",
20+
"default": null,
21+
"dtype": "bool",
22+
"required": false
23+
},
24+
{
25+
"info": "The cutoff in the primary beam to use (assuming a Gaussian at the moment). E.g. The default of 0.1 means going down to the 10 percent level for each pointing.",
26+
"name": "cutoff",
27+
"default": 0.1,
28+
"dtype": "float",
29+
"required": false
30+
},
31+
{
32+
"info": "The prefix to be used for output files.",
33+
"name": "name",
34+
"default": "mymosaic",
35+
"dtype": "str",
36+
"required": false
37+
},
38+
{
39+
"info": "The filenames of each target/pointing image to be mosaicked. A suffix of 'image.fits' is expected, and this is replaced by 'pb.fits' in order to locate the corresponding beams (which are also required as input).",
40+
"name": "target-images",
41+
"io": "input",
42+
"default": null,
43+
"dtype": "list:file",
44+
"required": true
45+
}
46+
]
47+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import os
2+
import sys
3+
4+
sys.path.append('/scratch/stimela')
5+
import utils
6+
7+
8+
CONFIG = os.environ["CONFIG"]
9+
INPUT = os.environ["INPUT"]
10+
MSDIR = os.environ["MSDIR"]
11+
OUTPUT = os.environ["OUTPUT"]
12+
13+
cab = utils.readJson(CONFIG)
14+
args = []
15+
targets = None
16+
for param in cab['parameters']:
17+
name = param['name']
18+
value = param['value']
19+
20+
if value is None:
21+
continue
22+
elif value is False:
23+
continue
24+
elif value is True:
25+
value = ''
26+
elif name == 'target-images':
27+
targets = value
28+
continue
29+
30+
args += ['{0}{1} {2}'.format(cab['prefix'], name, value)]
31+
32+
indir = os.path.dirname(targets[0])
33+
target_names = map(os.path.basename, targets)
34+
target_images = "--target-images " + " --target-images ".join(target_names)
35+
36+
args += ["--input {0:s} {1:s} --output {2:s}".format(indir, target_images,
37+
OUTPUT)]
38+
39+
if target_images:
40+
utils.xrun(cab['binary'], args)
41+
else:
42+
raise RuntimeError('Filenames of the images to be mosaicked have not been specified.')
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
python /scratch/code/run.py 2>&1 | tee -a $LOGFILE
3+
(exit ${PIPESTATUS[0]})

0 commit comments

Comments
 (0)