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
cigale
CIGALE
Commits
f1a8c751
Commit
f1a8c751
authored
Mar 30, 2018
by
Médéric Boquien
Browse files
Multiplications are faster than division, so we directly use the inverse error
parent
44625d3d
Changes
1
Show whitespace changes
Inline
Side-by-side
pcigale/analysis_modules/pdf_analysis/utils.py
View file @
f1a8c751
...
...
@@ -144,17 +144,19 @@ def _compute_scaling(model_fluxes, model_propsmass, obs):
num
=
np
.
zeros
(
model_fluxes
.
shape
[
1
])
denom
=
np
.
zeros
(
model_fluxes
.
shape
[
1
])
for
i
in
range
(
obs
.
fluxes
.
size
):
# Multiplications are faster than division, so we directly use the
# inverse error
inv_err2
=
1.
/
obs
.
fluxes_err
[
i
]
**
2.
if
np
.
isfinite
(
obs
.
fluxes
[
i
])
and
obs
.
fluxes_err
[
i
]
>
0.
:
num
+=
model_fluxes
[
i
,
:]
*
(
obs
.
fluxes
[
i
]
/
(
obs
.
fluxes_err
[
i
]
*
obs
.
fluxes_err
[
i
]))
num
+=
model_fluxes
[
i
,
:]
*
(
obs
.
fluxes
[
i
]
*
inv_err2
)
denom
+=
np
.
square
(
model_fluxes
[
i
,
:]
*
(
1.
/
obs
.
fluxes_err
[
i
]))
for
i
in
range
(
obs
.
extprops
.
size
):
# Multiplications are faster than division, so we directly use the
# inverse error
inv_err2
=
1.
/
obs
.
extprops_err
[
i
]
**
2.
if
np
.
isfinite
(
obs
.
extprops
[
i
])
and
obs
.
extprops_err
[
i
]
>
0.
:
num
+=
model_propsmass
[
i
,
:]
*
(
obs
.
extprops
[
i
]
/
(
obs
.
extprops_err
[
i
]
*
obs
.
extprops_err
[
i
]))
denom
+=
np
.
square
(
model_propsmass
[
i
,
:]
*
(
1.
/
obs
.
extprops_err
[
i
]))
num
+=
model_propsmass
[
i
,
:]
*
(
obs
.
extprops
[
i
]
*
inv_err2
)
denom
+=
model_propsmass
[
i
,
:]
**
2.
*
inv_err2
return
num
/
denom
...
...
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