***
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
8f1609aa
Commit
8f1609aa
authored
5 years ago
by
Patrick Kappl
Browse files
Options
Downloads
Patches
Plain Diff
Save jackknife output in HDF5 file
parent
397934fe
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
jackknife.py
+19
-7
19 additions, 7 deletions
jackknife.py
main.py
+3
-7
3 additions, 7 deletions
main.py
with
22 additions
and
14 deletions
jackknife.py
+
19
−
7
View file @
8f1609aa
import
numpy
as
np
import
h5py
# TODO: Update docstring
# TODO: Rewrite the docstring with argument descriptions
def
do_jackknife_estimation
(
input_sample_generator
,
n_samples
,
transformation_function
):
"""
Do a jackknife estimation for the transformed sample.
transformation_function
,
output_file_name
=
"
jackknife.hdf5
"
):
"""
Do a jackknife estimation for the given samples and function.
Estimate and return the sample mean, variance and standard deviation
of the transformed
sampl
e y = f(x), where x is the input sample and
of the transformed
valu
e y = f(x), where x is the input sample and
f() is the transformation function. The expectation value <y> is
estimated using the Jackknife algorithm, which does a resampling of
the input x and then a bias-corrected transformation. For more
...
...
@@ -48,10 +52,18 @@ def do_jackknife_estimation(input_sample_generator, n_samples,
output_variance
=
sum_of_squares
-
np
.
abs
(
sum_
)
**
2
/
n_samples
output_variance
/=
(
n_samples
-
1
)
output_standard_deviation
=
np
.
lib
.
scimath
.
sqrt
(
output_variance
)
return
(
output_mean
,
output_variance
,
output_standard_deviation
,
transformed_mean
)
out_file
=
h5py
.
File
(
output_file_name
,
"
w
"
)
out_file
.
create_dataset
(
"
estimated_mean
"
,
data
=
output_mean
)
out_file
.
create_dataset
(
"
estimated_variance
"
,
data
=
output_variance
)
out_file
.
create_dataset
(
"
estimated_standard_deviation
"
,
data
=
output_standard_deviation
)
out_file
.
create_dataset
(
"
transformed_input_mean
"
,
data
=
transformed_mean
)
out_file
.
close
()
return
# TODO: Rewrite the docstring with argument descriptions
def
resample_and_transform
(
sample
,
n_samples
,
sample_mean
,
transformation_function
,
transformed_mean
):
"""
Do a resampling and a bias-corrected transformation.
...
...
This diff is collapsed.
Click to expand it.
main.py
+
3
−
7
View file @
8f1609aa
...
...
@@ -5,6 +5,7 @@ import numpy as np
# %%
# TODO: Make the paths and files command line options
abinitio_dga
=
adga
.
Adga
(
"
/home/pkappl/Programs/ADGA
"
,
"
dga.conf
"
,
"
two_particle_4_worms.hdf5
"
)
x_generator
=
abinitio_dga
.
get_worm_sample_generator
()
...
...
@@ -12,10 +13,5 @@ n = abinitio_dga.n_worm_samples
f
=
abinitio_dga
.
__call__
# %%
# Do a Jackknife estimation with the x-values and f() and print the
# results
output
=
jackknife
.
do_jackknife_estimation
(
x_generator
,
n
,
f
)
print
(
"
{}{}
"
.
format
(
"
f(mean(x)) =
"
,
output
[
3
]))
print
(
"
{}{}
"
.
format
(
"
mean(y
'
) =
"
,
output
[
0
]))
print
(
"
{}{}
"
.
format
(
"
variance(y
'
) =
"
,
output
[
1
]))
print
(
"
{}{}
"
.
format
(
"
standard deviation(y
'
) =
"
,
output
[
2
]))
# Do the Jackknife estimation
jackknife
.
do_jackknife_estimation
(
x_generator
,
n
,
f
)
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