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

removed deprecated files

parent 960c79b2
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)
#%% 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"))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment