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-sims
csst_msc_sim
Commits
e66531a3
Commit
e66531a3
authored
Jul 29, 2024
by
Fang Yuedong
Browse files
bug fix C9_Catalog.py and ExtinctionMW.py
parent
b8d16247
Changes
2
Hide whitespace changes
Inline
Side-by-side
catalog/C9_Catalog.py
View file @
e66531a3
...
@@ -262,7 +262,7 @@ class Catalog(CatalogBase):
...
@@ -262,7 +262,7 @@ class Catalog(CatalogBase):
if
"enable_mw_ext_gal"
in
self
.
config
[
"catalog_options"
]
and
self
.
config
[
"catalog_options"
][
"enable_mw_ext_gal"
]:
if
"enable_mw_ext_gal"
in
self
.
config
[
"catalog_options"
]
and
self
.
config
[
"catalog_options"
][
"enable_mw_ext_gal"
]:
MW_Av_arr
=
self
.
mw_ext
.
Av_from_Planck
(
ra
=
ra_arr
,
dec
=
dec_arr
)
MW_Av_arr
=
self
.
mw_ext
.
Av_from_Planck
(
ra
=
ra_arr
,
dec
=
dec_arr
)
else
:
else
:
MW_Av_arr
=
np
.
one
s
(
len
(
ra_arr
))
MW_Av_arr
=
np
.
zero
s
(
len
(
ra_arr
))
for
igals
in
range
(
ngals
):
for
igals
in
range
(
ngals
):
# # (TEST)
# # (TEST)
...
...
observation_sim/mock_objects/ExtinctionMW.py
View file @
e66531a3
...
@@ -13,7 +13,7 @@ class ExtinctionMW(object):
...
@@ -13,7 +13,7 @@ class ExtinctionMW(object):
@
staticmethod
@
staticmethod
def
radec2pix
(
ra
,
dec
,
NSIDE
=
2048
):
def
radec2pix
(
ra
,
dec
,
NSIDE
=
2048
):
return
hp
.
pixelfunc
.
ang2pix
(
nside
=
NSIDE
,
theta
=
ra
,
phi
=
dec
,
nest
ed
=
True
,
lonlat
=
True
)
return
hp
.
pixelfunc
.
ang2pix
(
nside
=
NSIDE
,
theta
=
ra
,
phi
=
dec
,
nest
=
True
,
lonlat
=
True
)
def
init_ext_model
(
self
,
model_name
=
"odonnell"
,
Av
=
1.0
,
Rv
=
3.1
,
lamb
=
None
):
def
init_ext_model
(
self
,
model_name
=
"odonnell"
,
Av
=
1.0
,
Rv
=
3.1
,
lamb
=
None
):
self
.
model_name
=
model_name
self
.
model_name
=
model_name
...
@@ -80,7 +80,7 @@ class ExtinctionMW(object):
...
@@ -80,7 +80,7 @@ class ExtinctionMW(object):
l
,
b
=
c
.
l
.
radian
,
c
.
b
.
radian
l
,
b
=
c
.
l
.
radian
,
c
.
b
.
radian
NSIDE
=
hp
.
pixelfunc
.
get_nside
(
self
.
ebv_planck
)
NSIDE
=
hp
.
pixelfunc
.
get_nside
(
self
.
ebv_planck
)
pix
=
hp
.
pixelfunc
.
ang2pix
(
pix
=
hp
.
pixelfunc
.
ang2pix
(
nside
=
NSIDE
,
theta
=
np
.
pi
/
2.
-
b
,
phi
=
l
,
nest
ed
=
True
)
nside
=
NSIDE
,
theta
=
np
.
pi
/
2.
-
b
,
phi
=
l
,
nest
=
True
)
return
self
.
ebv_planck
[
pix
]
*
self
.
Rv
return
self
.
ebv_planck
[
pix
]
*
self
.
Rv
def
apply_extinction
(
self
,
spec
,
Av
=
1.0
):
def
apply_extinction
(
self
,
spec
,
Av
=
1.0
):
...
@@ -91,6 +91,6 @@ class ExtinctionMW(object):
...
@@ -91,6 +91,6 @@ class ExtinctionMW(object):
raise
ValueError
(
raise
ValueError
(
"Need to initialize the extinction model (init_ext_model) first"
)
"Need to initialize the extinction model (init_ext_model) first"
)
scale
=
10
**
(
-
.
4
*
self
.
ext
*
Av
)
scale
=
10
**
(
-
.
4
*
self
.
ext
*
Av
)
print
(
"scale = "
,
scale
)
#
print("scale = ", scale)
spec
*=
scale
spec
*=
scale
return
spec
return
spec
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