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
Kaylee deSoto
bilby
Commits
be6a6de7
Commit
be6a6de7
authored
6 years ago
by
Virginia D'Emilio
Browse files
Options
Downloads
Patches
Plain Diff
adding functions
parent
6f45533a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bilby/core/sampler/dynesty.py
+18
-2
18 additions, 2 deletions
bilby/core/sampler/dynesty.py
with
18 additions
and
2 deletions
bilby/core/sampler/dynesty.py
+
18
−
2
View file @
be6a6de7
...
...
@@ -86,7 +86,7 @@ class Dynesty(NestedSampler):
def
__init__
(
self
,
likelihood
,
priors
,
outdir
=
'
outdir
'
,
label
=
'
label
'
,
use_ratio
=
False
,
plot
=
False
,
skip_import_verification
=
False
,
check_point
=
True
,
n_check_point
=
None
,
check_point_delta_t
=
600
,
resume
=
True
,
**
kwargs
):
resume
=
True
,
dynesty_res
=
False
,
**
kwargs
):
NestedSampler
.
__init__
(
self
,
likelihood
=
likelihood
,
priors
=
priors
,
outdir
=
outdir
,
label
=
label
,
use_ratio
=
use_ratio
,
plot
=
plot
,
skip_import_verification
=
skip_import_verification
,
...
...
@@ -94,6 +94,7 @@ class Dynesty(NestedSampler):
self
.
n_check_point
=
n_check_point
self
.
check_point
=
check_point
self
.
resume
=
resume
self
.
dynesty_res
=
dynesty_res
if
self
.
n_check_point
is
None
:
# If the log_likelihood_eval_time is not calculable then
# check_point is set to False.
...
...
@@ -200,8 +201,14 @@ class Dynesty(NestedSampler):
if
self
.
plot
:
self
.
generate_trace_plots
(
out
)
self
.
generate_evidence_plots
(
out
)
print
(
'
This code has been edited by Virginia
'
)
return
self
.
result
if
self
.
dynesty_res
:
self
.
res
=
out
return
self
.
result
,
self
.
res
else
:
return
self
.
result
def
_run_external_sampler_without_checkpointing
(
self
):
logger
.
debug
(
"
Running sampler without checkpointing
"
)
...
...
@@ -402,6 +409,15 @@ class Dynesty(NestedSampler):
fig
.
tight_layout
()
fig
.
savefig
(
filename
)
def
generate_evidence_plots
(
self
,
dynesty_results
):
check_directory_exists_and_if_not_mkdir
(
self
.
outdir
)
filename
=
'
{}/{}_evidence.png
'
.
format
(
self
.
outdir
,
self
.
label
)
logger
.
debug
(
"
Writing evidence plot to {}
"
.
format
(
filename
))
from
dynesty
import
plotting
as
dyplot
fig
,
axes
=
dyplot
.
runplot
(
dynesty_results
)
fig
.
tight_layout
()
fig
.
savefig
(
filename
)
def
_run_test
(
self
):
import
dynesty
self
.
sampler
=
dynesty
.
NestedSampler
(
...
...
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