Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
lscsoft
bilby
Commits
b0f3834f
Commit
b0f3834f
authored
Jun 12, 2018
by
Moritz Huebner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added some docstrings and made a method static
parent
e2439a6c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
4 deletions
+31
-4
tupak/core/result.py
tupak/core/result.py
+31
-4
No files found.
tupak/core/result.py
View file @
b0f3834f
...
...
@@ -7,7 +7,19 @@ import corner
def
result_file_name
(
outdir
,
label
):
""" Returns the standard filename used for a result file """
""" Returns the standard filename used for a result file
Parameters
----------
outdir: str
Name of the output directory
label: str
Naming scheme of the output file
Returns
-------
str: File name of the output file
"""
return
'{}/{}_result.h5'
.
format
(
outdir
,
label
)
...
...
@@ -21,8 +33,14 @@ def read_in_result(outdir=None, label=None, filename=None):
filename: str
If given, try to load from this filename
Returns:
result: tupak.result.Result instance
Returns
-------
result: tupak.core.result.Result
Raises:
-------
ValueError: If no filename is given and either outdir or label is None
If no tupak.core.result.Result is found in the path
"""
if
filename
is
None
:
...
...
@@ -37,6 +55,14 @@ def read_in_result(outdir=None, label=None, filename=None):
class
Result
(
dict
):
def
__init__
(
self
,
dictionary
=
None
):
""" A class to save the results of the sampling run.
Parameters
----------
dictionary: dict
A dictionary containing values to be set in this instance
"""
dict
.
__init__
(
self
)
if
type
(
dictionary
)
is
dict
:
for
key
in
dictionary
:
...
...
@@ -70,7 +96,8 @@ class Result(dict):
else
:
return
''
def
_standardise_a_string
(
self
,
item
):
@
staticmethod
def
_standardise_a_string
(
item
):
""" When reading in data, ensure all strings are decoded correctly """
if
type
(
item
)
in
[
bytes
]:
return
item
.
decode
()
...
...
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