obstools.rimas_dither_pattern module

Create ECSV sidecars that correct RIMAS dither metadata

LDTObserverTools contains python ports of various LDT Observer Tools

Lowell Discovery Telescope (Lowell Observatory: Flagstaff, AZ) https://lowell.edu

The generated tables identify the dither pattern, position, and sequence for all commanded RIMAS frames, including exposures that were not written to disk.

class obstools.rimas_dither_pattern.DitherSequence(frames: tuple[int, ...], sequence_id: int)[source]

Bases: object

Represent the recorded frames in one commanded dither sequence.

Parameters:
  • frames (tuple of int) – Commanded frame numbers in strictly increasing order, including frames that were not written to disk.

  • sequence_id (int) – Positive identifier for the commanded sequence.

frames

Recorded frame numbers in the sequence.

Type:

tuple of int

sequence_id

Identifier for the sequence.

Type:

int

frames: tuple[int, ...] = <dataclasses._MISSING_TYPE object>
sequence_id: int = <dataclasses._MISSING_TYPE object>
class obstools.rimas_dither_pattern.RimasDitherPattern[source]

Bases: ScriptBase

Provide the CLI for creating RIMAS dither sidecars.

Notes

One --sequence option is accepted per commanded sequence. Sequence identifiers follow the order of those options.

classmethod get_parser(description: str | None = None, width: int | None = None, formatter: type[HelpFormatter] = <class 'argparse.ArgumentDefaultsHelpFormatter'>) → ArgumentParser[source]

Construct the command-line argument parser.

Parameters:
  • description (str or None, optional) – Parser description. Retained for base-class compatibility.

  • width (int or None, optional) – Maximum width of formatted help output.

  • formatter (type of argparse.HelpFormatter, optional) – Help formatter class.

Returns:

argparse.ArgumentParser – Configured command-line parser.

static main(args: Namespace) → None[source]

Create and write a correction table from parsed arguments.

Parameters:

args (argparse.Namespace) – Parsed command-line arguments produced by get_parser().

obstools.rimas_dither_pattern.build_correction_table(sequence_type: str, sequences: Sequence[DitherSequence], date: str, arms: Iterable[str] = ('YJ', 'HK'), source: str = 'observing log') → Table[source]

Build a RIMAS dither metadata correction table.

Parameters:
  • sequence_type (str) – Supported dither pattern name.

  • sequences (sequence of DitherSequence) – Recorded frames grouped by commanded sequence.

  • date (str) – Observing date in YYYYMMDD format.

  • arms (iterable of str, optional) – Detector arms to include; supported values are "YJ" and "HK".

  • source (str, optional) – Description of the correction metadata source.

Returns:

astropy.table.Table – Correction rows for every recorded frame and selected arm.

Raises:

ValueError – If inputs are invalid, identifiers or frames are duplicated, or no rows can be produced.

obstools.rimas_dither_pattern.normalize_pattern(sequence_type: str) → str[source]

Return the canonical name of a supported dither pattern.

Parameters:

sequence_type (str) – Pattern name. Matching ignores case and surrounding whitespace.

Returns:

str – Uppercase canonical pattern name.

Raises:

ValueError – If sequence_type is not supported.

obstools.rimas_dither_pattern.parse_frame_list(value: str | Iterable[str]) → tuple[int, ...][source]

Parse frame numbers from one or more strings.

Parameters:

value (str or iterable of str) – Frame numbers supplied as individual strings, comma-separated strings, or a mixture of both. Whitespace and empty fields are ignored.

Returns:

tuple of int – Parsed frame numbers in input order.

Raises:

ValueError – If a nonempty field is not an integer or no frames are given.

obstools.rimas_dither_pattern.validate_sequence(sequence: DitherSequence, sequence_type: str) → None[source]

Validate one sequence against a dither pattern.

Parameters:
  • sequence (DitherSequence) – Sequence to validate.

  • sequence_type (str) – Supported dither pattern name.

Raises:

ValueError – If the pattern or sequence is invalid.

obstools.rimas_dither_pattern.write_correction_table(table: Table, output: str | Path, overwrite: bool = False) → Path[source]

Write a correction table in ECSV format.

Parameters:
  • table (astropy.table.Table) – Correction table to write.

  • output (str or pathlib.Path) – Destination path. Missing parent directories are created.

  • overwrite (bool, optional) – Whether to replace an existing file.

Returns:

pathlib.Path – Absolute path of the written file.