Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
if isinstance(config['param_baseline'], str):
    param_baseline = list(map(str, config['param_baseline'].split(', ')))
    param_baseline = [None if i=='None' else i for i in param_baseline]
    param_baseline = [float(i) if isinstance(i, str) else i for i in param_baseline]
    config['param_baseline'] = tuple(param_baseline)

The first step is to convert it into a list and then convert the elements of the list into the right type. For tuple parameters in which their elements are the same type, there is no need to compute the two list comprehensions:

Code Block
if isinstance(config['param_tuple_floats'], str):
    config['param_tuple_floats'] = list(map(str, config['param_tuple_floats'].split(', ')))
    config['param_tuple_floats'] = tuple(config['param_tuple_floats'])
Info

This parameter is entered the same way as a numpy.nd.array and a slice. So far it is not an issue because no parameter is either a numpy.nd.array, a slice or a tuple.

...