-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #432 from SpheMakh/montage_mosaic
Montage mosaic
- Loading branch information
Showing
4 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM stimela/montage:1.1.3 | ||
MAINTAINER <[email protected]> | ||
ADD src /scratch/code | ||
ENV LOGFILE ${OUTPUT}/logfile.txt | ||
CMD /scratch/code/run.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"task": "montage_mosaic", | ||
"base": "stimela/montage", | ||
"tag": "1.1.3", | ||
"description": "A package that allows continuum (2D) images and spectral (3D) images to be mosaicked together, using montage commands.", | ||
"prefix": "--", | ||
"binary": "montage-mosaic", | ||
"msdir": false, | ||
"parameters": [ | ||
{ | ||
"info": "State 'continuum' or 'spectral' as the type of mosaic to be made.", | ||
"name": "mosaic-type", | ||
"default": null, | ||
"dtype": "str", | ||
"required": true | ||
}, | ||
{ | ||
"info": "Include this argument if you wish to use montage for regridding the images and beams (if they have not already been created).", | ||
"name": "domontage", | ||
"default": null, | ||
"dtype": "bool", | ||
"required": false | ||
}, | ||
{ | ||
"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.", | ||
"name": "cutoff", | ||
"default": 0.1, | ||
"dtype": "float", | ||
"required": false | ||
}, | ||
{ | ||
"info": "The prefix to be used for output files.", | ||
"name": "name", | ||
"default": "mymosaic", | ||
"dtype": "str", | ||
"required": false | ||
}, | ||
{ | ||
"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).", | ||
"name": "target-images", | ||
"io": "input", | ||
"default": null, | ||
"dtype": "list:file", | ||
"required": true | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import os | ||
import sys | ||
|
||
sys.path.append('/scratch/stimela') | ||
import utils | ||
|
||
|
||
CONFIG = os.environ["CONFIG"] | ||
INPUT = os.environ["INPUT"] | ||
MSDIR = os.environ["MSDIR"] | ||
OUTPUT = os.environ["OUTPUT"] | ||
|
||
cab = utils.readJson(CONFIG) | ||
args = [] | ||
targets = None | ||
for param in cab['parameters']: | ||
name = param['name'] | ||
value = param['value'] | ||
|
||
if value is None: | ||
continue | ||
elif value is False: | ||
continue | ||
elif value is True: | ||
value = '' | ||
elif name == 'target-images': | ||
targets = value | ||
continue | ||
|
||
args += ['{0}{1} {2}'.format(cab['prefix'], name, value)] | ||
|
||
indir = os.path.dirname(targets[0]) | ||
target_names = map(os.path.basename, targets) | ||
target_images = "--target-images " + " --target-images ".join(target_names) | ||
|
||
args += ["--input {0:s} {1:s} --output {2:s}".format(indir, target_images, | ||
OUTPUT)] | ||
|
||
if target_images: | ||
utils.xrun(cab['binary'], args) | ||
else: | ||
raise RuntimeError('Filenames of the images to be mosaicked have not been specified.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
python /scratch/code/run.py 2>&1 | tee -a $LOGFILE | ||
(exit ${PIPESTATUS[0]}) |