From fbfba54f843a1670e9093407f2ee1fe5737986f4 Mon Sep 17 00:00:00 2001 From: David Hendriks <davidhendriks93@gmail.com> Date: Tue, 28 Jan 2020 00:30:39 +0000 Subject: [PATCH] re-formatted --- binarycpython/utils/grid.py | 30 ++++++++++++++++++++---------- examples/example_population.py | 5 ++--- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/binarycpython/utils/grid.py b/binarycpython/utils/grid.py index 90d5edda6..88a5085db 100644 --- a/binarycpython/utils/grid.py +++ b/binarycpython/utils/grid.py @@ -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)) diff --git a/examples/example_population.py b/examples/example_population.py index ef57243f6..766e3ace4 100644 --- a/examples/example_population.py +++ b/examples/example_population.py @@ -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"]) -- GitLab