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
Marc Arene
bilby
Commits
feea4c58
Commit
feea4c58
authored
6 years ago
by
Gregory Ashton
Browse files
Options
Downloads
Plain Diff
Merge branch '345-resume-file-removed-before-result-file-output' into 'master'
Resolve "Resume file removed before result file output" Closes
#345
See merge request
!417
parents
b237c32e
4826f8fc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bilby/core/result.py
+7
-2
7 additions, 2 deletions
bilby/core/result.py
bilby/core/sampler/__init__.py
+9
-6
9 additions, 6 deletions
bilby/core/sampler/__init__.py
bilby/core/sampler/dynesty.py
+4
-1
4 additions, 1 deletion
bilby/core/sampler/dynesty.py
with
20 additions
and
9 deletions
bilby/core/result.py
+
7
−
2
View file @
feea4c58
...
...
@@ -412,12 +412,17 @@ class Result(object):
default=False
outdir: str, optional
Path to the outdir. Default is the one stored in the result object.
extension: str, optional {json, hdf5}
Determines the method to use to store the data
extension: str, optional {json, hdf5, True}
Determines the method to use to store the data (if True defaults
to json)
gzip: bool, optional
If true, and outputing to a json file, this will gzip the resulting
file and add
'
.gz
'
to the file extension.
"""
if
extension
is
True
:
extension
=
"
json
"
outdir
=
self
.
_safe_outdir_creation
(
outdir
,
self
.
save_to_file
)
file_name
=
result_file_name
(
outdir
,
self
.
label
,
extension
,
gzip
)
...
...
This diff is collapsed.
Click to expand it.
bilby/core/sampler/__init__.py
+
9
−
6
View file @
feea4c58
...
...
@@ -167,6 +167,10 @@ def run_sampler(likelihood, priors=None, label='label', outdir='outdir',
else
:
result
=
sampler
.
run_sampler
()
# Initial save of the sampler in case of failure in post-processing
if
save
:
result
.
save_to_file
(
extension
=
save
,
gzip
=
gzip
)
end_time
=
datetime
.
datetime
.
now
()
result
.
sampling_time
=
(
end_time
-
start_time
).
total_seconds
()
logger
.
info
(
'
Sampling time: {}
'
.
format
(
end_time
-
start_time
))
...
...
@@ -188,12 +192,11 @@ def run_sampler(likelihood, priors=None, label='label', outdir='outdir',
result
.
samples_to_posterior
(
likelihood
=
likelihood
,
priors
=
result
.
priors
,
conversion_function
=
conversion_function
)
if
save
==
'
hdf5
'
:
result
.
save_to_file
(
extension
=
'
hdf5
'
)
logger
.
info
(
"
Results saved to {}/
"
.
format
(
outdir
))
elif
save
:
result
.
save_to_file
(
gzip
=
gzip
)
logger
.
info
(
"
Results saved to {}/
"
.
format
(
outdir
))
if
save
:
# The overwrite here ensures we overwrite the initially stored data
result
.
save_to_file
(
overwrite
=
True
,
extension
=
save
,
gzip
=
gzip
)
if
plot
:
result
.
plot_corner
()
logger
.
info
(
"
Summary of results:
\n
{}
"
.
format
(
result
))
...
...
This diff is collapsed.
Click to expand it.
bilby/core/sampler/dynesty.py
+
4
−
1
View file @
feea4c58
...
...
@@ -189,7 +189,10 @@ class Dynesty(NestedSampler):
if
self
.
kwargs
[
"
verbose
"
]:
print
(
""
)
# self.result.sampler_output = out
dynesty_result
=
"
{}/{}_dynesty.pickle
"
.
format
(
self
.
outdir
,
self
.
label
)
with
open
(
dynesty_result
,
'
wb
'
)
as
file
:
pickle
.
dump
(
out
,
file
)
weights
=
np
.
exp
(
out
[
'
logwt
'
]
-
out
[
'
logz
'
][
-
1
])
nested_samples
=
DataFrame
(
out
.
samples
,
columns
=
self
.
search_parameter_keys
)
...
...
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