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
csst-dfs
csst-dfs-api-local
Commits
cb2e0a9e
Commit
cb2e0a9e
authored
Mar 19, 2021
by
Wei Shoulin
Browse files
reconstruct
parent
24af0302
Changes
21
Show whitespace changes
Inline
Side-by-side
tests/test_ifs_result1.py
0 → 100644
View file @
cb2e0a9e
import
os
import
unittest
from
astropy.io
import
fits
from
csst_dfs_api_local.ifs
import
Result1Api
class
IFSResult1TestCase
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
api
=
Result1Api
()
# def test_find(self):
# recs = self.api.find(file_name='CCD2_ObsTime_1200_ObsNum_40.fits')
# print('find:', recs)
# assert len(recs) == 1
# recs = self.api.find()
# print('find:', recs)
# assert len(recs) > 0
def
test_read
(
self
):
recs
=
self
.
api
.
find
(
file_name
=
'CCD2_ObsTime_1200_ObsNum_40.fits'
)
print
(
"The full path: "
,
os
.
path
.
join
(
self
.
api
.
root_dir
,
recs
[
0
][
'file_path'
]))
rec
,
result0s
=
self
.
api
.
get
(
fits_id
=
recs
[
0
][
'id'
])
print
(
result0s
)
file_segments
=
self
.
api
.
read
(
file_path
=
rec
[
'file_path'
])
file_bytes
=
b
''
.
join
(
file_segments
)
hdul
=
fits
.
HDUList
.
fromstring
(
file_bytes
)
print
(
hdul
.
info
())
hdr
=
hdul
[
0
].
header
print
(
repr
(
hdr
))
# def test_write(self):
# self.api.write(result0_ids = [1,2,3,4],
# file_path='/opt/temp/csst_ifs/CCD2_ObsTime_1200_ObsNum_40.fits',
# proc_type = 'default')
# recs = self.api.find(raw_id=1)
# print()
# print(recs)
# print("="*80)
# recs = self.api.find(file_name='CCD2_ObsTime_1200_ObsNum_40.fits')
# print(recs)
Prev
1
2
Next
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