potpyri.utils.options

Pipeline option parsing and path setup.

Provides argument parsing for the main pipeline and builds directory layouts (raw, red, log, cals, workspace, etc.) for a given data path and instrument. Authors: Charlie Kilpatrick.

Functions

add_options()

Parse command-line options and return normalized args.

add_paths(data_path, file_list_name, tel)

Build the directory and path dictionary for a reduction run.

init_options()

Build and return the argument parser for the main pipeline.

initialize_telescope(instrument, data_path)

Load the instrument class and build paths for that instrument.

test_for_dependencies()

Check that astrometry.net and Source Extractor are on the system path.

potpyri.utils.options.add_options()[source]

Parse command-line options and return normalized args.

Handles instrument aliases (e.g. BINO -> BINOSPEC, MMIR -> MMIRS).

Returns:

Parsed and normalized command-line arguments.

Return type:

argparse.Namespace

potpyri.utils.options.add_paths(data_path, file_list_name, tel)[source]

Build the directory and path dictionary for a reduction run.

Creates raw, bad, red, log, cal, work dirs under data_path and resolves the path to the Source Extractor binary.

Parameters:
  • data_path (str) – Top-level data directory.

  • file_list_name (str) – Filename of the file list (e.g. files.txt).

  • tel (Instrument) – Instrument instance (used for name and caldb).

Returns:

Keys include ‘data’, ‘raw’, ‘bad’, ‘red’, ‘log’, ‘cal’, ‘work’, ‘filelist’, ‘caldb’, ‘source_extractor’.

Return type:

dict

Raises:

Exception – If data_path does not exist.

potpyri.utils.options.init_options()[source]

Build and return the argument parser for the main pipeline.

Returns:

Parser with instrument, data_path, target, proc, include-bad, file-list-name, photometry, and processing flags.

Return type:

argparse.ArgumentParser

potpyri.utils.options.initialize_telescope(instrument, data_path)[source]

Load the instrument class and build paths for that instrument.

Parameters:
  • instrument (str) – Instrument name (e.g. ‘GMOS’, ‘LRIS’).

  • data_path (str) – Top-level data directory.

Returns:

(paths, tel) where paths is the dict from add_paths and tel is the instrument instance. Uses default file list name.

Return type:

tuple

potpyri.utils.options.test_for_dependencies()[source]

Check that astrometry.net and Source Extractor are on the system path.

Raises:

Exception – If solve-field (astrometry.net) or sex (sextractor) is not found or does not report expected help text.