Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(8)  |  Call(6)  |  Derive(0)  |  Import(2)

src/p/y/pypreprocess-HEAD/pypreprocess/coreg.py   pypreprocess(Download)
                            centered_smoothing_kernel
                            )
from .histograms import (trilinear_interp,
                         joint_histogram,
                         _correct_voxel_samp,
            # interpolate target on sampled grid
            sampled_target = trilinear_interp(
                target.get_data().ravel(order='F'),
                target.shape, *grid)
 

src/p/y/pypreprocess-HEAD/pypreprocess/tests/test_histograms.py   pypreprocess(Download)
import nose
import nose.tools
from ..histograms import(_correct_voxel_samp,
                         make_sampled_grid,
                         trilinear_interp,
def test_trilinear_interp():
    shape = (23, 29, 31)
    f = np.arange(np.prod(shape))
 
    nose.tools.assert_equal(trilinear_interp(f, shape, 1, 1, 1), 0.)
    nose.tools.assert_equal(trilinear_interp(f, shape, 2, 1, 1), 1.)
    nose.tools.assert_equal(trilinear_interp(f, shape, 1 + shape[0], 1, 1),
                            shape[0])
    nose.tools.assert_true(0. < trilinear_interp(f, shape, 1.5, 1., 1.) < 1.)