Skip to content

Commit

Permalink
Merge pull request #791 from ratt-ru/add_montage_mProject
Browse files Browse the repository at this point in the history
Add montage mProject
  • Loading branch information
Athanaseus authored Jun 11, 2024
2 parents 3e8e361 + ce8e1aa commit 74c59e1
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 64 deletions.
7 changes: 3 additions & 4 deletions stimela/cargo/base/montage/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FROM quay.io/stimela/astropy:1.7.1
RUN docker-apt-install montage vim
FROM quay.io/stimela/base:1.7.1
RUN docker-apt-install montage python3-montagepy vim
RUN pip install --upgrade pip setuptools
RUN pip install -U montage-wrapper>=0.9.9 astroquery>=0.3.8 git+https://github.com/ratt-ru/scabha.git@positional

RUN pip install -U astroquery>=0.3.8 scabha==0.3.2
89 changes: 89 additions & 0 deletions stimela/cargo/cab/mProject/parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"task": "mProject",
"base": "stimela/montage",
"tag": "1.7.9",
"description": "mProject reprojects a single image to the scale defined in a FITS header template file (read more about header templates here). The program produces a pair of images: the reprojected image and an 'area' image consisting of the fraction input pixel sky area that went into each output pixel. The 'drizzle' algorithm is implemented. The algorithm proceeds by mapping pixel corners (as adjusted by drizzle, if called) from the input pixel space to the output pixel space, calculating overlap area with each output pixel, and accumulating an appropriate fraction of the input flux into the output image pixels. In addition, the appropriate fraction of the input pixel area is accumulated into the area image pixels. Projection of points from input pixel space to output pixel space is calculated in two steps: first map from input pixel space to sky coordinates; second map from sky coordinates to output pixel space.",
"prefix": "-",
"binary": "mProject",
"junk": [],
"msdir": false,
"parameters": [
{
"info": "Input FITS file to be reprojected",
"dtype": "file",
"name": "in.fits",
"io": "input",
"positional": true
},
{
"info": "Path of output FITS file to be created.",
"dtype":"file",
"name": "out.fits",
"io": "output",
"positional": true
},
{
"info": "FITS header template to be used in generation of output image",
"name": "hdr.template",
"dtype": "file",
"io": "input",
"positional": true
},
{
"info": "Processing is done utilizing the drizzle algorithm. factor is a floating point number; recommended drizzle factors are from 0.5 to 1.",
"name": "z",
"dtype": "float"
},
{
"info": "Causes additional debugging information to be printed to stdout. Valid levels are 1-5 (for higher debugging levels, it is recommended to redirect the output to a file).",
"name": "d",
"dtype": "int"
},
{
"info": "Use the specified FITS extension (default is to use the first HDU with image data)",
"name": "h",
"dtype": "str"
},
{
"info": "Apply a correction factor of scale to each pixel.",
"name": "x",
"dtype": "bool"
},
{
"info": "Path to a weight map to be used when reading values from the input image.",
"name": "w",
"io": "input",
"dtype": "file"
},
{
"info": "Use constant weight value for the whole image",
"name": "W",
"dtype": "bool"
},
{
"info": "Pixels with weights below threshold will be treated as blank.",
"name": "t",
"dtype": "float"
},
{
"info": "Makes the output region (originally defined in the header template) big enough to include all of the input images.",
"name": "X",
"dtype": "bool"
},
{
"info": "Define a border width or border pixel corners outside of which all pixels are set to NaN.",
"name": "b",
"dtype": "str"
},
{
"info": "Process the data as total energy rather than the default energy density (scale values by relative pixel areas).",
"name": "e",
"dtype": "bool"
},
{
"info": "Output the full region requested even if there is a border of NULL values (default is to shrinkwrap to just the pixels with values).",
"name": "f",
"dtype": "bool"
}
]
}
12 changes: 12 additions & 0 deletions stimela/cargo/cab/mProject/src/run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# -*- coding: future_fstrings -*-
import sys

from scabha import config, parse_parameters, prun

# If a list of fields is given, insert them as repeated arguments.
# Other arguments not allowed to be lists.
args = [config.binary] + parse_parameters(repeat=True)

# run the command
if prun(args) != 0:
raise SystemError(f" {config.binary} exited with a non-zero code. See logs for details")
18 changes: 9 additions & 9 deletions stimela/cargo/cab/mProjectCube/parameters.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"task": "mProjectCube",
"base": "stimela/montage",
"tag": "1.7.1",
"description": "mProjectCube reprojects a single cube to the scale defined in a FITS header template file (read more about header templates here). The program produces a pair of files: the reprojected cube and an 'area' image consisting of the fraction input pixel sky area that went into each output pixel. The 'drizzle' algorithm is implemented. The algorithm proceeds by mapping pixel corners (as adjusted by drizzle, if called) from the input pixel space to the output pixel space, calculating overlap area with each output pixel, and accumulating an appropriate fraction of the input flux into the output cube pixels. In addition, the appropriate fraction of the input pixel area is accumulated into the area image pixels. Projection of points from input pixel space to output pixel space is calculated in two steps: first map from input pixel space to sky coordinates; second map from sky coordinates to output pixel space.",
"prefix": "-",
"task": "mProjectCube",
"base": "stimela/montage",
"tag": "1.7.9",
"description": "mProjectCube reprojects a single cube to the scale defined in a FITS header template file (read more about header templates here). The program produces a pair of files: the reprojected cube and an 'area' image consisting of the fraction input pixel sky area that went into each output pixel. The 'drizzle' algorithm is implemented. The algorithm proceeds by mapping pixel corners (as adjusted by drizzle, if called) from the input pixel space to the output pixel space, calculating overlap area with each output pixel, and accumulating an appropriate fraction of the input flux into the output cube pixels. In addition, the appropriate fraction of the input pixel area is accumulated into the area image pixels. Projection of points from input pixel space to output pixel space is calculated in two steps: first map from input pixel space to sky coordinates; second map from sky coordinates to output pixel space.",
"prefix": "-",
"binary": "mProjectCube",
"junk": [],
"msdir": false,
"msdir": false,
"parameters": [
{
"info": "Input FITS file to be reprojected",
"dtype": "file",
"name": "in.fits",
"info": "Input FITS file to be reprojected",
"dtype": "file",
"name": "in.fits",
"io": "input",
"positional": true
},
Expand Down
102 changes: 51 additions & 51 deletions stimela/cargo/cab/montage/parameters.json
Original file line number Diff line number Diff line change
@@ -1,85 +1,85 @@
{
"task": "montage",
"base": "stimela/montage",
"tag": "1.7.1",
"description": "Combine FITS files into a mosaic",
"prefix": "-",
"task": "montage",
"base": "stimela/montage",
"tag": "1.7.9",
"description": "Combine FITS files into a mosaic",
"prefix": "-",
"binary": "montage.mosiac",
"junk": [],
"msdir": false,
"msdir": false,
"parameters": [
{
"info": "The directory containing the input FITS files",
"dtype": "file",
"name": "input_dir",
"info": "The directory containing the input FITS files",
"dtype": "file",
"name": "input_dir",
"io": "input"
},
},
{
"info": "The header to project to. If this is not specified, then an optimal header is chosen.",
"dtype": "str",
"info": "The header to project to. If this is not specified, then an optimal header is chosen.",
"dtype": "str",
"name": "header"
},
},
{
"info": "The table file containing the list of input images. This can be specified to avoid recomputing it every time a mosaic is made from the same set of input files.",
"dtype": "file",
"name": "image_table",
"info": "The table file containing the list of input images. This can be specified to avoid recomputing it every time a mosaic is made from the same set of input files.",
"dtype": "file",
"name": "image_table",
"io": "input"
},
},
{
"info": "Montage output directory",
"dtype": "file",
"name": "output_dir",
"info": "Montage output directory",
"dtype": "file",
"name": "output_dir",
"io": "output"
},
},
{
"info": "Whether to use MPI whenever possible (requires the MPI-enabled Montage binaries to be installed).",
"dtype": "bool",
"info": "Whether to use MPI whenever possible (requires the MPI-enabled Montage binaries to be installed).",
"dtype": "bool",
"name": "mpi"
},
},
{
"info": "The number of processes to use if `mpi` is set to `True`",
"dtype": "int",
"info": "The number of processes to use if `mpi` is set to `True`",
"dtype": "int",
"name": "n_proc"
},
},
{
"info": "Whether to include a background-matching step",
"dtype": "bool",
"info": "Whether to include a background-matching step",
"dtype": "bool",
"name": "background_match"
},
},
{
"info": "A list of images to use (useful if not all the files inside `input_dir` should be combined).",
"dtype": "list:str",
"info": "A list of images to use (useful if not all the files inside `input_dir` should be combined).",
"dtype": "list:str",
"name": "imglist"
},
},
{
"info": "How to combine the images",
"dtype": "str",
"name": "combine",
"info": "How to combine the images",
"dtype": "str",
"name": "combine",
"choices": [
"mean",
"median",
"mean",
"median",
"count"
]
},
},
{
"info": "Whether the output mosaic should match the input header exactly, or whether the mosaic should be trimmed if possible.",
"dtype": "bool",
"info": "Whether the output mosaic should match the input header exactly, or whether the mosaic should be trimmed if possible.",
"dtype": "bool",
"name": "exact_size"
},
},
{
"info": "Whether to remove any temporary directories used for mosaicking",
"dtype": "bool",
"default": "true",
"info": "Whether to remove any temporary directories used for mosaicking",
"dtype": "bool",
"default": "true",
"name": "cleanup"
},
},
{
"info": "BITPIX value for the ouput FITS file (default is -32). Possible values are: 8 (character or unsigned binary integer), 16 (16-bit integer), 32 (32-bit integer), -32 (single precision floating point), -64 (double precision floating point).",
"dtype": "int",
"info": "BITPIX value for the ouput FITS file (default is -32). Possible values are: 8 (character or unsigned binary integer), 16 (16-bit integer), 32 (32-bit integer), -32 (single precision floating point), -64 (double precision floating point).",
"dtype": "int",
"name": "bitpix"
},
},
{
"info": "When doing background matching, whether to only allow changes in the level of frames, not the slope.",
"dtype": "bool",
"info": "When doing background matching, whether to only allow changes in the level of frames, not the slope.",
"dtype": "bool",
"name": "level_only"
}
]
Expand Down

0 comments on commit 74c59e1

Please sign in to comment.