def apply_interpolation(self, interp, data):
<EOL>if not sps.issparse(interp): interp = np.asarray(interp)<EOL>(m,n) = interp.shape<EOL>if pimms.is_str(data):<EOL><INDENT>return self.apply_interpolation(<EOL>interp,<EOL>self.properties if data.lower() == '<STR_LIT:all>' else self.properties[data])<EOL><DEDENT>elif pimms.is_lazy_map(data):<EOL><INDENT>return pimms.lazy_map({curry(lambda k:self.apply_interpolation(interp, data[k]), k)<EOL>for k in six.iterkeys(data)})<EOL><DEDENT>elif pimms.is_map(data):<EOL><INDENT>return pyr.pmap({k:self.apply_interpolation(interp, data[k])<EOL>for k in six.iterkeys(data)})<EOL><DEDENT>elif pimms.is_matrix(data):<EOL><INDENT>data = np.asarray(data)<EOL>(data, tr) = (data.T, True) if data.shape[<NUM_LIT:0>] != n else (data, False)<EOL>if not pimms.is_matrix(data, '<STR_LIT>'):<EOL><INDENT>data = np.asarray([self.apply_interpolation(interp, d) for d in data])<EOL><DEDENT>else: data = inner(interp, data)<EOL>return data.T if tr else data<EOL><DEDENT>elif not pimms.is_vector(data):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>elif len(data) != n:<EOL><INDENT>return tuple([self.apply_interpolation(interp, d) for d in data])<EOL><DEDENT>elif pimms.is_vector(data, '<STR_LIT>'):<EOL><INDENT>return inner(interp, data)<EOL><DEDENT>else:<EOL><INDENT>maxs = flattest(interp.argmax(axis=<NUM_LIT:1>))<EOL>bads = (~np.isfinite(interp.sum(axis=<NUM_LIT:1>))) | np.isclose(<NUM_LIT:0>, interp[(np.arange(m),maxs)])<EOL>bads = np.where(bads)[<NUM_LIT:0>]<EOL>if len(bads) == <NUM_LIT:0>: res = data[maxs]<EOL>else:<EOL><INDENT>res = np.array(data[maxs], dtype=np.object)<EOL>res[bads] = np.nan<EOL><DEDENT>return res<EOL><DEDENT>
mesh.apply_interpolation(interp, data) yields the result of applying the given interpolation
  matrix (should be a scipy.sparse.csr_matrix), which can be obtained via
  mesh.nearest_interpolation or mesh.linear_interpolation, and applies it to the given data,
  which should be matched to the coordinates used to create the interpolation matrix.

The data argument may be a list/vector of size m (where m is the number of columns in the
matrix interp), a matrix of size (m x n) for any n, or a map whose values are lists of
length m.

Note that apply_interpolation() does not scale the interpolation matrix, so you must do that
prior to passing it as an argument. It is generally recommended to use the interpolate()
function or to use this function with the interpolation_matrix() function.