***
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
7a4d6c56
Commit
7a4d6c56
authored
4 years ago
by
Kappl, Patrick
Browse files
Options
Downloads
Patches
Plain Diff
Add own function to read jackknife config file
parent
e26bd514
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
main.py
+29
-17
29 additions, 17 deletions
main.py
with
29 additions
and
17 deletions
main.py
+
29
−
17
View file @
7a4d6c56
...
...
@@ -43,6 +43,32 @@ def main():
jackknife configuration file and the number of processes.
Everything after that will be ignored.
"""
)
general
,
observables
=
_read_config_file
(
config_file_name
)
adga
=
Adga
(
general
[
"
adga_root_directory
"
],
general
[
"
adga_config_file
"
],
general
[
"
two_particle_file
"
],
observables
,
n_processes
)
x_generator
=
adga
.
get_worm_sample_generator
()
n
=
adga
.
n_worm_samples
f
=
adga
.
calculate_observables
# Do the Jackknife estimation
jackknife
=
Jackknife
(
x_generator
,
n
,
f
,
-
1
,
general
[
"
output_file_prefix
"
],
general
[
"
store_output_samples
"
])
jackknife
.
do_estimation
()
jackknife
.
write_results_to_file
()
adga
.
write_config_data_to_file
(
jackknife
.
output_file_name
)
return
def
_read_config_file
(
config_file_name
):
# Read and return general config data and observables from the given
# file.
#
# :raise KeyError: if an obligatory key is missing in the config
# file
# :raise SystemExit: if no observables are given in the config file
# Define the dictionary for the [General] section of the INI file.
# Obligatory keys are set to `None`.
general
=
{
"
adga_root_directory
"
:
None
,
...
...
@@ -74,24 +100,10 @@ def main():
for
key
in
config
[
"
Observables
"
]:
observables
[
key
]
=
config
[
"
Observables
"
][
key
]
if
len
(
observables
)
==
0
:
print
(
"
No Observables were given. Since you don
'
t want to
"
+
"
calculate anything we
'
re done.
"
)
sys
.
exit
()
adga
=
Adga
(
general
[
"
adga_root_directory
"
],
general
[
"
adga_config_file
"
],
general
[
"
two_particle_file
"
],
observables
,
n_processes
)
x_generator
=
adga
.
get_worm_sample_generator
()
n
=
adga
.
n_worm_samples
f
=
adga
.
calculate_observables
raise
SystemExit
(
"
No Observables were given. Since you don
'
t want to
"
+
"
calculate anything we
'
re done.
"
)
# Do the Jackknife estimation
jackknife
=
jk
.
Jackknife
(
x_generator
,
n
,
f
,
-
1
,
general
[
"
output_file_prefix
"
],
general
.
getboolean
(
"
store_output_samples
"
))
jackknife
.
do_estimation
()
jackknife
.
write_results_to_file
()
adga
.
write_config_data_to_file
(
jackknife
.
output_file_name
)
return
return
general
,
observables
if
__name__
==
"
__main__
"
:
...
...
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