Example #1
0
    def testFrequenciesXMapOdd(self):
        sizeInPoints = 11
        pixelSize = 0.12
        frequenciesMap = bfft.frequencies_x_map(sizeInPoints, pixelSize)

        sz2 = int(sizeInPoints / 2)
        mostPosFrequency = bfft.most_positive_frequency(
            sizeInPoints, pixelSize)
        mostNegFrequency = bfft.most_negative_frequency(
            sizeInPoints, pixelSize)
        self.assertEqual((sizeInPoints, sizeInPoints), frequenciesMap.shape)
        self.assertTrue(np.all(0 == frequenciesMap[:, sz2]))
        self.assertTrue(np.all(mostNegFrequency == frequenciesMap[:, 0]))
        self.assertTrue(np.all(mostPosFrequency == frequenciesMap[:, -1]))
Example #2
0
    def testFrequenciesYMap(self):
        sizeInPoints = 1022
        pixelSize = 0.001
        frequenciesMap = bfft.frequencies_y_map(sizeInPoints, pixelSize)

        sz2 = int(sizeInPoints / 2)
        mostPosFrequency = bfft.most_positive_frequency(
            sizeInPoints, pixelSize)
        mostNegFrequency = bfft.most_negative_frequency(
            sizeInPoints, pixelSize)
        self.assertEqual((sizeInPoints, sizeInPoints), frequenciesMap.shape)
        self.assertTrue(np.all(0 == frequenciesMap[sz2, :]))
        self.assertTrue(np.all(mostNegFrequency == frequenciesMap[0, :]))
        self.assertTrue(np.all(mostPosFrequency == frequenciesMap[-1, :]))
Example #3
0
 def _checkFrequenciesNormMap(self, frequenciesMap, sizeInPoints,
                              pixelSize):
     sz2 = int(sizeInPoints / 2)
     mostPosFrequency = bfft.most_positive_frequency(
         sizeInPoints, pixelSize)
     mostNegFrequency = bfft.most_negative_frequency(
         sizeInPoints, pixelSize)
     self.assertEqual((sizeInPoints, sizeInPoints), frequenciesMap.shape)
     self.assertEqual(0, frequenciesMap[sz2, sz2])
     self.assertAlmostEqual(-mostNegFrequency * np.sqrt(2),
                            frequenciesMap[0, 0])
     self.assertAlmostEqual(-mostNegFrequency, frequenciesMap[0, sz2])
     self.assertAlmostEqual(-mostNegFrequency, frequenciesMap[sz2, 0])
     self.assertAlmostEqual(mostPosFrequency, frequenciesMap[sz2, -1])
     self.assertAlmostEqual(mostPosFrequency, frequenciesMap[-1, sz2])
     wantedDelta = 1. / (sizeInPoints * pixelSize)
     self.assertEqual(wantedDelta, frequenciesMap[sz2, sz2 + 1])