code: def qtable_pmf(x, q, qlow, xs, ps):
      qx = np.round(old_div(np.atleast_1d(x).astype(np.float), q)) * q
      is_multiple = np.isclose(qx, x)
      ix = np.round(old_div((qx - qlow), q)).astype(np.int)
      is_inbounds = np.logical_and(ix >= 0, ix < len(ps))
      oks = np.logical_and(is_multiple, is_inbounds)
      rval = np.zeros_like(qx)
      rval[oks] = np.asarray(ps)[ix[oks]]
      if isinstance(x, np.ndarray):
          return rval.reshape(x.shape)
      else:
          return float(rval)
  
imports: from __future__ import division
  from builtins import map
  from builtins import object
  from past.utils import old_div
  import numpy
  import numpy.random
  import scipy.stats
  from scipy.stats import rv_continuous
  from scipy.stats._continuous_distns import lognorm_gen
label_desc: Use image node_id 1 for calling a global function with example usage: qtable_pmf(x, q, qlow, xs, ps) and returns: rval, float