AlecThomson / RACS-tools

Useful scripts for RACS
BSD 3-Clause "New" or "Revised" License
12 stars 7 forks source link

output files overwrite input files if there is no ".fits" extension #45

Closed Sunmish closed 1 year ago

Sunmish commented 1 year ago

Images without ".fits" extension in the filename will be overwritten regardless of input suffix.

I would suggest replacing:

outname = outname.replace(".fits", f".{suffix}.fits")

with something a little safer like:

outname = outname.replace(".fits", "") + f".{suffix}.fits"

or something nicer to ensure non-standard extensions (e.g. ".FITS") are respected.

AlecThomson commented 1 year ago

Thanks for catching @Sunmish - this is a nasty little bug!

I'm happy to put your suggested change in. Although some evil part of me wants to say "we don't support files that don't end in '.fits'" hah!

Sunmish commented 1 year ago

The bug bit me so I thought I'd bring it up! For reference, the SPAM pipeline has a default ".FITS" output naming scheme.