potpyri.primitives.solve_wcs
WCS solution using astrometry.net and Gaia DR3 alignment.
Provides coarse solution via solve-field and fine alignment by matching detected sources to Gaia. Writes RADISP/DEDISP and updated WCS to FITS. Authors: Kerry Paterson, Charlie Kilpatrick.
Functions
|
Refine WCS by matching detected sources to Gaia DR3 and fitting WCS. |
|
Remove astrometry.net temporary files (.axy, .corr, .solved, .wcs, etc.). |
|
Query Gaia DR3 for stars in the field; return filtered catalog table. |
|
Run astrometry.net (solve-field) to get coarse WCS; optionally use custom index. |
- potpyri.primitives.solve_wcs.align_to_gaia(file, tel, radius=0.5, max_search_radius=<Quantity 5. arcsec>, save_centroids=False, min_gaia_match=7, log=None)[source]
Refine WCS by matching detected sources to Gaia DR3 and fitting WCS.
- Parameters:
file (
str) – Path to FITS file with WCS (e.g. after solve_astrometry).tel (
Instrument) – Instrument instance.radius (
float, optional) – Gaia query radius in degrees. Default is 0.5.max_search_radius (
astropy.units.Quantity, optional) – Match radius for source-Gaia matching. Default is 5 arcsec.save_centroids (
bool, optional) – If True, save centroid table. Default is False.min_gaia_match (
int, optional) – Minimum number of Gaia matches required. Default is 7.log (
ColoredLogger, optional) – Logger for progress.
- Returns:
True if alignment succeeded and WCS was updated, False otherwise.
- Return type:
bool
- potpyri.primitives.solve_wcs.clean_up_astrometry(directory, file, exten)[source]
Remove astrometry.net temporary files (.axy, .corr, .solved, .wcs, etc.).
- Parameters:
directory (
str) – Directory containing the files.file (
str) – Base filename (with extension); exten is replaced to form temp names.exten (
str) – File extension (e.g. ‘.fits’) to replace with .axy, .corr, etc.
- Return type:
None
- potpyri.primitives.solve_wcs.get_gaia_catalog(input_file, log=None)[source]
Query Gaia DR3 for stars in the field; return filtered catalog table.
Uses header RA/DEC to define field; filters by PSS, Plx, PM.
- Parameters:
input_file (
str) – Path to FITS file; header used for CRVAL1/CRVAL2 or RA/DEC.log (
ColoredLogger, optional) – Logger for progress and errors.
- Returns:
Filtered Gaia DR3 table (PSS>0.99, Plx<20, PM<10), or None if empty, or False if coordinates could not be parsed.
- Return type:
astropy.table.TableorNoneorFalse- Raises:
Exception – If Gaia query fails after retries.
- potpyri.primitives.solve_wcs.solve_astrometry(file, tel, binn, paths, radius=0.5, replace=True, shift_only=False, index=None, log=None)[source]
Run astrometry.net (solve-field) to get coarse WCS; optionally use custom index.
- Parameters:
file (
str) – Path to FITS file to solve.tel (
Instrument) – Instrument instance (name, get_pixscale).binn (
str) – Binning string (e.g. ‘22’) for pixel scale.paths (
dict) – Paths dict (source_extractor key for solve-field).radius (
float, optional) – Search radius in degrees. Default is 0.5.replace (
bool, optional) – If True, write WCS into original file; else write .solved.fits.shift_only (
bool, optional) – If True, only update CRPIX/CRVAL. Default is False.index (
str, optional) – Path to custom index file or directory for solve-field.log (
ColoredLogger, optional) – Logger for progress.
- Returns:
True if solve succeeded, False otherwise.
- Return type:
bool