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
49034427
Commit
49034427
authored
6 years ago
by
Gregory Ashton
Browse files
Options
Downloads
Patches
Plain Diff
Update documentation and rename method
parent
cb14c42a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!39
Adding cached data check
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tupak/result.py
+5
-5
5 additions, 5 deletions
tupak/result.py
tupak/sampler.py
+2
-1
2 additions, 1 deletion
tupak/sampler.py
with
7 additions
and
6 deletions
tupak/result.py
+
5
−
5
View file @
49034427
...
...
@@ -18,6 +18,7 @@ def result_file_name(outdir, label):
def
read_in_result
(
outdir
,
label
):
"""
Read in a saved .h5 data file
"""
filename
=
result_file_name
(
outdir
,
label
)
if
os
.
path
.
isfile
(
filename
):
return
Result
(
deepdish
.
io
.
load
(
filename
))
...
...
@@ -53,6 +54,7 @@ class Result(dict):
return
''
def
save_to_file
(
self
,
outdir
,
label
):
"""
Writes the Result to a deepdish h5 file
"""
file_name
=
result_file_name
(
outdir
,
label
)
if
os
.
path
.
isdir
(
outdir
)
is
False
:
os
.
makedirs
(
outdir
)
...
...
@@ -215,10 +217,10 @@ class Result(dict):
(
4
*
self
.
posterior
.
q
+
3
)
/
(
3
*
self
.
posterior
.
q
+
4
)
*
self
.
posterior
.
q
*
self
.
posterior
.
a_2
*
np
.
sin
(
self
.
posterior
.
tilt_2
))
def
check_attribute_match_to_other_
resul
t
(
self
,
name
,
other_
resul
t
):
"""
Check attribute name exists in other_
resul
t and is the same
"""
def
check_attribute_match_to_other_
objec
t
(
self
,
name
,
other_
objec
t
):
"""
Check attribute name exists in other_
objec
t and is the same
"""
A
=
getattr
(
self
,
name
,
False
)
B
=
getattr
(
other_
resul
t
,
name
,
False
)
B
=
getattr
(
other_
objec
t
,
name
,
False
)
logging
.
debug
(
'
Checking {} value: {}=={}
'
.
format
(
name
,
A
,
B
))
if
(
A
is
not
False
)
and
(
B
is
not
False
):
typeA
=
type
(
A
)
...
...
@@ -230,5 +232,3 @@ class Result(dict):
return
np
.
all
(
A
==
B
)
return
False
This diff is collapsed.
Click to expand it.
tupak/sampler.py
+
2
−
1
View file @
49034427
...
...
@@ -190,6 +190,7 @@ class Sampler(object):
pass
def
check_cached_result
(
self
):
"""
Check if the cached data file exists and can be used
"""
logging
.
debug
(
"
Checking cached data
"
)
self
.
cached_result
=
read_in_result
(
self
.
outdir
,
self
.
label
)
if
self
.
cached_result
:
...
...
@@ -197,7 +198,7 @@ class Sampler(object):
'
kwargs
'
]
use_cache
=
True
for
key
in
check_keys
:
if
self
.
cached_result
.
check_attribute_match_to_other_
resul
t
(
if
self
.
cached_result
.
check_attribute_match_to_other_
objec
t
(
key
,
self
)
is
False
:
logging
.
debug
(
"
Cached value {} is unmatched
"
.
format
(
key
))
use_cache
=
False
...
...
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