Ejemplo n.º 1
0
 def test_dd_parallel_random(self):
     arr = random_periodic_upsample(self.nx, 16, seed=3)
     nsamples = 300
     # idxs = [(0,0), (100,100), (70, 0), (256, 128)]
     idxs = zip(np.random.randint(0, self.nx, nsamples), np.random.randint(0, self.ny, nsamples))
     den_diff = dens_diff_parallel(den=arr, idxs=idxs, outer_len=self.nx, nr=self.nx/4)
     import pylab as pl
     pl.ion()
     pl.figure()
     pl.imshow(arr, interpolation='nearest', cmap='hot')
     pl.figure()
     pl.plot(den_diff[:,0], den_diff[:,1], 'ro-')
     pl.errorbar(den_diff[:,0], den_diff[:,1], yerr=den_diff[:,2])
     print
     print den_diff
     raw_input('enter to continue')
Ejemplo n.º 2
0
 def test_dd_parallel_const(self):
     den = self.zz
     den.fill(0.1)
     den_diff = dens_diff_parallel(den=den, idxs=[(0,0)], outer_len=1.0, nr=self.nx/4)
     ok_(np.allclose(den_diff[:,1], 0.0))
Ejemplo n.º 3
0
 def test_dd_parallel_delta(self):
     den = self.zz
     den[self.nx/2, self.ny/2] = 1.0
     den_diff = dens_diff_parallel(den=den, idxs=[(4,4)], outer_len=1.0, nr=self.nx/4)
     ok_(not np.allclose(den_diff[:,1], 0.0))
Ejemplo n.º 4
0
 def test_dd_parallel_zeros(self):
     den_diff = dens_diff_parallel(den=self.zz, idxs=[(0,0)], outer_len=1.0, nr=self.nx/4)
     ok_(np.allclose(den_diff[:,1], 0.0))