...
On Brainlife, when we enter a list, we have to use the type STRING
and so the elements of the list are is considered as strings
a string
, so they need to be converted.
Indeed, a list of floats
or integers
are written as follows in the config.json
:
Code Block |
---|
{
param_picks_by_channel_types_or_names = "[0, 2, 1]"
} |
So, we first need to convert it into a list and then convert the elements of the list into the right type.
For a list of strings:
Code Block |
---|
if isinstance(picks, str) and picks.find("[") != -1 and picks is not None:
picks = picks.replace('[', '')
picks = picks.replace(']', '')
picks = picks.replace("'", '')
config['param_picks_by_channel_types_or_names'] = list(map(str, picks.split(', '))) |
If you want to convert it into a list of floats
or ints
, just replace str
in list(map(str, picks.split(', ')))
by the type you want.
Cases when a parameter can be two types
...