*** Wartungsfenster jeden ersten Mittwoch vormittag im Monat ***

Skip to content
Snippets Groups Projects
Commit 7a4d6c56 authored by Kappl, Patrick's avatar Kappl, Patrick
Browse files

Add own function to read jackknife config file

parent e26bd514
No related branches found
No related tags found
No related merge requests found
......@@ -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__":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment