Skip to content
Snippets Groups Projects
Commit fbfba54f authored by David Hendriks's avatar David Hendriks
Browse files

re-formatted

parent b8bfcf50
No related branches found
No related tags found
No related merge requests found
......@@ -379,7 +379,8 @@ class Population(object):
"""
# C_logging_code gets priority of C_autogen_code
if self.grid_options['verbose'] > 0: print("Creating and loading custom logging functionality")
if self.grid_options["verbose"] > 0:
print("Creating and loading custom logging functionality")
#
if self.grid_options["C_auto_logging"]:
......@@ -458,7 +459,8 @@ class Population(object):
self.set_custom_logging()
### Load store
if self.grid_options['verbose'] > 0: print('loading binary_c store information')
if self.grid_options["verbose"] > 0:
print("loading binary_c store information")
self.grid_options["store_memaddr"] = binary_c_python_api.return_store("")
# Execute.
......@@ -638,7 +640,8 @@ class Population(object):
Function to test the evolution of a system. Calls the api binding directly.
"""
if self.grid_options['verbose'] > 0: print('running a single system as a test')
if self.grid_options["verbose"] > 0:
print("running a single system as a test")
m1 = 15.0 # Msun
m2 = 14.0 # Msun
......@@ -680,7 +683,8 @@ class Population(object):
# TODO: add centering center left right for the spacing
"""
if self.grid_options['verbose'] > 0: print("Generating grid code")
if self.grid_options["verbose"] > 0:
print("Generating grid code")
# Some local values
code_string = ""
......@@ -950,7 +954,8 @@ class Population(object):
# Stop of code generation. Here the code is saved and written
# Save the gridcode to the grid_options
if self.grid_options['verbose'] > 0: print("Saving grid code to grid_options")
if self.grid_options["verbose"] > 0:
print("Saving grid code to grid_options")
self.grid_options["code_string"] = code_string
......@@ -961,7 +966,8 @@ class Population(object):
)
self.grid_options["gridcode_filename"] = gridcode_filename
if self.grid_options['verbose'] > 0: print("Writing grid code to {}".format(gridcode_filename))
if self.grid_options["verbose"] > 0:
print("Writing grid code to {}".format(gridcode_filename))
with open(gridcode_filename, "w") as f:
f.write(code_string)
......@@ -974,7 +980,12 @@ class Population(object):
# Code to load the
import importlib.util
if self.grid_options['verbose'] > 0: print("Loading grid code function from {}".format(self.grid_options['gridcode_filename']))
if self.grid_options["verbose"] > 0:
print(
"Loading grid code function from {}".format(
self.grid_options["gridcode_filename"]
)
)
spec = importlib.util.spec_from_file_location(
"binary_c_python_grid",
......@@ -984,9 +995,8 @@ class Population(object):
spec.loader.exec_module(grid_file)
generator = grid_file.grid_code(self)
if self.grid_options['verbose'] > 0: print("Grid code loaded")
if self.grid_options["verbose"] > 0:
print("Grid code loaded")
print(next(generator))
print(next(generator))
......
......@@ -85,7 +85,6 @@ example_pop.export_all_info()
# TODO: add example of running a population
# Wrapping up the results to an hdf5 file can be done by using the create_hdf5(<directory containing data and settings>)
# This function takes the settings file (ending in _settings.json) and the data files (ending in .dat) from the data_dir
# This function takes the settings file (ending in _settings.json) and the data files (ending in .dat) from the data_dir
# and packing them into an hdf5 file, which is then written into the same data_dir directory
create_hdf5(test_pop.custom_options['data_dir'])
create_hdf5(test_pop.custom_options["data_dir"])
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