def test_MARI_axis_cylinder(self):
        """ Test that default axis for MARI is different"""
        ash = Cylinder('Fe', [10, 2])
        res = ash.shape
        self.assertEqual(res['Height'], 10)
        self.assertEqual(res['Radius'], 2)
        self.assertTrue(ash._axis_is_default)
        test_ws = CreateSampleWorkspace(NumBanks=1, BankPixelWidth=1)
        test_ws = ConvertUnits(test_ws, 'DeltaE', Emode='Direct', EFixed=2000)
        cor_ws, corrections = ash.correct_absorption(test_ws, is_fast=True)
        res = ash.shape
        self.assertEqual(res['Axis'], [0., 1., 0])

        EditInstrumentGeometry(test_ws, [1], [0], InstrumentName='MARI')
        cor_ws, corrections = ash.correct_absorption(test_ws, is_fast=True)
        res = ash.shape
        self.assertEqual(res['Axis'], [1., 0., 0])
Beispiel #2
0
    def test_adsrp_cylinder(self):
        ash = Cylinder('V', [10, 2])
        res = ash.shape
        self.assertEqual(res['Height'], 10)
        self.assertEqual(res['Radius'], 2)
        self.assertTrue(ash._axis_is_default)

        ash.shape = [5, 1, [0, 1, 0], [0., 0., -0.5]]
        res = ash.shape
        self.assertEqual(res['Height'], 5)
        self.assertEqual(res['Radius'], 1)
        self.assertEqual(res['Axis'], [0, 1, 0])
        self.assertEqual(res['Center'], [0, 0, -0.5])
        self.assertFalse(ash._axis_is_default)

        ash.shape = {'Height': 5, 'Radius': 2, 'Axis': [1, 0, 0], 'Center': [0., 0., 0.]}
        res = ash.shape
        self.assertEqual(res['Height'], 5)
        self.assertEqual(res['Radius'], 2)
        self.assertEqual(res['Axis'], [1, 0, 0])
        self.assertEqual(res['Center'], [0, 0, 0])

        test_ws = CreateSampleWorkspace(NumBanks=1, BankPixelWidth=1)
        test_ws = ConvertUnits(test_ws, 'DeltaE', Emode='Direct', EFixed=2000)
        cor_ws, corrections = ash.correct_absorption(test_ws, is_fast=True)
        n_bins = corrections.blocksize()
        corr_ranges = [n_bins, corrections.readY(0)[0], corrections.readY(0)[n_bins - 1]]
        np.testing.assert_almost_equal(corr_ranges, [97, 0.0, 0.0], 4)
        mccor_ws, mc_corr = ash.correct_absorption(test_ws, EventsPerPoint=300)
        n_bins = mc_corr.blocksize()
        mccorr_ranges = [n_bins, mc_corr.readY(0)[0], mc_corr.readY(0)[n_bins - 1]]
        np.testing.assert_almost_equal(mccorr_ranges, [97, 0.266, 0.033], 3)