コード例 #1
0
    def test_Q(self):
        ConvertWANDSCDtoQTest_out=ConvertWANDSCDtoQ('ConvertWANDSCDtoQTest_data',BinningDim0='-8.08,8.08,101',
                                                    BinningDim1='-0.88,0.88,11',BinningDim2='-8.08,8.08,101',NormaliseBy='None')

        self.assertTrue(ConvertWANDSCDtoQTest_out)

        s = ConvertWANDSCDtoQTest_out.getSignalArray()
        self.assertAlmostEqual(np.nanmax(s), 8.97233331213612)
        self.assertAlmostEqual(np.nanargmax(s), 22780)

        self.assertEqual(ConvertWANDSCDtoQTest_out.getNumDims(), 3)
        self.assertEqual(ConvertWANDSCDtoQTest_out.getNPoints(), 112211)

        d0 = ConvertWANDSCDtoQTest_out.getDimension(0)
        self.assertEqual(d0.name, 'Q_sample_x')
        self.assertEqual(d0.getNBins(), 101)
        self.assertAlmostEquals(d0.getMinimum(), -8.08, 5)
        self.assertAlmostEquals(d0.getMaximum(), 8.08, 5)

        d1 = ConvertWANDSCDtoQTest_out.getDimension(1)
        self.assertEqual(d1.name, 'Q_sample_y')
        self.assertEqual(d1.getNBins(), 11)
        self.assertAlmostEquals(d1.getMinimum(), -0.88, 5)
        self.assertAlmostEquals(d1.getMaximum(), 0.88, 5)

        d2 = ConvertWANDSCDtoQTest_out.getDimension(2)
        self.assertEqual(d2.name, 'Q_sample_z')
        self.assertEqual(d2.getNBins(), 101)
        self.assertAlmostEquals(d2.getMinimum(), -8.08, 5)
        self.assertAlmostEquals(d2.getMaximum(), 8.08, 5)

        self.assertEqual(ConvertWANDSCDtoQTest_out.getNumExperimentInfo(), 1)

        ConvertWANDSCDtoQTest_out.delete()
コード例 #2
0
    def test_Q(self):
        ConvertWANDSCDtoQTest_out=ConvertWANDSCDtoQ('ConvertWANDSCDtoQTest_data',BinningDim0='-8.08,8.08,101',
                                                    BinningDim1='-0.88,0.88,11',BinningDim2='-8.08,8.08,101',NormaliseBy='None')

        self.assertTrue(ConvertWANDSCDtoQTest_out)

        s = ConvertWANDSCDtoQTest_out.getSignalArray()
        self.assertAlmostEqual(np.nanmax(s), 8.97233331213612)
        self.assertAlmostEqual(np.nanargmax(s), 22780)

        self.assertEquals(ConvertWANDSCDtoQTest_out.getNumDims(), 3)
        self.assertEquals(ConvertWANDSCDtoQTest_out.getNPoints(), 112211)

        d0 = ConvertWANDSCDtoQTest_out.getDimension(0)
        self.assertEquals(d0.name, 'Q_sample_x')
        self.assertEquals(d0.getNBins(), 101)
        self.assertAlmostEquals(d0.getMinimum(), -8.08, 5)
        self.assertAlmostEquals(d0.getMaximum(), 8.08, 5)

        d1 = ConvertWANDSCDtoQTest_out.getDimension(1)
        self.assertEquals(d1.name, 'Q_sample_y')
        self.assertEquals(d1.getNBins(), 11)
        self.assertAlmostEquals(d1.getMinimum(), -0.88, 5)
        self.assertAlmostEquals(d1.getMaximum(), 0.88, 5)

        d2 = ConvertWANDSCDtoQTest_out.getDimension(2)
        self.assertEquals(d2.name, 'Q_sample_z')
        self.assertEquals(d2.getNBins(), 101)
        self.assertAlmostEquals(d2.getMinimum(), -8.08, 5)
        self.assertAlmostEquals(d2.getMaximum(), 8.08, 5)

        self.assertEqual(ConvertWANDSCDtoQTest_out.getNumExperimentInfo(), 1)

        ConvertWANDSCDtoQTest_out.delete()
コード例 #3
0
    def test_Q_norm(self):
        ConvertWANDSCDtoQTest_out = ConvertWANDSCDtoQ('ConvertWANDSCDtoQTest_data',NormalisationWorkspace='ConvertWANDSCDtoQTest_norm',
                                                      BinningDim0='-8.08,8.08,101',BinningDim1='-0.88,0.88,11',BinningDim2='-8.08,8.08,101')

        s = ConvertWANDSCDtoQTest_out.getSignalArray()
        self.assertAlmostEqual(np.nanmax(s), 7.476944426780101)
        self.assertAlmostEqual(np.nanargmax(s), 22780)

        ConvertWANDSCDtoQTest_out.delete()
コード例 #4
0
    def test_Q_norm(self):
        ConvertWANDSCDtoQTest_out = ConvertWANDSCDtoQ('ConvertWANDSCDtoQTest_data',NormalisationWorkspace='ConvertWANDSCDtoQTest_norm',
                                                      BinningDim0='-8.08,8.08,101',BinningDim1='-0.88,0.88,11',BinningDim2='-8.08,8.08,101')

        s = ConvertWANDSCDtoQTest_out.getSignalArray()
        self.assertAlmostEqual(np.nanmax(s), 7.476944426780101)
        self.assertAlmostEqual(np.nanargmax(s), 22780)

        ConvertWANDSCDtoQTest_out.delete()
コード例 #5
0
    def test_HKL_norm_and_KeepTemporary(self):
        ConvertWANDSCDtoQTest_out = ConvertWANDSCDtoQ(
            'ConvertWANDSCDtoQTest_data',
            NormalisationWorkspace='ConvertWANDSCDtoQTest_norm',
            Frame='HKL',
            KeepTemporaryWorkspaces=True,
            BinningDim0='-8.08,8.08,101',
            BinningDim1='-8.08,8.08,101',
            BinningDim2='-8.08,8.08,101',
            Uproj='1,1,0',
            Vproj='1,-1,0',
            Wproj='0,0,1')

        self.assertTrue(ConvertWANDSCDtoQTest_out)
        self.assertTrue(mtd.doesExist('ConvertWANDSCDtoQTest_out'))
        self.assertTrue(mtd.doesExist('ConvertWANDSCDtoQTest_out_data'))
        self.assertTrue(
            mtd.doesExist('ConvertWANDSCDtoQTest_out_normalization'))

        s = ConvertWANDSCDtoQTest_out.getSignalArray()
        self.assertAlmostEqual(np.nanmax(s), 4.646855396509936)
        self.assertAlmostEqual(np.nanargmax(s), 443011)

        self.assertEqual(ConvertWANDSCDtoQTest_out.getNumDims(), 3)
        self.assertEqual(ConvertWANDSCDtoQTest_out.getNPoints(), 101**3)

        d0 = ConvertWANDSCDtoQTest_out.getDimension(0)
        self.assertEqual(d0.name, '[H,H,0]')
        self.assertEqual(d0.getNBins(), 101)
        self.assertAlmostEquals(d0.getMinimum(), -8.08, 5)
        self.assertAlmostEquals(d0.getMaximum(), 8.08, 5)

        d1 = ConvertWANDSCDtoQTest_out.getDimension(1)
        self.assertEqual(d1.name, '[H,-H,0]')
        self.assertEqual(d1.getNBins(), 101)
        self.assertAlmostEquals(d1.getMinimum(), -8.08, 5)
        self.assertAlmostEquals(d1.getMaximum(), 8.08, 5)

        d2 = ConvertWANDSCDtoQTest_out.getDimension(2)
        self.assertEqual(d2.name, '[0,0,L]')
        self.assertEqual(d2.getNBins(), 101)
        self.assertAlmostEquals(d2.getMinimum(), -8.08, 5)
        self.assertAlmostEquals(d2.getMaximum(), 8.08, 5)

        self.assertEqual(ConvertWANDSCDtoQTest_out.getNumExperimentInfo(), 1)

        ConvertWANDSCDtoQTest_out.delete()
コード例 #6
0
    def test_HKL_norm_and_KeepTemporary(self):
        ConvertWANDSCDtoQTest_out = ConvertWANDSCDtoQ('ConvertWANDSCDtoQTest_data',NormalisationWorkspace='ConvertWANDSCDtoQTest_norm',
                                                      Frame='HKL',KeepTemporaryWorkspaces=True,BinningDim0='-8.08,8.08,101',
                                                      BinningDim1='-8.08,8.08,101',BinningDim2='-8.08,8.08,101',
                                                      Uproj='1,1,0',Vproj='1,-1,0',Wproj='0,0,1')

        self.assertTrue(ConvertWANDSCDtoQTest_out)
        self.assertTrue(mtd.doesExist('ConvertWANDSCDtoQTest_out'))
        self.assertTrue(mtd.doesExist('ConvertWANDSCDtoQTest_out_data'))
        self.assertTrue(mtd.doesExist('ConvertWANDSCDtoQTest_out_normalization'))

        s = ConvertWANDSCDtoQTest_out.getSignalArray()
        self.assertAlmostEqual(np.nanmax(s), 4.646855396509936)
        self.assertAlmostEqual(np.nanargmax(s), 443011)

        self.assertEquals(ConvertWANDSCDtoQTest_out.getNumDims(), 3)
        self.assertEquals(ConvertWANDSCDtoQTest_out.getNPoints(), 101**3)

        d0 = ConvertWANDSCDtoQTest_out.getDimension(0)
        self.assertEquals(d0.name, '[H,H,0]')
        self.assertEquals(d0.getNBins(), 101)
        self.assertAlmostEquals(d0.getMinimum(), -8.08, 5)
        self.assertAlmostEquals(d0.getMaximum(), 8.08, 5)

        d1 = ConvertWANDSCDtoQTest_out.getDimension(1)
        self.assertEquals(d1.name, '[H,-H,0]')
        self.assertEquals(d1.getNBins(), 101)
        self.assertAlmostEquals(d1.getMinimum(), -8.08, 5)
        self.assertAlmostEquals(d1.getMaximum(), 8.08, 5)

        d2 = ConvertWANDSCDtoQTest_out.getDimension(2)
        self.assertEquals(d2.name, '[0,0,L]')
        self.assertEquals(d2.getNBins(), 101)
        self.assertAlmostEquals(d2.getMinimum(), -8.08, 5)
        self.assertAlmostEquals(d2.getMaximum(), 8.08, 5)

        self.assertEqual(ConvertWANDSCDtoQTest_out.getNumExperimentInfo(), 1)

        ConvertWANDSCDtoQTest_out.delete()
コード例 #7
0
    def test_COP(self):
        ConvertWANDSCDtoQTest_out = ConvertWANDSCDtoQ(
            'ConvertWANDSCDtoQTest_data',
            BinningDim0='-8.08,8.08,101',
            BinningDim1='-1.68,1.68,21',
            BinningDim2='-8.08,8.08,101',
            NormaliseBy='None')

        ConvertWANDSCDtoQTest_cop = ConvertWANDSCDtoQ(
            'ConvertWANDSCDtoQTest_data',
            BinningDim0='-8.08,8.08,101',
            BinningDim1='-1.68,1.68,21',
            BinningDim2='-8.08,8.08,101',
            NormaliseBy='None',
            ObliquityParallaxCoefficient=1.5)

        self.assertTrue(ConvertWANDSCDtoQTest_out)
        self.assertTrue(ConvertWANDSCDtoQTest_cop)

        Test_out = ConvertWANDSCDtoQTest_out.getSignalArray().copy()
        Test_cop = ConvertWANDSCDtoQTest_cop.getSignalArray().copy()

        x, y, z = np.meshgrid(np.linspace(-8, 8, 101),
                              np.linspace(-1.6, 1.6, 21),
                              np.linspace(-8, 8, 101),
                              indexing='ij')

        Test_out_max_Qy = y[~np.isnan(Test_out)].max()
        Test_cop_max_Qy = y[~np.isnan(Test_cop)].max()

        # Test whether Qy is scaled by ObliquityParallaxCoefficient correctly
        proportion = Test_cop_max_Qy / Test_out_max_Qy

        self.assertAlmostEquals(proportion, 1.5, 5)

        ConvertWANDSCDtoQTest_out.delete()
        ConvertWANDSCDtoQTest_cop.delete()