def testMinima(self): """ Test the correct computation of all local minima for a bistable potential. """ #Predict result x0, curv, mask = fixedPoints( numpy.array([self.LAMBDA]), kappa1=self.kappa1 ) expectedResult = DC.FieldContainer( numpy.extract(curv[0]>0,x0[0]), unit = self.xField.unit, longname = 'position of the local minima of electric potential', shortname = 'x_0' ) #Retrieve result from worker w = MRA.MRA(None) w.paramScale.value = "1.0m" result = w.mra(self.V) #Testing i = numpy.array(range(self.n)) index = numpy.logical_and(self.u > 0.7, self.u < 0.72) index = MRA.findMinima(self.V.data, 5) numpy.testing.assert_array_almost_equal( result[r'x_{min}'].data, expectedResult.data, 4 )
def testPlateau(self): """Test the correct computation of a local minimum.""" self.assertEqual(numpy.array([3]), MRA.findMinima(self.p, 5)[0])
def testFindMinimum(self): """Test the correct computation of a local minimum.""" self.assertEqual(numpy.argmin(self.a), MRA.findMinima(self.a, 5)[0])