Commit 2b1f9f4b authored by vertighel's avatar vertighel
Browse files

Added automatic name in the form RAW.telescop_keyword.time_stamp.fits

parent 1eaa1d28
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -140,6 +140,7 @@ class FitsFileHandler(FileSystemEventHandler):

        try:
            if self.auto_filename:
                # Have to double from noche.py as there is also the directory
                log.info(f"AUTO filename in the form: RAW.telescop_key.time_stamp.fits")
                prefix = "RAW"
                tel = self.noche.header["TELESCOP"].replace(" ","_").upper()
+9 −0
Original line number Diff line number Diff line
@@ -593,6 +593,7 @@ class Noche:
            self.hdu = hdul[0].copy() # to avoid I/O issues with writing

    def write_noctis_fits(self, filename=None, overwrite=True):
        log.debug(sys._getframe().f_code.co_name)

        data = self.hdu.data # Original data
        original_hdu = fits.ImageHDU(header=self.hdu.header, name="ORIGINAL")
@@ -609,6 +610,14 @@ class Noche:
        print(noche_hdu.header)
        
        hdul = fits.HDUList([noche_hdu, original_hdu])

        if not filename:
            prefix = "RAW"
            tel = self.noche.header["TELESCOP"].replace(" ","_").upper()
            timestamp = self.noche.header["DATE-OBS"].replace(":","_")
            filename = self.output_dir / f"{prefix}.{tel}.{timestamp}.fits"
            log.warning(f"No filename provided, using {filename}")
        
        hdul.writeto(filename,
                      overwrite=overwrite, checksum=True)