|
17 | 17 |
|
18 | 18 | # Imports ASTRO |
19 | 19 | from astropy.coordinates import SkyCoord |
20 | | -from astropy.io import fits |
21 | 20 | from astropy.table import Table |
22 | 21 | import astropy.units as u |
23 | 22 | from astropy.wcs.utils import skycoord_to_pixel |
| 23 | +import fitsio |
24 | 24 |
|
25 | 25 | # Imports INTERNAL |
26 | 26 | from phrosty.imagesubtraction import sky_subtract, stampmaker |
@@ -134,7 +134,7 @@ def get_psf( self, ra, dec ): |
134 | 134 | stamp = self.psfobj.get_stamp( x, y ) |
135 | 135 | if self.keep_intermediate: |
136 | 136 | outfile = self.save_dir / f"psf_{self.image.name}.fits" |
137 | | - fits.writeto( outfile, stamp, overwrite=True ) |
| 137 | + fitsio.write( outfile, stamp, clobber=True ) |
138 | 138 |
|
139 | 139 | return stamp |
140 | 140 |
|
@@ -586,7 +586,11 @@ def log_error( x ): |
586 | 586 |
|
587 | 587 | def write_fits_file( self, data, header, savepath ): |
588 | 588 | try: |
589 | | - fits.writeto( savepath, data, header=header, overwrite=True ) |
| 589 | + if header is not None: |
| 590 | + hdr_dict = dict(header.items()) |
| 591 | + else: |
| 592 | + hdr_dict = None |
| 593 | + fitsio.write( savepath, data, header=hdr_dict, clobber=True ) |
590 | 594 | except Exception as e: |
591 | 595 | SNLogger.exception( f"Exception writing FITS image {savepath}: {e}" ) |
592 | 596 | raise |
|
0 commit comments