Skip to content
Snippets Groups Projects
Commit 06116de0 authored by dh00601's avatar dh00601
Browse files

fixed issue

parent b295dda7
Branches feature/set_on_creation
No related tags found
No related merge requests found
......@@ -101,7 +101,7 @@ class Population:
population of systems
"""
def __init__(self):
def __init__(self, **kwargs):
"""
Initialisation function of the population class
"""
......@@ -126,13 +126,13 @@ class Population:
# Custom options
self.custom_options = {}
# shared memory used for logging
self.shared_memory = {}
# Set the options that are passed at creation of the object
self.set(**kwargs)
# Load M&s options
self.grid_options['m&s_options'] = copy.deepcopy(moe_di_stefano_default_options)
# Write M&S options to a file
# Write M&S options to a file. NOTE: not sure why i put this here anymore
os.makedirs(os.path.join(self.grid_options["tmp_dir"], "moe_distefano"), exist_ok=True)
with open(os.path.join(os.path.join(self.grid_options["tmp_dir"], "moe_distefano"), "moeopts.dat"), "w") as f:
f.write(json.dumps(self.grid_options['m&s_options'], indent=4))
......@@ -140,13 +140,16 @@ class Population:
# Argline dict
self.argline_dict = {}
# Set main process id
self.grid_options["_main_pid"] = os.getpid()
# Set some memory dicts
self.persistent_data_memory_dict = {}
#
# shared memory used for logging
self.shared_memory = {}
# Set global (OS) process id
self.grid_options["_main_pid"] = os.getpid()
# local process ID
self.process_ID = 0
# Create location to store results. Users should write to this dictionary.
......@@ -168,7 +171,7 @@ class Population:
# - For a population the bse_options will get copied to a temp_bse_options dict and updated with
# all the parameters generated by the grid
# I will NOT create the argument line by fully writing ALL the defaults and overriding user
# I will not create the argument line by fully writing all the defaults and overriding user
# input, that seems not necessary because by using the get_defaults() function we already
# know for sure which parameter names are valid for the binary_c version
# And because binary_c uses internal defaults, its not necessary to explicitly pass them.
......@@ -192,8 +195,6 @@ class Population:
via kwargs all the arguments are either set to binary_c parameters, grid_options or custom_options (see above)
"""
# Select the params that end with %d
# Go over all the input
for key in kwargs:
# Filter out keys for the bse_options
......@@ -240,7 +241,7 @@ class Population:
key, kwargs[key]
),
self.grid_options["verbosity"],
1,
0, # NOTE: setting this to be 0 prevents mistakes being overlooked.
)
self.custom_options[key] = kwargs[key]
......
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