Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bilby
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sylvia Biscoveanu
bilby
Commits
7e06d202
Commit
7e06d202
authored
3 years ago
by
Gregory Ashton
Browse files
Options
Downloads
Patches
Plain Diff
Add run statistics to the dynesty meta data
parent
10ab5d05
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bilby/core/sampler/dynesty.py
+13
-12
13 additions, 12 deletions
bilby/core/sampler/dynesty.py
with
13 additions
and
12 deletions
bilby/core/sampler/dynesty.py
+
13
−
12
View file @
7e06d202
...
...
@@ -375,7 +375,6 @@ class Dynesty(NestedSampler):
dill
.
dump
(
out
,
file
)
self
.
_generate_result
(
out
)
self
.
calc_likelihood_count
()
self
.
result
.
sampling_time
=
self
.
sampling_time
if
self
.
plot
:
...
...
@@ -385,7 +384,9 @@ class Dynesty(NestedSampler):
def
_generate_result
(
self
,
out
):
import
dynesty
weights
=
np
.
exp
(
out
[
'
logwt
'
]
-
out
[
'
logz
'
][
-
1
])
from
scipy.special
import
logsumexp
logwts
=
out
[
"
logwt
"
]
weights
=
np
.
exp
(
logwts
-
out
[
'
logz
'
][
-
1
])
nested_samples
=
DataFrame
(
out
.
samples
,
columns
=
self
.
search_parameter_keys
)
nested_samples
[
'
weights
'
]
=
weights
...
...
@@ -398,6 +399,16 @@ class Dynesty(NestedSampler):
self
.
result
.
log_evidence
=
out
.
logz
[
-
1
]
self
.
result
.
log_evidence_err
=
out
.
logzerr
[
-
1
]
self
.
result
.
information_gain
=
out
.
information
[
-
1
]
self
.
result
.
num_likelihood_evaluations
=
getattr
(
self
.
sampler
,
'
ncall
'
,
0
)
logneff
=
logsumexp
(
logwts
)
*
2
-
logsumexp
(
logwts
*
2
)
neffsamples
=
int
(
np
.
exp
(
logneff
))
self
.
result
.
meta_data
[
"
run_statistics
"
]
=
dict
(
nlikelihood
=
self
.
result
.
num_likelihood_evaluations
,
neffsamples
=
neffsamples
,
sampling_time_s
=
self
.
sampling_time
.
seconds
,
ncores
=
self
.
kwargs
.
get
(
"
queue_size
"
,
1
)
)
def
_run_nested_wrapper
(
self
,
kwargs
):
"""
Wrapper function to run_nested
...
...
@@ -703,16 +714,6 @@ class Dynesty(NestedSampler):
"""
return
self
.
priors
.
rescale
(
self
.
_search_parameter_keys
,
theta
)
def
calc_likelihood_count
(
self
):
if
self
.
likelihood_benchmark
:
if
hasattr
(
self
,
'
sampler
'
):
self
.
result
.
num_likelihood_evaluations
=
\
getattr
(
self
.
sampler
,
'
ncall
'
,
0
)
else
:
self
.
result
.
num_likelihood_evaluations
=
0
else
:
return
None
def
sample_rwalk_bilby
(
args
):
"""
Modified bilby-implemented version of dynesty.sampling.sample_rwalk
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment