code: def data_to_params(data,
          expparams_dtype,
          col_outcomes=(0, 'counts'),
          cols_expparams=None
      ):
      
      BY_IDX, BY_NAME = range(2)
  
      is_exp_scalar = np.issctype(expparams_dtype)
      is_data_scalar = np.issctype(data.dtype) and not data.dtype.fields
  
      s_ = (
          (lambda idx: np.s_[..., idx[BY_IDX]])
          if is_data_scalar else
          (lambda idx: np.s_[idx[BY_NAME]])
      )
  
      outcomes = data[s_(col_outcomes)].astype(int)
  
      # mk new slicer t
  
      expparams = np.empty(outcomes.shape, dtype=expparams_dtype)
      if is_exp_scalar:
          expparams[:] = data[s_(cols_expparams)]
      else:
          for expparams_key, column in cols_expparams.items():
              expparams[expparams_key] = data[s_(column)]
  
      return outcomes, expparams
docs: Given data as a NumPy array, separates out each column either as
      the outcomes, or as a field of an expparams array. Columns may be specified
      either as indices into a two-axis scalar array, or as field names for a one-axis
      record array.
  
      Since scalar arrays are homogenous in type, this may result in loss of precision
      due to casting between data types.