autowisp.processing_steps.manual_util module

Class Inheritance Diagram

Inheritance diagram of ArgumentParser, ConfigurationError, DefaultsFormatter, ManualStepArgumentParser, WISPGaia

Collection of functions used by many processing steps.

class autowisp.processing_steps.manual_util.ManualStepArgumentParser(*, input_type, description, add_component_versions=(), add_catalog=False, add_photref=False, inputs_help_extra='', allow_parallel_processing=False, convert_to_dict=True, add_lc_fname_arg=False, add_exposure_timing=False, add_provenance_args=False, skip_io=False)[source]

Bases: ArgumentParser

Inheritance diagram of autowisp.processing_steps.manual_util.ManualStepArgumentParser

Incorporate boiler plate handling of command line arguments.

__init__(*, input_type, description, add_component_versions=(), add_catalog=False, add_photref=False, inputs_help_extra='', allow_parallel_processing=False, convert_to_dict=True, add_lc_fname_arg=False, add_exposure_timing=False, add_provenance_args=False, skip_io=False)[source]

Initialize the praser with options common to all manual steps.

Parameters:
  • input_type (str) – What kind of files does the step process. Possible values are 'raw', 'calibrated', 'dr', or 'calibrated + dr'.

  • description (str) – The description of the processing step to add to the help message.

  • add_component_versions (str iterable) – A list of DR file version numbers the step needs to know. For example ('srcextract',).

  • add_catalog (False or dict) – Whether to add an arguments to specify a catalog query. If not False should specify defaults for some or all of the option values and a prefix for the option names.

  • inputs_help_extra (str) – Additional text to append to the help string for the input files. Usually describing what requirements they must satisfy.

  • allow_parallel_processing (bool) – Should an argument be added to specify the number of paralllel processes to use.

  • convert_to_dict (bool) – Whether to return the parsed configuration as a dictionary (True) or attributes of a namespace (False).

Returns:

None

_add_catalog_args(catalog_config)[source]

Add arguments to specify a catalog query.

_add_exposure_timing()[source]

Add command line arguments to determine exposure start & duration.

_add_provenance_args()[source]

Add provenance flags mirroring wisp-add-images-to-db.

These let a manual step resolve a FITS header to the survey-database rows (Camera, Telescope, Mount, Observatory, Observer, Target) via autowisp.database.provenance_resolver.get_or_create_observing_session(), so that the /Provenance group can be written to the DR file without requiring wisp-add-images-to-db to have been run.

Flag names and defaults intentionally mirror wisp-add-images-to-db so a shared config file works for both.

_add_version_args(components)[source]

Add arguments to select versions of the given components.

add_argument(*args, **kwargs)[source]

Store each argument’s description in self.argument_descriptions.

error(message)[source]

Report a parse error, honouring raise_config_parse_errors().

argparse’s default reports a bad value by printing usage to stderr and calling sys.exit(2). During pipeline config generation that SystemExit would escape the error-handling machinery (it is a BaseException, not caught by capture_errors / run_pipeline.main) and silently end a detached run, so there we raise a recordable ConfigurationError instead. Interactive CLI parsing keeps argparse’s helpful usage-and-exit behaviour.

Parameters:

message (str) – The argparse-formatted error description.

Returns:

None

parse_args(*args, **kwargs)[source]

Set-up logging and return cleaned up dict instead of namespace.

autowisp.processing_steps.manual_util.add_image_options(parser, include=('subpixmap', 'gain', 'magnitude-1adu'))[source]

Add options specifying the properties of the image.

autowisp.processing_steps.manual_util.ignore_progress(input_fname, status=1, final=True, **kwargs)[source]

Dummy function to replace progress tracking of auto processing.

autowisp.processing_steps.manual_util.parse_iers_max_age(value)[source]

Parse the --iers-auto-max-age value into what astropy expects.

Parameters:

value – The command line value: a number of days, or one of none/off/disable (case insensitive) to switch off the staleness check.

Returns:

The maximum age in days, or None to disable the

check (and hence the automatic IERS download) entirely. A non-positive number is also treated as None.

Return type:

float or None

autowisp.processing_steps.manual_util.raise_config_parse_errors()[source]

Make ManualStepArgumentParser raise on bad input, not exit.

Use around programmatic parsing of stored configuration, where there is no interactive user to read an argparse usage message and the process may be a detached pipeline run. A parse failure then becomes a catchable, recordable ConfigurationError instead of SystemExit. Nestable; restores the previous mode on exit.

Yields:

None

autowisp.processing_steps.manual_util.read_subpixmap(fits_fname)[source]

Read the sub-pixel sensitivity map from a FITS file.