Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
cigale
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
12
Issues
12
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cigale
cigale
Commits
4766aa5f
Commit
4766aa5f
authored
Mar 04, 2018
by
Médéric Boquien
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compute the valid models only once and use a slice when they are all valid.
parent
b1f763c7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
CHANGELOG.md
CHANGELOG.md
+1
-0
pcigale/analysis_modules/pdf_analysis/workers.py
pcigale/analysis_modules/pdf_analysis/workers.py
+4
-1
No files found.
CHANGELOG.md
View file @
4766aa5f
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
### Changed
### Changed
### Fixed
### Fixed
### Optimised
### Optimised
-
The estimation of the physical properties is made a bit faster when all the models are valid. (Médéric Boquien)
## 0.12.1 (2018-02-27)
## 0.12.1 (2018-02-27)
### Fixed
### Fixed
...
...
pcigale/analysis_modules/pdf_analysis/workers.py
View file @
4766aa5f
...
@@ -187,6 +187,10 @@ def analysis(idx, obs):
...
@@ -187,6 +187,10 @@ def analysis(idx, obs):
# We use the exponential probability associated with the χ² as
# We use the exponential probability associated with the χ² as
# likelihood function.
# likelihood function.
likelihood
=
np
.
exp
(
-
chi2
/
2.
)
likelihood
=
np
.
exp
(
-
chi2
/
2.
)
wlikely
=
np
.
where
(
np
.
isfinite
(
likelihood
))
# If all the models are valid, it is much more efficient to use a slice
if
likelihood
.
size
==
wlikely
[
0
]
.
size
:
wlikely
=
slice
(
None
,
None
)
gbl_results
.
bayes
.
weights
[
idx
]
=
np
.
nansum
(
likelihood
)
gbl_results
.
bayes
.
weights
[
idx
]
=
np
.
nansum
(
likelihood
)
# We compute the weighted average and standard deviation using the
# We compute the weighted average and standard deviation using the
...
@@ -203,7 +207,6 @@ def analysis(idx, obs):
...
@@ -203,7 +207,6 @@ def analysis(idx, obs):
else
:
else
:
values
=
_
(
gbl_models
.
properties
[
i
,
wz
])
values
=
_
(
gbl_models
.
properties
[
i
,
wz
])
wlikely
=
np
.
where
(
np
.
isfinite
(
likelihood
))
mean
,
std
=
weighted_param
(
values
[
wlikely
],
likelihood
[
wlikely
])
mean
,
std
=
weighted_param
(
values
[
wlikely
],
likelihood
[
wlikely
])
gbl_results
.
bayes
.
means
[
idx
,
i
]
=
mean
gbl_results
.
bayes
.
means
[
idx
,
i
]
=
mean
gbl_results
.
bayes
.
errors
[
idx
,
i
]
=
std
gbl_results
.
bayes
.
errors
[
idx
,
i
]
=
std
...
...
Write
Preview
Markdown
is supported
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