Skip to content
Snippets Groups Projects
Commit bba438be authored by Robert Izzard's avatar Robert Izzard
Browse files

updates to improve type setting in parsing of cmdline args

parent 72e64d3e
No related branches found
No related tags found
No related merge requests found
......@@ -374,7 +374,7 @@ class Population(
# get the cmd-line args in the form x=y
cmdline_args = sys.argv[1:]
if cmdline_args:
self.verbose_print(
"Found cmdline args. Parsing them now",
......@@ -385,7 +385,7 @@ class Population(
# Grab the input and split them up, while accepting only non-empty entries
# cmdline_args = args
self.grid_options["_commandline_input"] = cmdline_args
# Make dict and fill it
cmdline_dict = {}
for cmdline_arg in cmdline_args:
......@@ -401,14 +401,19 @@ class Population(
old_value = self.grid_options[parameter]
old_value_found = True
elif parameter in self.defaults:
old_value = self.defaults[parameter]
old_value_found = True
elif parameter in self.custom_options:
old_value = self.custom_options[parameter]
old_value_found = True
elif parameter in self.bse_options:
old_value = self.bse_options[parameter]
old_value_found = True
elif parameter in self.defaults:
# this will revert to a string type, always
old_value = self.defaults[parameter]
old_value_found = True
# (attempt to) convert type
if old_value_found:
if old_value is not None:
......@@ -1986,6 +1991,7 @@ class Population(
self.grid_options["verbosity"],
0,
)
print("BSE",self.bse_options)
raise ValueError
if not any(
......
......@@ -20,7 +20,7 @@ import numpy as np
import cachetools
import diskcache
# from binarycpython.utils.grid import Population
import py_rinterpolate
......@@ -345,13 +345,14 @@ class spacing_functions:
return func(*args, **kwargs)
return wrapped
if cache:
if cache is not None:
__decorator = cache.memoize
else:
__decorator = __dummy_decorator
@__decorator
#@cache.memoize()
@__decorator() # note: () works with python3.9+, maybe not for 3.8
def _const_dt(
cachedir=None,
num_cores=None,
......@@ -392,6 +393,7 @@ class spacing_functions:
if max_evolution_time:
bse_options["max_evolution_time"] = max_evolution_time
from binarycpython.utils.grid import Population
lifetime_population = Population()
lifetime_population.bse_options = bse_options
......
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