code: def assert_npfloatarray(obj, varname, desc, exc, tc, errsrc):
      import numpy as np
      if varname is None:
          var = obj
      else:
          try:
              var = getattr(obj, varname)
          except AttributeError:
              raise exc(tc, "Attribute '{0}' not defined in '{1}'"
                      .format(varname, obj), errsrc)
      try:
          dt = var.dtype
      except AttributeError:
          raise exc(tc, "'{0}' is not an np.array (lacks a 'dtype' member)"
                      .format(desc), errsrc)
      else:
          if not var.shape:
              raise exc(tc, "'{0}' is not an np.array ('len(shape)' < 1)"
                      .format(desc), errsrc)
      if not np.issubdtype(dt, np.float):
          raise exc(tc, "'{0}' is not an np.array of np.float".format(desc),
                  errsrc)