diff --git a/src/ipyaladin/widget.py b/src/ipyaladin/widget.py index b5088c0a..c909d655 100644 --- a/src/ipyaladin/widget.py +++ b/src/ipyaladin/widget.py @@ -296,6 +296,30 @@ def target(self, target: Union[str, SkyCoord]) -> None: } ) + def hips2fits(self, hips: str, output_file: Optional[str] = None) -> None: + """Convert a HiPS image to a FITS file. + + Parameters + ---------- + hips: str + The HiPS to convert. See here for a list of available HiPS: + https://aladin.cds.unistra.fr/hips/list + output_file: str, optional + The name of the output FITS file. If None, the FITS file is not saved. + + """ + from astroquery.hips2fits import hips2fits + + fits = hips2fits.query_with_wcs( + hips=hips, + format="fits", + get_query_payload=False, + wcs=self.wcs, + ) + if output_file is not None: + fits.writeto(output_file) + return fits + def add_catalog_from_URL( self, votable_URL: str, votable_options: Optional[dict] = None ) -> None: