cross_bones.align_catalogues¶
Utility functions and helper classes to manage astrometry
Attributes¶
Classes¶
Represents a stage in the alignment process |
|
Statistics around the step in the alignment process |
Functions¶
|
|
|
Add offsets to a catalogue and its table. |
Add offsets to sky coordinate offsets. This attempts to |
|
|
Load in a set of catalogues and attempt to align them |
|
Calculate global statistics of all matches across all catalogues |
|
|
|
Identify a pair of beams that will form a step in the deshifter |
|
|
Run the making and plotting of the match matrix |
|
|
Match each catalogue to each other |
Attempt to shift catalogues to a common reference frame. A seed catalogue |
|
|
Create a diagnostic plot intended to show how the iterative method |
|
Plot the progression of matching statistics over rounds. The list of |
|
Plot the match matrix from the beam-wise matching |
|
|
|
|
|
Select a beam to fix into place so others are matched to it. |
Module Contents¶
- class cross_bones.align_catalogues.CataloguePair¶
Represents a stage in the alignment process
- matches: cross_bones.matching.Match¶
The result of the cross match
- class cross_bones.align_catalogues.StepInfo¶
Statistics around the step in the alignment process
- accumulated_seps: astropy.units.Quantity¶
The total separation among matched sources
- cross_bones.align_catalogues.add_offset_to_catalogue(catalogue: cross_bones.catalogue.Catalogue, offset: tuple[float, float]) cross_bones.catalogue.Catalogue¶
Add offsets to a catalogue and its table. :param catalogue: The catalogue object to shift :type catalogue: Catalogue :param offset: The angular units to shift by :type offset: tuple[float, float]
- Returns:
The shifted catalogue
- Return type:
- cross_bones.align_catalogues.add_offset_to_coords_skyframeoffset(sky_coords: astropy.coordinates.SkyCoord, offset: tuple[float, float]) astropy.coordinates.SkyCoord¶
Add offsets to sky coordinate offsets. This attempts to be consistent with the spherical_offsets_to astropy function and adds the angular offsets appropriately on the sphere.
- cross_bones.align_catalogues.beam_wise_shifts(catalogue_paths: Paths, table_keys: cross_bones.catalogue.TableKeys, output_prefix: str | None = None, passes: int = 1, all_plots: bool = False, report_statistics_throughout: bool = False, min_snr: float = 10.0, min_iso: float = 36.0, force_idx: int | None = None) cross_bones.catalogue.Catalogues¶
Load in a set of catalogues and attempt to align them onto an internally consistent positional reference frame
- Parameters:
catalogue_paths (Paths) – The set of fits component cataloges to load
output_prefix (str | None, optional) – The prefix to use for output products. If None the default names are used. Defaults to None.
passes (int, optional) – How many rounds during convergence should be attempted. Defaults to 1.
all_plots (bool, optional) – If True all plots will be made. Otherwise only a small set of key plots are. Ignored if output_prefix is unset. Defaults to False.
report_statistics_throughout (bool, optional) – If True extran statistics per round are computed and presented. Defaults to False.
- Returns:
The catalogues that have been shifted
- Return type:
Catalogues
- cross_bones.align_catalogues.calculate_catalogue_jitter(catalogues: cross_bones.catalogue.Catalogues, sep_limit_arcsecond: float = 9) StepInfo¶
Calculate global statistics of all matches across all catalogues
- cross_bones.align_catalogues.find_next_pair(catalogues: cross_bones.catalogue.Catalogues) CataloguePair | None¶
Identify a pair of beams that will form a step in the deshifter
- Parameters:
catalogues (Catalogues) – Collection of beam cataloues to consider
- Returns:
The pair of beam catalogues for this step. If there are no catalogues to shift None is returned.
- Return type:
CataloguePair | None
- cross_bones.align_catalogues.get_parser() argparse.ArgumentParser¶
- cross_bones.align_catalogues.make_and_plot_match_matrix(catalogues: cross_bones.catalogue.Catalogues, plot_path: None | pathlib.Path = None) tuple[numpy.typing.NDArray[float], pathlib.Path]¶
Run the making and plotting of the match matrix
- cross_bones.align_catalogues.make_catalogue_matrix(catalogues: cross_bones.catalogue.Catalogues) MatchMatrix¶
Match each catalogue to each other
- Parameters:
catalogues (Catalogues) – Collection of beamwise component catalogues
- Returns:
Matrix of matches
- Return type:
MatchMatrix
- cross_bones.align_catalogues.perform_iterative_shifter(catalogues: cross_bones.catalogue.Catalogues, passes: int = 1, gather_statistics: bool = True, output_prefix: str | None = None, plot_through_iterations: bool = False) cross_bones.catalogue.Catalogues¶
Attempt to shift catalogues to a common reference frame. A seed catalogue is selected, then a catalogue at a time is selected and aligned. This may be repeated a number of times.
- Parameters:
catalogues (Catalogues) – Catalogues that should be aligned
passes (int, optional) – How many passes over all catalogues should be performed. Defaults to 1.
gather_statistics (bool, optional) – Whether statistics across the convergence should be collected. This can be time consuming as all catalogues are matched to one another. Defaults to True.
output_prefix (str | None, optional) – The prefix to attach to output products. Defaults to None.
plot_through_iteration (bool, optional) – Create diagnostic plots throughout the iterative convergence. Defaults to False.
- Returns:
The shifted catalogues
- Return type:
Catalogues
- cross_bones.align_catalogues.plot_iteration_step(catalogues: cross_bones.catalogue.Catalogues, new_catalogue: cross_bones.catalogue.Catalogue, pair_match: CataloguePair, step: int, output_prefix: str | None = None) pathlib.Path¶
Create a diagnostic plot intended to show how the iterative method is perform. This will print the outputs of a single step.
- Parameters:
catalogues (Catalogues) – The catalogues being considered
new_catalogue (Catalogue) – The new catalogue that has had the additive offsets applied
pair_match (CataloguePair) – The pair of nominated catalogues in this iteration
step (int) – The step of the iterative convergence.
output_prefix (str | None, optional) – The base output path. Defaults to None.
- Returns:
The path of the figure written to file
- Return type:
Path
- cross_bones.align_catalogues.plot_iterative_shift_stats(step_statistics: list[StepInfo], output_path: pathlib.Path | None = None) pathlib.Path¶
Plot the progression of matching statistics over rounds. The list of
StepInfois assumed to be in order.
- cross_bones.align_catalogues.plot_match_matrix(matrix: MatchMatrix, output_path: None | pathlib.Path = None) pathlib.Path¶
Plot the match matrix from the beam-wise matching
- Parameters:
matrix (MatchMatrix) – The beame to beam number of matches
output_path (None | Path, optional) – Location to write image to. If None ‘match_matrix.png’ is used. Defaults to None.
- Returns:
Path of new plot
- Return type:
Path
- cross_bones.align_catalogues.plot_top_pairs_in_matrix(catalogues: cross_bones.catalogue.Catalogues, match_matrix: MatchMatrix, output_prefix: str, top_pairs: int = 10) Paths¶
- cross_bones.align_catalogues.reseed_initial_fixed_catalogue(catalogues: cross_bones.catalogue.Catalogues) cross_bones.catalogue.Catalogues¶
- cross_bones.align_catalogues.set_seed_catalogues(catalogues: cross_bones.catalogue.Catalogues, match_matrix: MatchMatrix, force_idx: int | None = None) cross_bones.catalogue.Catalogues¶
Select a beam to fix into place so others are matched to it. This is done by identifying the beam with the most matches to other beams.
- Parameters:
catalogues (Catalogues) – The collection of beam catalogues to consider
match_matrix (MatchMatrix) – The beam-to-beam sky-match result set
force_idx (int | None) – Manual selection if not None
- Returns:
The same as the input catalouges, with the exception of a fixed beam
- Return type:
Catalogues
- cross_bones.align_catalogues.MatchMatrix: typing_extensions.TypeAlias¶
- cross_bones.align_catalogues.Paths¶