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:
objectRepresent the recorded frames in one commanded dither sequence.
- Parameters:
- sequence_id
Identifier for the sequence.
- Type:
- sequence_id: int = <dataclasses._MISSING_TYPE object>
- class obstools.rimas_dither_pattern.RimasDitherPattern[source]
Bases:
ScriptBaseProvide the CLI for creating RIMAS dither sidecars.
Notes
One
--sequenceoption 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:
- 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
YYYYMMDDformat.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_typeis 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.