Exemplo n.º 1
0
 def test_inverse_of_direct_return_original(self):
     sz = 4
     spatial_step = 1.0
     ampl = 1.0
     xy = DomainXY.from_shape((sz, sz), spatial_step)
     constant_map = ampl * np.ones(xy.shape)
     original = ScalarBidimensionalFunction(constant_map, domain=xy)
     spectr = bfft.direct(original)
     inverse_spectr = bfft.inverse(spectr)
     self.assertTrue(np.allclose(inverse_spectr.values, original.values))
Exemplo n.º 2
0
 def testInverseDeltaMapEvenSize(self):
     sz = 100
     sz2 = int(sz / 2)
     deltaMap = np.zeros((sz, sz))
     deltaMap[sz2, sz2] = 1.0
     xyDomain = DomainXY.from_shape((sz, sz), 1)
     xyFunct = ScalarBidimensionalFunction(deltaMap, domain=xyDomain)
     fftFunct = bfft.inverse(xyFunct)
     spectralMap = fftFunct.values
     self.assertEqual((sz, sz), spectralMap.shape)
     self.assertEqual(0, spectralMap.ptp())
     self._checkParseval(deltaMap, spectralMap)
Exemplo n.º 3
0
 def test_inverse_units(self):
     from astropy import units as u
     szx, szy = (20, 10)
     stepx, stepy = (0.1 * u.m, 0.4 * u.kg)
     ampl = 1.0 * u.V
     xy = DomainXY.from_shape((szy, szx), (stepy, stepx))
     map_in_V = ampl * np.ones(xy.shape)
     spatial_funct = ScalarBidimensionalFunction(map_in_V, domain=xy)
     spectr = bfft.inverse(spatial_funct)
     self.assertTrue(spectr.xmap.unit.is_equivalent((1 / u.m).unit))
     self.assertTrue(spectr.ymap.unit.is_equivalent((1 / u.kg).unit))
     self.assertTrue(spectr.xcoord.unit.is_equivalent((1 / u.m).unit))
     self.assertTrue(spectr.ycoord.unit.is_equivalent((1 / u.kg).unit))
     self.assertTrue(spectr.values.unit.is_equivalent((u.V)))
 def _createPsf(self):
     psf = bfft.inverse(self.otf())
     rescaleCoordFact = 1 / self._focalLength
     self._psf = S2DF(psf.values(),
                      psf.xCoord() * rescaleCoordFact,
                      psf.yCoord() * rescaleCoordFact)
 def _autoCorrelate(self, scalar2dfunct):
     functFT = bfft.direct(scalar2dfunct)
     aa = S2DF(np.abs(functFT.values() ** 2),
               functFT.xCoord(),
               functFT.yCoord())
     return bfft.inverse(aa)