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
77b9ca85
Commit
77b9ca85
authored
Apr 08, 2022
by
BO ZHANG
🏀
Browse files
removed try except in read
parent
440b5669
Changes
1
Hide whitespace changes
Inline
Side-by-side
csst/msc/data.py
View file @
77b9ca85
...
...
@@ -135,18 +135,14 @@ class CsstMscImgData(CsstMscData):
>>> print("instrument: ", data.get_l0keyword("pri", "INSTRUME"))
>>> print("object: ", data.get_l0keyword("pri", "OBJECT"))
"""
try
:
with
fits
.
open
(
fp
)
as
hdulist
:
instrument
=
hdulist
[
0
].
header
.
get
(
'INSTRUME'
)
# strip or not?
detector
=
hdulist
[
0
].
header
.
get
(
'DETECTOR'
)
# strip or not?
print
(
"@CsstMscImgData: reading data {} ..."
.
format
(
fp
))
assert
instrument
in
INSTRUMENT_LIST
if
instrument
==
'MSC'
and
6
<=
int
(
detector
[
3
:
5
])
<=
25
:
# multi-band imaging
hdu0
=
hdulist
[
0
].
copy
()
hdu1
=
hdulist
[
1
].
copy
()
data
=
CsstMscImgData
(
hdu0
,
hdu1
,
instrument
=
instrument
,
detector
=
detector
)
return
data
except
Exception
as
e
:
print
(
e
)
with
fits
.
open
(
fp
)
as
hdulist
:
instrument
=
hdulist
[
0
].
header
.
get
(
'INSTRUME'
)
# strip or not?
detector
=
hdulist
[
0
].
header
.
get
(
'DETECTOR'
)
# strip or not?
print
(
"@CsstMscImgData: reading data {} ..."
.
format
(
fp
))
assert
instrument
in
INSTRUMENT_LIST
if
instrument
==
'MSC'
and
6
<=
int
(
detector
[
3
:
5
])
<=
25
:
# multi-band imaging
hdu0
=
hdulist
[
0
].
copy
()
hdu1
=
hdulist
[
1
].
copy
()
data
=
CsstMscImgData
(
hdu0
,
hdu1
,
instrument
=
instrument
,
detector
=
detector
)
return
data
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