Ejemplo n.º 1
0
 def test_validQ(self):
     xs = numpy.tile(numpy.array([-1, 0, 2, 4, 5]), 3)
     nPoints = 4
     ys = numpy.tile(numpy.zeros(nPoints), 3)
     ys[nPoints] = numpy.nan
     ys[2 * nPoints - 1] = numpy.nan
     vertAxis = numpy.array([-3, -1, 2, 4])
     ws = CreateWorkspace(DataX=xs, DataY=ys, NSpec=3, VerticalAxisUnit='Degrees', VerticalAxisValues=vertAxis, StoreInADS=False)
     qMin, qMax = directtools.validQ(ws, -2.5)
     self.assertEqual(qMin, xs[0])
     self.assertEqual(qMax, xs[-1])
     qMin, qMax = directtools.validQ(ws, 0)
     self.assertEqual(qMin, xs[1])
     self.assertEqual(qMax, xs[-2])
Ejemplo n.º 2
0
 def test_validQ(self):
     xs = numpy.tile(numpy.array([-1, 0, 2, 4, 5]), 3)
     nPoints = 4
     ys = numpy.tile(numpy.zeros(nPoints), 3)
     ys[nPoints] = numpy.nan
     ys[2 * nPoints - 1] = numpy.nan
     vertAxis = numpy.array([-3, -1, 2, 4])
     ws = CreateWorkspace(DataX=xs, DataY=ys, NSpec=3, UnitX='MomentumTransfer',
                          VerticalAxisUnit='Degrees', VerticalAxisValues=vertAxis, StoreInADS=False)
     qMin, qMax = directtools.validQ(ws, -2.5)
     self.assertEqual(qMin, xs[0])
     self.assertEqual(qMax, xs[-1])
     qMin, qMax = directtools.validQ(ws, 0)
     self.assertEqual(qMin, xs[1])
     self.assertEqual(qMax, xs[-2])