Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bo Zhang
csst
Commits
101b92e3
Commit
101b92e3
authored
Mar 02, 2022
by
BO ZHANG
🏀
Browse files
removed deprecated files
parent
960c79b2
Changes
2
Show whitespace changes
Inline
Side-by-side
csst/common/factory.py
deleted
100644 → 0
View file @
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
)
csst/test/untitled0.py
deleted
100644 → 0
View file @
960c79b2
#%% 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"
))
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment