arrakis.cutout

Produce cutouts from RACS cubes

Attributes

T

TQDM_OUT

Classes

CutoutArgs

Arguments for cutout function

Functions

big_cutout(→ list[pymongo.UpdateOne])

cli(→ None)

Command-line interface

cutout_image(→ pymongo.UpdateOne)

Perform a cutout.

cutout_islands(→ None)

Flow to cutout islands in parallel.

cutout_parser(→ argparse.ArgumentParser)

cutout_weight(→ pymongo.UpdateOne)

get_args(→ CutoutArgs | None)

Get arguments for cutout function

main(→ None)

Main script

make_cutout(lock, host, epoch, source, comps, outdir, ...)

Module Contents

class arrakis.cutout.CutoutArgs[source]

Bases: NamedTuple

Arguments for cutout function

dec_high: float[source]

Upper DEC bound in degrees

dec_low: float[source]

Lower DEC bound in degrees

outdir: pathlib.Path[source]

Output directory

ra_left: float[source]

Upper RA bound in degrees

ra_right: float[source]

Lower RA bound in degrees

arrakis.cutout.big_cutout(sources: pandas.DataFrame, comps: pandas.DataFrame, beam_num: int, stoke: str, datadir: pathlib.Path, outdir: pathlib.Path, host: str, epoch: int, field: str, pad: float = 3, username: str | None = None, password: str | None = None, limit: int | None = None, dryrun: bool = False) list[pymongo.UpdateOne][source]
arrakis.cutout.cli() None[source]

Command-line interface

arrakis.cutout.cutout_image(lock: threading.Lock, image_name: pathlib.Path, data_in_mem: numpy.ndarray, old_header: astropy.io.fits.Header, cube: spectral_cube.SpectralCube, source_id: str, cutout_args: CutoutArgs | None, field: str, beam_num: int, stoke: str, pad: float = 3, dryrun: bool = False) pymongo.UpdateOne[source]

Perform a cutout.

Returns:

Update query for MongoDB

Return type:

pymongo.UpdateOne

arrakis.cutout.cutout_islands(field: str, directory: pathlib.Path, host: str, epoch: int, sbid: int | None = None, username: str | None = None, password: str | None = None, pad: float = 3, stokeslist: list[str] | None = None, dryrun: bool = True, limit: int | None = None) None[source]

Flow to cutout islands in parallel.

Parameters:
  • field (str) – RACS field name.

  • directory (Path) – Directory to store cutouts.

  • host (str) – MongoDB host.

  • username (str, optional) – Mongo username. Defaults to None.

  • password (str, optional) – Mongo password. Defaults to None.

  • pad (int, optional) – Number of beamwidths to pad cutouts. Defaults to 3.

  • stokeslist (List[str], optional) – Stokes parameters to cutout. Defaults to None.

  • dryrun (bool, optional) – Do everything except write FITS files. Defaults to True.

arrakis.cutout.cutout_parser(parent_parser: bool = False) argparse.ArgumentParser[source]
arrakis.cutout.cutout_weight(image_name: pathlib.Path, source_id: str, cutout_args: CutoutArgs | None, field: str, stoke: str, beam_num: int, dryrun=False) pymongo.UpdateOne[source]
arrakis.cutout.get_args(comps: pandas.DataFrame, source: pandas.Series, outdir: pathlib.Path) CutoutArgs | None[source]

Get arguments for cutout function

Parameters:
  • comps (pd.DataFrame) – List of mongo entries for RACS components in island

  • beam (Dict) – Mongo entry for the RACS beam

  • island_id (str) – RACS island ID

  • outdir (Path) – Input directory

Raises:
  • e – Exception

  • Exception – Problems with coordinates

Returns:

List of cutout arguments for cutout function

Return type:

List[CutoutArgs]

arrakis.cutout.main(args: argparse.Namespace) None[source]

Main script

Parameters:

args (argparse.Namespace) – Command-line args

arrakis.cutout.make_cutout(lock: threading.Lock, host: str, epoch: int, source: pandas.Series, comps: pandas.DataFrame, outdir: pathlib.Path, image_name: pathlib.Path, data_in_mem: numpy.ndarray, old_header: astropy.io.fits.Header, cube: spectral_cube.SpectralCube, field: str, beam_num: int, stoke: str, pad: float = 3, username: str | None = None, password: str | None = None, dryrun: bool = False)[source]
arrakis.cutout.T[source]
arrakis.cutout.TQDM_OUT[source]