def _tofloat(value):
 if isiterable(value):
  try:
   value = np.array(value, dtype=np.float)
  except (TypeError, ValueError):
   raise InputParameterError(u'Parameter of {0} could not be converted to float'.format(type(value)))
 elif isinstance(value, np.ndarray):
  value = float(value.item())
 elif isinstance(value, (numbers.Number, np.number)):
  value = float(value)
 elif isinstance(value, bool):
  raise InputParameterError(u'Expected parameter to be of numerical type, not boolean')
 else:
  raise InputParameterError(u"Don't know how to convert parameter of {0} to float".format(type(value)))
 return value

def _tofloat ( value ) : if isiterable ( value ) : try : value = np . array ( value , dtype = np . float ) except ( TypeError , ValueError ) : raise InputParameterError ( u'Parameter of {0} could not be converted to float' . format ( type ( value ) ) ) elif isinstance ( value , np . ndarray ) : value = float ( value . item ( ) ) elif isinstance ( value , ( numbers . Number , np . number ) ) : value = float ( value ) elif isinstance ( value , bool ) : raise InputParameterError ( u'Expected parameter to be of numerical type, not boolean' ) else : raise InputParameterError ( u"Don't know how to convert parameter of {0} to float" . format ( type ( value ) ) ) return value
convert a parameter to float or float array .