Пример #1
0
 def test_many_runs_summed(self):
     out2 = LoadAndMerge(Filename='170257+170258',
                         LoaderName='LoadILLIndirect')
     self.assertTrue(out2)
     self.assertEqual(out2.name(), 'out2')
     self.assertTrue(isinstance(out2, MatrixWorkspace))
     mtd.clear()
 def _inputWS(self):
     """Return a raw input workspace."""
     inputFiles = self.getPropertyValue(Prop.RUN)
     inputFiles = inputFiles.replace(',', '+')
     if inputFiles:
         mergedWSName = self._names.withSuffix('merged')
         loadOption = {
             'XUnit': 'TimeOfFlight',
             'BeamCentre': 127.5,
             'BraggAngle': 0.0
         }
         # MergeRunsOptions are defined by the parameter files and will not be modified here!
         ws = LoadAndMerge(Filename=inputFiles,
                           LoaderName='LoadILLReflectometry',
                           LoaderVersion=-1,
                           LoaderOptions=loadOption,
                           OutputWorkspace=mergedWSName,
                           EnableLogging=self._subalgLogging)
     else:
         ws = self.getProperty(Prop.INPUT_WS).value
         if not ws.run().hasProperty(common.SampleLogs.TWO_THETA):
             # Write two theta to sample logs
             ws.run().addProperty(
                 common.SampleLogs.TWO_THETA,
                 float(self.getProperty(Prop.TWO_THETA).value), 'degree',
                 True)
         self._cleanup.protect(ws)
     return ws
Пример #3
0
 def test_loader_option(self):
     out6 = LoadAndMerge(Filename='967101',LoaderName='LoadILLDiffraction',
                          LoaderVersion=1,LoaderOptions=dict({'DataType':'Raw'}))
     self.assertTrue(out6)
     self.assertEqual(out6.name(), 'out6')
     self.assertTrue(isinstance(out6, MatrixWorkspace))
     mtd.clear()
Пример #4
0
 def test_specific_loader(self):
     out5 = LoadAndMerge(
         Filename='170257',
         LoaderName='LoadILLIndirect',
     )
     self.assertTrue(out5)
     self.assertEqual(out5.name(), 'out5')
     self.assertTrue(isinstance(out5, MatrixWorkspace))
Пример #5
0
 def test_multi_period_loader_list(self):
     out8 = LoadAndMerge(Filename='MUSR00015196,00015197.nxs')
     self.assertTrue(out8)
     self.assertTrue(isinstance(out8, WorkspaceGroup))
     self.assertEqual(out8.getNumberOfEntries(), 4)
     self.assertEqual(out8.getItem(0).name(), 'MUSR00015196_1')
     self.assertEqual(out8.getItem(1).name(), 'MUSR00015196_2')
     self.assertEqual(out8.getItem(2).name(), 'MUSR00015197_1')
     self.assertEqual(out8.getItem(3).name(), 'MUSR00015197_2')
Пример #6
0
 def test_non_ill_load(self):
     out7 = LoadAndMerge(Filename='IRS26173,26174.RAW')
     self.assertTrue(out7)
     self.assertTrue(isinstance(out7, WorkspaceGroup))
     self.assertEqual(out7.getNumberOfEntries(), 2)
     self.assertTrue(isinstance(out7.getItem(0), MatrixWorkspace))
     self.assertTrue(isinstance(out7.getItem(1), MatrixWorkspace))
     self.assertEqual(out7.getItem(0).name(), 'IRS26173')
     self.assertEqual(out7.getItem(1).name(), 'IRS26174')
Пример #7
0
 def test_concatenate_output(self):
     out = LoadAndMerge(Filename='010444:010446',
                        OutputBehaviour='Concatenate')
     self.assertTrue(out)
     self.assertEqual(out.name(), 'out')
     self.assertTrue(isinstance(out, MatrixWorkspace))
     self.assertEqual(out.blocksize(), 3)
     self.assertEqual(out.readX(0)[0], 0)
     self.assertEqual(out.readX(0)[1], 1)
     self.assertEqual(out.readX(0)[2], 2)
Пример #8
0
 def test_multi_period_loader_sum(self):
     out9 = LoadAndMerge(Filename='MUSR00015196+00015197.nxs')
     self.assertTrue(out9)
     self.assertTrue(isinstance(out9, MatrixWorkspace))
     self.assertTrue('MUSR00015196' not in mtd)
     self.assertTrue('MUSR00015197' not in mtd)
     self.assertTrue('MUSR00015196_1' not in mtd)
     self.assertTrue('MUSR00015196_2' not in mtd)
     self.assertTrue('MUSR00015197_1' not in mtd)
     self.assertTrue('MUSR00015197_2' not in mtd)
Пример #9
0
 def test_output_hidden(self):
     LoadAndMerge(Filename='170257+170258,170300+170302',LoaderName='LoadILLIndirect',
                   OutputWorkspace='__out')
     self.assertTrue(mtd['__out'])
     self.assertTrue(isinstance(mtd['__out'], WorkspaceGroup))
     self.assertEqual(mtd['__out'].getNumberOfEntries(), 2)
     self.assertTrue(isinstance(mtd['__out'].getItem(0), MatrixWorkspace))
     self.assertTrue(isinstance(mtd['__out'].getItem(1), MatrixWorkspace))
     self.assertEqual(mtd['__out'].getItem(0).name(),'__170257_170258')
     self.assertEqual(mtd['__out'].getItem(1).name(),'__170300_170302')
     mtd.clear()
Пример #10
0
 def test_many_runs_mixed(self):
     out4 = LoadAndMerge(Filename='170257+170258,170300+170302',LoaderName='LoadILLIndirect')
     self.assertTrue(out4)
     self.assertEqual(out4.name(), 'out4')
     self.assertTrue(isinstance(out4, WorkspaceGroup))
     self.assertEqual(out4.getNumberOfEntries(), 2)
     self.assertTrue(isinstance(out4.getItem(0), MatrixWorkspace))
     self.assertTrue(isinstance(out4.getItem(1), MatrixWorkspace))
     self.assertEqual(out4.getItem(0).name(),'170257_170258')
     self.assertEqual(out4.getItem(1).name(),'170300_170302')
     mtd.clear()
Пример #11
0
 def test_many_runs_listed(self):
     out3 = LoadAndMerge(Filename='170257,170258',LoaderName='LoadILLIndirect')
     self.assertTrue(out3)
     self.assertEqual(out3.name(), 'out3')
     self.assertTrue(isinstance(out3, WorkspaceGroup))
     self.assertEqual(out3.getNumberOfEntries(), 2)
     self.assertTrue(isinstance(out3.getItem(0), MatrixWorkspace))
     self.assertTrue(isinstance(out3.getItem(1), MatrixWorkspace))
     self.assertEqual(out3.getItem(0).name(),'170257')
     self.assertEqual(out3.getItem(1).name(),'170258')
     mtd.clear()
Пример #12
0
 def _inputWS(self, wsNames, wsCleanup, subalgLogging):
     """Return the raw input workspace."""
     inputFiles = self.getPropertyValue(common.PROP_INPUT_FILE)
     if inputFiles:
         mergedWSName = wsNames.withSuffix('merged')
         mainWS = LoadAndMerge(Filename=inputFiles, OutputWorkspace=mergedWSName,
                               LoaderName='LoadILLTOF', EnableLogging=subalgLogging)
     else:
         mainWS = self.getProperty(common.PROP_INPUT_WS).value
         wsCleanup.protect(mainWS)
     return mainWS
Пример #13
0
 def _inputWS(self):
     """Return the raw input workspace."""
     inputFiles = self.getPropertyValue(common.PROP_INPUT_FILE)
     if inputFiles:
         mergedWSName = self._names.withSuffix('merged')
         mainWS = LoadAndMerge(Filename=inputFiles, OutputWorkspace=mergedWSName,
                               LoaderName='LoadILLTOF', LoaderOptions={"ConvertToTOF": True}, EnableLogging=self._subalgLogging)
     else:
         mainWS = self.getProperty(common.PROP_INPUT_WS).value
         self._cleanup.protect(mainWS)
     return mainWS
Пример #14
0
 def test_concatenate_output_with_log(self):
     out = LoadAndMerge(Filename='010444:010446',
                        OutputBehaviour='Concatenate',
                        SampleLogAsXAxis='sample.temperature')
     self.assertTrue(out)
     self.assertEqual(out.name(), 'out')
     self.assertTrue(isinstance(out, MatrixWorkspace))
     self.assertEqual(out.blocksize(), 3)
     self.assertAlmostEqual(out.readX(0)[0], 297.6, 1)
     self.assertAlmostEqual(out.readX(0)[1], 297.7, 1)
     self.assertAlmostEqual(out.readX(0)[2], 297.7, 1)
Пример #15
0
 def test_single_run_load(self):
     out1 = LoadAndMerge(Filename='170257')
     self.assertTrue(out1)
     self.assertEqual(out1.name(), 'out1')
     self.assertTrue(isinstance(out1, MatrixWorkspace))
     mtd.clear()