Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Guang
x-cigale
Commits
d03e2a66
Commit
d03e2a66
authored
Apr 26, 2019
by
Guang
Committed by
Guang
Oct 23, 2019
Browse files
fix bugs for det_alpha_ox realization
parent
717bdbb4
Changes
1
Hide whitespace changes
Inline
Side-by-side
pcigale/analysis_modules/pdf_analysis/utils.py
View file @
d03e2a66
...
@@ -254,14 +254,17 @@ def compute_chi2(models, obs, corr_dz, wz, lim_flag):
...
@@ -254,14 +254,17 @@ def compute_chi2(models, obs, corr_dz, wz, lim_flag):
model
=
models
.
flux
[
band
][
wz
]
model
=
models
.
flux
[
band
][
wz
]
chi2
+=
((
model
*
scaling
-
flux
)
*
inv_flux_err
)
**
2.
chi2
+=
((
model
*
scaling
-
flux
)
*
inv_flux_err
)
**
2.
# Penalize det_alpha_ox out of the user-set range
# Penalize det_alpha_ox
which lie
out of the user-set range
if
'xray'
in
models
.
params
.
modules
:
if
'xray'
in
models
.
params
.
modules
:
# Get the model indice that have valid AGN component
agn_idxs
=
np
.
where
(
models
.
extprop
[
'agn.agn_intrin_Lnu_2500A'
][
wz
]
>
0
)[
0
]
# Calculate expected alpha_ox from Lnu_2500 (Just et al. 2007)
# Calculate expected alpha_ox from Lnu_2500 (Just et al. 2007)
exp_alpha_ox
=
-
0.137
*
np
.
log10
(
models
.
extprop
[
'agn.agn_intrin_Lnu_2500A'
][
wz
]
*
1e7
*
scaling
)
+
2.638
exp_alpha_ox
=
-
0.137
*
np
.
log10
(
models
.
extprop
[
'agn.agn_intrin_Lnu_2500A'
][
wz
]
[
agn_idxs
]
*
1e7
*
scaling
[
agn_idxs
]
)
+
2.638
# Calculate det_alpha_ox = alpha_ox - alpha_ox(Lnu_2500)
# Calculate det_alpha_ox = alpha_ox - alpha_ox(Lnu_2500)
det_alpha_ox
=
models
.
intprop
[
'xray.alpha_ox'
][
wz
]
-
exp_alpha_ox
det_alpha_ox
=
models
.
intprop
[
'xray.alpha_ox'
][
wz
]
[
agn_idxs
]
-
exp_alpha_ox
# If det_alpha_ox out of range, set corresponding chi2 to nan
# If det_alpha_ox out of range, set corresponding chi2 to nan
chi2
[
np
.
abs
(
det_alpha_ox
)
>
models
.
intprop
[
'xray.max_dev_alpha_ox'
][
wz
]]
=
np
.
nan
nan_idxs
=
agn_idxs
[
np
.
abs
(
det_alpha_ox
)
>
models
.
intprop
[
'xray.max_dev_alpha_ox'
][
wz
][
agn_idxs
]
]
chi2
[
nan_idxs
]
=
np
.
nan
# Computation of the χ² from intensive properties
# Computation of the χ² from intensive properties
for
name
,
prop
in
obs
.
intprop
.
items
():
for
name
,
prop
in
obs
.
intprop
.
items
():
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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