Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
watpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
CoRe
watpy
Commits
63edceeb
Commit
63edceeb
authored
3 years ago
by
Sebastiano Bernuzzi
Browse files
Options
Downloads
Patches
Plain Diff
Improved description of CoRe_h5()
parent
70a01b34
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
watpy/utils/coreh5.py
+16
-5
16 additions, 5 deletions
watpy/utils/coreh5.py
with
16 additions
and
5 deletions
watpy/utils/coreh5.py
+
16
−
5
View file @
63edceeb
...
...
@@ -19,15 +19,27 @@ def write_keyh5(l, m, r):
"""
Writes key string
'
l#_m#_r#
'
"""
if
(
r
==
rInf
)
:
if
r
==
rInf
:
key
=
'
l{}_m{}_rInf
'
.
format
(
l
,
m
)
else
:
key
=
'
l{}_m{}_r{:05d}
'
.
format
(
l
,
m
,
int
(
r
))
return
key
class
CoRe_h5
():
class
CoRe_h5
(
object
):
"""
Class to read/write CoRe HDF5 archives
CoRe h5 are simple HDF5 archives made of
group/dataset
The convention for the relevant groups is
'
rh_{lm}
'
/ : strain mode {lm}, .e.g
'
rh_22
'
'
rpsi4_{lm}
'
/ : Psi4 mode {lm}, e.g.
'
rpsi4_22
'
'
energy
'
/ : energetics
The datasets of these groups correspond to waveforms extracted at
different extraction radii
"""
def
__init__
(
self
,
path
,
metadata
=
None
,
dfile
=
'
data.h5
'
):
self
.
path
=
path
...
...
@@ -84,7 +96,7 @@ class CoRe_h5():
If path is not specified, search the .txt files under self.path
Always write .h5 files to self.path
Deprecated, use
the
create_dset if possible.
Deprecated, use create_dset if possible.
"""
if
path
is
None
:
path
==
self
.
path
self
.
dfile
=
'
data.h5
'
...
...
@@ -140,7 +152,7 @@ class CoRe_h5():
--------
dataset as numpy array
Deprecated, use
the c
rea
te
_dset if possible.
Deprecated, use rea
d
_dset if possible.
"""
dset
=
None
with
h5py
.
File
(
os
.
path
.
join
(
self
.
path
,
self
.
dfile
),
'
r
'
)
as
fn
:
...
...
@@ -167,7 +179,6 @@ class CoRe_h5():
else
:
raise
ValueError
(
"
Unknown group {}
"
.
format
(
group
))
return
np
.
array
(
dset
)
def
dump
(
self
):
"""
...
...
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