***
Wartungsfenster jeden ersten Mittwoch vormittag im Monat
***
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jackknife
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
E138 Institute of Solid State Physics
E138-01 Computational Materials Science
Software
jackknife
Commits
b343c0ef
Commit
b343c0ef
authored
5 years ago
by
Patrick Kappl
Browse files
Options
Downloads
Patches
Plain Diff
Remove hdf5shenanigans.py
parent
b59a4e22
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
hdf5shenanigans.py
+0
-66
0 additions, 66 deletions
hdf5shenanigans.py
with
0 additions
and
66 deletions
hdf5shenanigans.py
deleted
100644 → 0
+
0
−
66
View file @
b59a4e22
#%%
import
h5py
from
shutil
import
copyfile
import
numpy
as
np
#%%
N_WORM_GROUPS
=
1
FILE_NAME
=
"
g4iw_avg.hdf5
"
#%%
file
=
h5py
.
File
(
FILE_NAME
,
"
r+
"
)
#%%
str
=
"
worm-001/ineq-001/g4iw-worm/00001/value
"
a
=
file
[
str
]
#%%
b
=
a
[...]
print
(
b
[
0
,
0
,
0
])
b
=
b
*
2
print
(
b
[
0
,
0
,
0
])
#%%
# Go through all g4iw-worm subgroups
g4iw_group_name
=
"
worm-001/ineq-001/g4iw-worm/
"
super_indexes
=
list
(
file
[
g4iw_group_name
].
keys
())
g4iw_value_names
=
[
g4iw_group_name
+
i
+
"
/value
"
for
i
in
super_indexes
]
g4iw_values
=
np
.
array
([
file
[
g4iw_value_name
]
for
g4iw_value_name
in
g4iw_value_names
])
print
(
g4iw_values
)
#%%
def
get_g4iw_worm_sample_generator
(
g4iw_hdf5_file
):
"""
Return a generator yielding greens functions from the file.
"""
file
=
g4iw_hdf5_file
def
g4iw_worm_sample_generator
():
g4iw_worm_groups
=
[
s
+
"
/ineq-001/g4iw-worm/
"
for
s
in
file
.
keys
()
if
(
"
worm-
"
in
s
)
and
(
s
!=
"
worm-last
"
)]
super_indexes
=
list
(
file
[
g4iw_worm_groups
[
0
]].
keys
())
for
worm_group
in
g4iw_worm_groups
:
value_names
=
[
worm_group
+
i
+
"
/value
"
for
i
in
super_indexes
]
yield
np
.
array
([
file
[
value_name
]
for
value_name
in
value_names
])
return
g4iw_worm_sample_generator
#%%
def
get_n_worm_samples
(
g4iw_hdf5_file
):
"""
Return the number of worm samples in the given HDF5 file.
"""
file
=
g4iw_hdf5_file
return
sum
(
1
for
s
in
file
.
keys
()
if
(
"
worm-
"
in
s
)
and
(
s
!=
"
worm-last
"
))
#%%
# Test generator
file
=
h5py
.
File
(
"
g4iw_avg.hdf5
"
)
g4iw_samples
=
get_g4iw_worm_sample_generator
(
file
)
g_sum
=
0
for
g
in
g4iw_samples
():
g_sum
+=
g
print
(
g_sum
)
#%%
file
.
close
()
\ No newline at end of file
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