Skip to content

Commit

Permalink
Merge pull request #469 from fermiPy/fix_clobber
Browse files Browse the repository at this point in the history
Compatibility with Astropy 5.10
  • Loading branch information
henrikef committed Jun 4, 2022
2 parents 21c968d + 91d6854 commit b016308
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion fermipy/ltcube.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,4 +443,4 @@ def write(self, outfile):
hdu.header['TSTOP'] = ''

with fits.HDUList(hdus) as hdulist:
hdulist.writeto(outfile, clobber=True)
hdulist.writeto(outfile, overwrite=True)
2 changes: 1 addition & 1 deletion fermipy/scripts/coadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def main():
args.files[0])

if args.output:
hdulist.writeto(args.output, clobber=args.clobber, output_verify='silentfix')
hdulist.writeto(args.output, overwrite=args.clobber, output_verify='silentfix')

if __name__ == '__main__':
main()
2 changes: 1 addition & 1 deletion fermipy/scripts/gather_srcmaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def main():
hdulistout = do_gather(args.files)

if args.output:
hdulistout.writeto(args.output, clobber=args.clobber)
hdulistout.writeto(args.output, overwrite=args.clobber)

if args.gzip:
os.system('gzip -9 %s'%args.output)
Expand Down
10 changes: 5 additions & 5 deletions fermipy/tsmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def extract_images_from_tscube(infile, outfile):
outhdulist.append(hdu)

hdulist = fits.HDUList(outhdulist)
hdulist.writeto(outfile, clobber=True)
hdulist.writeto(outfile, overwrite=True)
return hdulist


Expand All @@ -78,7 +78,7 @@ def convert_tscube(infile, outfile):
inhdulist = fits.open(infile)
if 'dloglike_scan' in inhdulist['SCANDATA'].columns.names:
if infile != outfile:
inhdulist.writeto(outfile, clobber=True)
inhdulist.writeto(outfile, overwrite=True)
return
elif 'E_MIN_FL' in inhdulist['EBOUNDS'].columns.names:
return convert_tscube_old(infile, outfile)
Expand All @@ -96,7 +96,7 @@ def convert_tscube(infile, outfile):
colname = col.name.lower()
col.name = colname.replace('dfde', 'dnde')

inhdulist.writeto(outfile, clobber=True)
inhdulist.writeto(outfile, overwrite=True)
return inhdulist


Expand All @@ -107,7 +107,7 @@ def convert_tscube_old(infile, outfile):
# If already in the new-style format just write and exit
if 'DLOGLIKE_SCAN' in inhdulist['SCANDATA'].columns.names:
if infile != outfile:
inhdulist.writeto(outfile, clobber=True)
inhdulist.writeto(outfile, overwrite=True)
return

# Get stuff out of the input file
Expand Down Expand Up @@ -256,7 +256,7 @@ def convert_tscube_old(infile, outfile):

hdulist['SCANDATA'].header['UL_CONF'] = 0.95

hdulist.writeto(outfile, clobber=True)
hdulist.writeto(outfile, overwrite=True)

return hdulist

Expand Down
4 changes: 2 additions & 2 deletions fermipy/validate/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ def write(self, outfile, compress=False):

if compress:
fp = gzip.GzipFile(outfile + '.gz', 'wb')
hdulist.writeto(fp, clobber=True)
hdulist.writeto(fp, overwrite=True)
else:
hdulist.writeto(outfile, clobber=True)
hdulist.writeto(outfile, overwrite=True)

def calc_sep(self, tab, src_list):

Expand Down
2 changes: 1 addition & 1 deletion fermipy/wcs_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,4 +506,4 @@ def extract_mapcube_region(infile, skydir, outfile, maphdu=0):

hdu_image = fits.PrimaryHDU(data, header=region_wcs.to_header())
hdulist = fits.HDUList([hdu_image, h['ENERGIES']])
hdulist.writeto(outfile, clobber=True)
hdulist.writeto(outfile, overwrite=True)

0 comments on commit b016308

Please sign in to comment.