lightcurvelynx.astro_utils.coordinate_utils
Functions
|
Batch convert right ascension and declination to Cartesian coordinates. |
|
Remove duplicate coordinates within a specified threshold. |
|
Build a MOC at a given depth from RA and Dec coordinates, such that each |
Module Contents
- ra_dec_to_cartesian(ra, dec)[source]
Batch convert right ascension and declination to Cartesian coordinates.
We use this custom function over Astropy’s built-in conversion for performance reasons. Because we know the data is in degrees and we only need Cartesian coordinates, we can skip object creation and units. The results are roughly 50x faster.
- Parameters:
ra (float or numpy.ndarray) – Right ascension in degrees.
dec (float or numpy.ndarray) – Declination in degrees.
- Returns:
x (float or numpy.ndarray) – X coordinate.
y (float or numpy.ndarray) – Y coordinate.
z (float or numpy.ndarray) – Z coordinate.
- dedup_coords(ra, dec, threshold=1e-05)[source]
Remove duplicate coordinates within a specified threshold.
- Parameters:
ra (numpy.ndarray) – Array of right ascension values in degrees.
dec (numpy.ndarray) – Array of declination values in degrees.
threshold (float) – Minimum separation in degrees to consider two points as distinct.
- Returns:
unique_ra (numpy.ndarray) – Array of unique right ascension values.
unique_dec (numpy.ndarray) – Array of unique declination values.
unique_indices (numpy.ndarray) – Indices of the unique coordinates in the original arrays.
- build_moc_from_coords(ra, dec, depth=8)[source]
Build a MOC at a given depth from RA and Dec coordinates, such that each point is covered by the MOC.
- Parameters:
ra (numpy.ndarray) – Array of right ascension values in degrees.
dec (numpy.ndarray) – Array of declination values in degrees.
depth (int) – Maximum depth of the MOC. Higher values give finer resolution but larger MOC size.
- Returns:
moc – MOC object representing the sky coverage of the input coordinates.
- Return type:
MOC