Commit 101b92e3 authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

removed deprecated files

parent 960c79b2
Loading
Loading
Loading
Loading

csst/common/factory.py

deleted100644 → 0
+0 −40
Original line number Diff line number Diff line
from astropy.io import fits

from csst.common.data import INSTRUMENT_LIST
from csst.msc.mscdata import CsstMscImgData


class CsstDataFactory:
    """
    This class is designed to create CsstData and its inherited classes according to different kinds of input data format.
    """

    def __init__(self):
        pass

    @staticmethod
    def createData(fitsfilename):
        """ create CSST Data instances

        Parameters
        ----------
        fitsfilename:
            the file name of fits files

        Returns
        -------

        """

        try:
            hl = fits.open(fitsfilename)
            instrument = hl[0].header.get('INSTRUME')  # strip or not?
            detector = hl[0].header.get('DETECTOR')  # strip or not?
            print(instrument, detector)
            assert instrument in INSTRUMENT_LIST
            if instrument == 'MSC' and 6 <= int(detector[3:5]) <= 25:
                # multi-band imaging
                data = CsstMscImgData(hl[0], hl[1], instrument=instrument, detector=detector)
            return data
        except Exception as e:
            print(e)

csst/test/untitled0.py

deleted100644 → 0
+0 −12
Original line number Diff line number Diff line
#%% code


fp = "/Users/cham/projects/csst/test/MSC_MS_210527171000_100000279_16_raw.fits"

from csst.common.factory import CsstDataFactory

data = CsstDataFactory.createData(fp)

print(data)

print(data.get_l0keyword("pri", "INSTRUME"))