Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bilby
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
Container Registry
Model registry
Operate
Environments
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
lscsoft
bilby
Commits
3407a67f
Commit
3407a67f
authored
5 years ago
by
Colm Talbot
Browse files
Options
Downloads
Patches
Plain Diff
Make final plot safer
parent
c847c753
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!748
WIP: Improve dynesty checkpointing II
,
!746
Pickle dump entire sampler in dynesty
Pipeline
#111812
passed
5 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bilby/core/sampler/dynesty.py
+18
-12
18 additions, 12 deletions
bilby/core/sampler/dynesty.py
with
18 additions
and
12 deletions
bilby/core/sampler/dynesty.py
+
18
−
12
View file @
3407a67f
...
...
@@ -132,7 +132,8 @@ class Dynesty(NestedSampler):
def
__getstate__
(
self
):
"""
For pickle: remove external_sampler, which can be an unpicklable
"
module
"
"""
state
=
self
.
__dict__
.
copy
()
del
state
[
'
external_sampler
'
]
if
"
external_sampler
"
in
state
:
del
state
[
'
external_sampler
'
]
return
state
@property
...
...
@@ -418,8 +419,8 @@ class Dynesty(NestedSampler):
if
self
.
check_point_plot
:
import
dynesty.plotting
as
dyplot
labels
=
[
label
.
replace
(
'
_
'
,
'
'
)
for
label
in
self
.
search_parameter_keys
]
filename
=
"
{}/{}_checkpoint_trace.png
"
.
format
(
self
.
outdir
,
self
.
label
)
try
:
filename
=
"
{}/{}_checkpoint_trace.png
"
.
format
(
self
.
outdir
,
self
.
label
)
fig
=
dyplot
.
traceplot
(
self
.
sampler
.
results
,
labels
=
labels
)[
0
]
fig
.
tight_layout
()
fig
.
savefig
(
filename
)
...
...
@@ -428,8 +429,8 @@ class Dynesty(NestedSampler):
logger
.
warning
(
'
Failed to create dynesty state plot at checkpoint
'
)
finally
:
plt
.
close
(
"
all
"
)
filename
=
"
{}/{}_checkpoint_run.png
"
.
format
(
self
.
outdir
,
self
.
label
)
try
:
filename
=
"
{}/{}_checkpoint_run.png
"
.
format
(
self
.
outdir
,
self
.
label
)
fig
,
axs
=
dyplot
.
runplot
(
self
.
sampler
.
results
)
fig
.
tight_layout
()
plt
.
savefig
(
filename
)
...
...
@@ -438,15 +439,20 @@ class Dynesty(NestedSampler):
logger
.
warning
(
'
Failed to create dynesty run plot at checkpoint
'
)
finally
:
plt
.
close
(
'
all
'
)
filename
=
"
{}/{}_checkpoint_stats.png
"
.
format
(
self
.
outdir
,
self
.
label
)
fig
,
axs
=
plt
.
subplots
(
nrows
=
3
,
sharex
=
True
)
for
ax
,
name
in
zip
(
axs
,
[
"
boundidx
"
,
"
nc
"
,
"
scale
"
]):
ax
.
plot
(
getattr
(
self
.
sampler
,
f
"
saved_
{
name
}
"
),
color
=
"
C0
"
)
ax
.
set_ylabel
(
name
)
axs
[
-
1
].
set_xlabel
(
"
iteration
"
)
fig
.
tight_layout
()
plt
.
savefig
(
filename
)
plt
.
close
(
'
all
'
)
try
:
filename
=
"
{}/{}_checkpoint_stats.png
"
.
format
(
self
.
outdir
,
self
.
label
)
fig
,
axs
=
plt
.
subplots
(
nrows
=
3
,
sharex
=
True
)
for
ax
,
name
in
zip
(
axs
,
[
"
boundidx
"
,
"
nc
"
,
"
scale
"
]):
ax
.
plot
(
getattr
(
self
.
sampler
,
f
"
saved_
{
name
}
"
),
color
=
"
C0
"
)
ax
.
set_ylabel
(
name
)
axs
[
-
1
].
set_xlabel
(
"
iteration
"
)
fig
.
tight_layout
()
plt
.
savefig
(
filename
)
except
(
RuntimeError
,
ValueError
)
as
e
:
logger
.
warning
(
e
)
logger
.
warning
(
'
Failed to create dynesty stats plot at checkpoint
'
)
finally
:
plt
.
close
(
'
all
'
)
def
generate_trace_plots
(
self
,
dynesty_results
):
check_directory_exists_and_if_not_mkdir
(
self
.
outdir
)
...
...
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