示例#1
0
 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
         )
示例#2
0
文件: TestMRA.py 项目: gclos/pyphant1
 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
         )
示例#3
0
 def testPlateau(self):
     """Test the correct computation of a local minimum."""
     self.assertEqual(numpy.array([3]), MRA.findMinima(self.p, 5)[0])
示例#4
0
 def testFindMinimum(self):
     """Test the correct computation of a local minimum."""
     self.assertEqual(numpy.argmin(self.a), MRA.findMinima(self.a, 5)[0])
示例#5
0
 def testPlateau(self):
     """Test the correct computation of a local minimum."""
     self.assertEqual(numpy.array([3]), MRA.findMinima(self.p, 5)[0])
示例#6
0
 def testFindMinimum(self):
     """Test the correct computation of a local minimum."""
     self.assertEqual(numpy.argmin(self.a), MRA.findMinima(self.a, 5)[0])