Skip to content

Available parameters for a execution task (cab)

Benjamin Hugo edited this page Aug 15, 2019 · 1 revision

A stimela cab wraps radio astronomy packages and exposes them to the user as Python functions. To get a list of all the cabs, as well as summary of what the cab does, run:

$ stimela cabs -ls

And, to get more details on any cab run

$ stimela cabs -i <cab name>

For example

$ stimela cabs -i lwimager

Definition

A stimela cab is defined via a JSON that specifies the following fields:

  • task : The name of the task that the cab executes
  • description : Task description
  • base : Image that the cab should be based on
  • tag : Base image tag
  • binary : Binary that executes the task (inside the container)
  • prefix : Leading characters when parsing arguments to binary. For example, "--"/ or "-" for Python argparse
  • msdir : Specify whether task requires a measurement set (MS). MSs have different I/O compared to other I/O files, and is treated differently.
  • parameters : A list of parameters (to be detailed below) for the task.

The parameters are specified as python dictionaries. The following fields are available:

  • name : Name of parameter
  • dtype : Value type. Options are int,float,boo,str,file
  • io : Specifies I/O type for file types. Options are input,output,msfile. MSs should be specified as msfile
  • check_io : Check if files exist if io is input or msfile. Set to true by default
  • info : Value documentation
  • choices : Limit choices for parameter value
  • required : Is the parameter valid
  • default : Default value

The cleanmask cab definition is shown below

{
    "task"          :   "cleanmask",
    "base"          :   "stimela/astropy",
    "tag"           :   "0.2.3",
    "binary"        :   "cleanmask",  
    "description"   :   "Creates a binary mask from a FITS image",
    "msdir"         :   false,
    "prefix"        :   "--",
    "parameters"    :   [
        {
            "name"      :   "image",
            "dtype"     :   "file",
            "io"        :   "input",
            "info"      :   "Name of FITS image from which to derive the mask",
            "default"   :   null,
            "required"  :   true
        },
        {
            "name"      :   "output",
            "dtype"     :   "file",
            "io"        :   "output",
            "info"      :   "Name of resulting binary mask",
            "default"   :   null,
            "required"  :   true
        },
        {
            "name"      :   "sigma",
            "dtype"     :   "float",
            "info"      :   "The number of standard deviations to use when clipping image",
            "default"   :   5,
            "required"  :   false
        },
        {
            "name"      :   "boxes",
            "dtype"     :   "int",
            "info"      :   "Will divide image into this number of boxes, then perform sigma clipping in each of these boxes",
            "default"   :   11,
            "required"  :   false
        },
        {
            "name"      :   "iters",
            "dtype"     :   "str",
            "info"      :   "The number of iterations to perform sigma clipping, or 0 to clip until convergence is achieved.",
            "default"   :   3,
            "required"  :   false
        },
        {
            "name"      :   "mask-value",
            "dtype"     :   "float",
            "info"      :   "Value to use for masked regions",
            "default"   :   0,
            "required"  :   false
        },
        {
            "name"      :   "overlap",
            "dtype"     :   "float",
            "info"      :   "Overlap region. As a fraction of -nb/--boxes",
            "default"   :   0,
            "required"  :   false
        },
        {
            "name"      :   "dilate",
            "dtype"     :   "bool",
            "info"      :   "Dilate mask. This is an attempt to include low surface brightness in an image.",
            "default"   :   true,
            "required"  :   false
        },
        {
            "name"      :   "diters",
            "dtype"     :   "int",
            "info"      :   "Maximun dilation iterations per island",
            "default"   :   20,
            "required"  :   false
        },
        {
            "name"      :   "no-negative",
            "dtype"     :   "bool",
            "info"      :   "Include negative pixels when creating mask",
            "default"   :   false,
            "required"  :   false
        },
        {
            "name"      :   "tolerance",
            "dtype"     :   "float",
            "info"      :   "Tolerance for dilating the mask. Will stop dilating if percentage difference between dilations is smaller than this value.",
            "default"   :   0.05,
            "required"  :   false
        },
        {
            "name"      :   "log-level",
            "dtype"     :   "str",
            "info"      :   "Log level",
            "choices"   :   ["INFO", "DEBUG", "CRITICAL"],
            "default"   :   "INFO"
        }
    ]
}