Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
lscsoft
bilby
Commits
82db951c
Commit
82db951c
authored
May 17, 2018
by
plasky
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git.ligo.org:Monash/tupak
parents
96129f0d
ac14b8db
Pipeline
#19446
passed with stages
in 5 minutes and 46 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
5 deletions
+23
-5
tupak/result.py
tupak/result.py
+17
-4
tupak/sampler.py
tupak/sampler.py
+6
-1
No files found.
tupak/result.py
View file @
82db951c
...
...
@@ -17,13 +17,26 @@ def result_file_name(outdir, label):
return
'{}/{}_result.h5'
.
format
(
outdir
,
label
)
def
read_in_result
(
outdir
,
label
):
""" Read in a saved .h5 data file """
def
read_in_result
(
outdir
=
None
,
label
=
None
,
filename
=
None
):
""" Read in a saved .h5 data file
Parameters
----------
outdir, label: str
If given, use the default naming convention for saved results file
filename: str
If given, try to load from this filename
Returns:
result: tupak.result.Result instance
"""
if
filename
is
None
:
filename
=
result_file_name
(
outdir
,
label
)
if
os
.
path
.
isfile
(
filename
):
return
Result
(
deepdish
.
io
.
load
(
filename
))
else
:
r
eturn
None
r
aise
ValueError
(
"No information given to load file"
)
class
Result
(
dict
):
...
...
tupak/sampler.py
View file @
82db951c
...
...
@@ -200,7 +200,12 @@ class Sampler(object):
logging
.
debug
(
"Command line argument clean given, forcing rerun"
)
self
.
cached_result
=
None
return
try
:
self
.
cached_result
=
read_in_result
(
self
.
outdir
,
self
.
label
)
except
ValueError
:
self
.
cached_result
=
None
if
utils
.
command_line_args
.
use_cached
:
logging
.
debug
(
"Command line argument cached given, no cache check performed"
)
return
...
...
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