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-commons
Commits
18f1fb13
Commit
18f1fb13
authored
Jun 21, 2023
by
Wei Shoulin
Browse files
msc level2
parent
26093469
Changes
5
Hide whitespace changes
Inline
Side-by-side
csst_dfs_commons/models/constants.py
View file @
18f1fb13
...
...
@@ -13,12 +13,6 @@ REF_TYPE_SKY = "sky"
REF_TYPES
=
(
REF_TYPE_BIAS
,
REF_TYPE_DARK
,
REF_TYPE_FlAT
,
REF_TYPE_ARC
,
REF_TYPE_LAMP
,
REF_TYPE_SKY
)
OBS_TYPE_SCI
=
"sci"
OBS_TYPE_CAL
=
"cal"
OBS_TYPE_TEST
=
"test"
OBS_TYPE_JOIN
=
"join"
# joint observation fo IFS and MCI
OBS_TYPES
=
(
OBS_TYPE_SCI
,
OBS_TYPE_CAL
,
OBS_TYPE_TEST
,
OBS_TYPE_JOIN
)
MODULE_MSC
=
"MSC"
MODULE_MBI
=
"MBI"
MODULE_SLS
=
"SLS"
...
...
@@ -73,6 +67,8 @@ SLS_DECTECTORS2FILTER = {
30
:
"GI"
}
MSC_SCI_OBS_TYPE
=
'SCI'
MSC_SCI_OBS_TYPE
=
'SCIE'
SCI_OBS_TYPES
=
[
MSC_SCI_OBS_TYPE
]
SCI_OBS_TYPES
=
[
MSC_SCI_OBS_TYPE
]
\ No newline at end of file
DEFAULT_NSIDE
=
256
\ No newline at end of file
csst_dfs_commons/models/msc.py
View file @
18f1fb13
...
...
@@ -286,4 +286,5 @@ class Level2CoCatalogRecord(BaseModel):
RatioErr_Disk
:
float
=
-
1
Spread_Model
:
float
=
-
1
SpreadErr_Model
:
float
=
-
1
NS128HIdx
:
int
=
0
Brick_Id
:
int
=
0
Filter
:
str
=
''
csst_dfs_commons/utils/fits.py
View file @
18f1fb13
...
...
@@ -23,7 +23,7 @@ def get_header_value(key: str, headers, default_value = None):
except
Exception
as
e
:
return
default_value
def
get_healpix_id
(
ra
,
dec
,
nside
=
3
2
):
def
get_healpix_id
(
ra
,
dec
,
nside
=
2
56
):
try
:
hp
=
HEALPix
(
nside
=
nside
,
order
=
'nested'
,
frame
=
ICRS
())
coord
=
SkyCoord
(
ra
=
ra
*
u
.
deg
,
dec
=
dec
*
u
.
deg
,
frame
=
'icrs'
)
...
...
@@ -31,7 +31,7 @@ def get_healpix_id(ra, dec, nside=32):
except
:
return
-
1
def
get_healpix_ids
(
ra
,
dec
,
radius
,
nside
=
3
2
):
def
get_healpix_ids
(
ra
,
dec
,
radius
,
nside
=
2
56
):
hp
=
HEALPix
(
nside
=
nside
,
order
=
'nested'
,
frame
=
ICRS
())
coord
=
SkyCoord
(
ra
=
ra
*
u
.
deg
,
dec
=
dec
*
u
.
deg
,
frame
=
'icrs'
)
return
hp
.
cone_search_skycoord
(
coord
,
radius
=
radius
*
u
.
deg
)
...
...
@@ -72,4 +72,5 @@ def hdul_of_healpix_ids(hdulist, nside=256):
xyzpoly
=
tuple
(
map
(
tuple
,
xyzpoly
))
xyzpoly
=
np
.
array
(
xyzpoly
).
reshape
(
-
1
,
3
)
healpixids
=
hp
.
query_polygon
(
nside
,
xyzpoly
.
T
)
return
healpixids
test/test_fits.py
0 → 100644
View file @
18f1fb13
import
unittest
from
astropy.io
import
fits
from
csst_dfs_commons.utils.fits
import
get_header_value
,
get_healpix_id
,
get_healpix_ids
,
hdul_of_healpix_ids
class
CommonFitsTestCase
(
unittest
.
TestCase
):
def
setUp
(
self
):
pass
def
test_hdul_of_healpix_ids
(
self
):
hdul
=
fits
.
open
()
r
=
hdul_of_healpix_ids
(
id
=
1
)
test/test_models.py
View file @
18f1fb13
...
...
@@ -12,3 +12,4 @@ class CommonModelsTestCase(unittest.TestCase):
r
=
Request
(
id
=
1
)
assert
r
.
id
==
1
,
"not equal"
assert
r
.
xxx
==
''
,
"not equal"
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