self._load(config=config[s.name], group=cwg)
else:
v = group[s.name][...]
- if isinstance(s, _config.BooleanSetting):
- if isinstance(v, _numpy.ndarray):
+ if isinstance(v, _numpy.ndarray):
+ if isinstance(s, _config.BooleanSetting):
v = bool(v) # array(True, dtype=bool) -> True
- elif (isinstance(v, _numpy.ndarray) and
- v.dtype.type == _numpy.string_):
- v = str(v) # array('abc', dtype='|S3') -> 'abc'
- elif isinstance(s, _config.FloatListSetting):
- v = list(v) # convert from numpy array
+ elif v.dtype.type == _numpy.string_:
+ v = str(v) # array('abc', dtype='|S3') -> 'abc'
+ elif isinstance(s, _config.IntegerSetting):
+ v = int(v) # array(3, dtpe='int32') -> 3
+ elif isinstance(s, _config.FloatSetting):
+ v = float(v) # array(1.2, dtype='float64') -> 1.2
+ elif isinstance(s, _config.NumericSetting):
+ raise NotImplementedError(type(s))
+ elif isinstance(s, _config.FloatListSetting):
+ v = list(v) # convert from numpy array
if isinstance(v, _types.StringTypes):
# convert back from None, etc.
v = s.convert_from_text(v)