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
Sylvia Biscoveanu
bilby
Commits
a8c30f9a
Commit
a8c30f9a
authored
6 years ago
by
Colm Talbot
Committed by
Moritz Huebner
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Allow overwrite results
parent
205dadd4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+2
-0
2 additions, 0 deletions
CHANGELOG.md
tupak/core/result.py
+18
-6
18 additions, 6 deletions
tupak/core/result.py
with
20 additions
and
6 deletions
CHANGELOG.md
+
2
−
0
View file @
a8c30f9a
...
...
@@ -27,6 +27,8 @@ Changes currently on master, but not under a tag.
-
PowerSpectralDensity structure modified
-
Fixed bug in get_open_data
-
.prior files are no longer created. The prior is stored in the result object.
-
Users can now choose to overwrite existing result files, rather than creating
a .old file.
### Removed
-
Removes the "--detectors" command line argument (not a general CLI requirement)
...
...
This diff is collapsed.
Click to expand it.
tupak/core/result.py
+
18
−
6
View file @
a8c30f9a
...
...
@@ -167,15 +167,27 @@ class Result(dict):
item
=
[
Result
.
_standardise_a_string
(
i
)
for
i
in
item
]
return
item
def
save_to_file
(
self
):
"""
Writes the Result to a deepdish h5 file
"""
def
save_to_file
(
self
,
overwrite
=
False
):
"""
Writes the Result to a deepdish h5 file
Parameters
----------
overwrite: bool, optional
Whether or not to overwrite an existing result file.
default=False
"""
file_name
=
result_file_name
(
self
.
outdir
,
self
.
label
)
utils
.
check_directory_exists_and_if_not_mkdir
(
self
.
outdir
)
if
os
.
path
.
isfile
(
file_name
):
logger
.
debug
(
'
Renaming existing file {} to {}.old
'
.
format
(
file_name
,
file_name
))
os
.
rename
(
file_name
,
file_name
+
'
.old
'
)
if
overwrite
:
logger
.
debug
(
'
Removing existing file {}
'
.
format
(
file_name
))
os
.
remove
(
file_name
)
else
:
logger
.
debug
(
'
Renaming existing file {} to {}.old
'
.
format
(
file_name
,
file_name
))
os
.
rename
(
file_name
,
file_name
+
'
.old
'
)
logger
.
debug
(
"
Saving result to {}
"
.
format
(
file_name
))
...
...
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