def initialization(self): if i.ReductionSingleton().get_instrument() != 'SANS2D': i.ReductionSingleton.clean(isis_reducer.ISISReducer) i.ReductionSingleton().set_instrument(isis_instrument.SANS2D()) i.ReductionSingleton.clean(isis_reducer.ISISReducer) i.ReductionSingleton().set_instrument(isis_instrument.SANS2D()) i.ReductionSingleton().user_settings =isis_reduction_steps.UserFile(MASKFILE) i.ReductionSingleton().user_settings.execute(i.ReductionSingleton()) return i
def test_that_calibration_workspace_has_absent_entries_copied_over(self): # Arrange ws_name1 = "ws1" types1 = ["Number", "String", "Number"] values1 = ["100.4", "test", "200"] names1 = ["val1", "val2", "val3"] self.create_sample_workspace(ws_name1, types1, values1, names1) ws_name2 = "ws2" types2 = ["Number", "String", "Number"] values2 = ["2.4", "test3", "3"] names2 = ["val1", "val2", "val4"] self.create_sample_workspace(ws_name2, types2, values2, names2) inst = instruments.SANS2D() # Act inst._add_parmeters_absent_in_calibration(ws_name1, ws_name2) # Assert ws2 = mtd[ws_name2] self.assertTrue(ws2.getInstrument().hasParameter("val1")) self.assertTrue(ws2.getInstrument().hasParameter("val2")) self.assertTrue(ws2.getInstrument().hasParameter("val3")) self.assertTrue(ws2.getInstrument().hasParameter("val4")) self.assertEqual(len(ws2.getInstrument().getNumberParameter("val1")), 1) self.assertEqual(ws2.getInstrument().getNumberParameter("val1")[0], 2.4) self.assertEqual(len(ws2.getInstrument().getIntParameter("val3")), 1) self.assertEqual(ws2.getInstrument().getIntParameter("val3")[0], 200) # Clean up DeleteWorkspace(ws_name1) DeleteWorkspace(ws_name2)
def runTest(self): self.singleModePrepare() i.FindBeamCentre(rlow=41, rupp=280, MaxIter=3, xstart=float(150) / 1000., ystart=float(-160) / 1000., tolerance=0.0001251) self.checkCentreResult() # clean up i.ReductionSingleton.clean(isis_reducer.ISISReducer) i.ReductionSingleton().set_instrument(isis_instrument.SANS2D()) i.ReductionSingleton().user_settings = isis_reduction_steps.UserFile( sansgui.MASKFILE) i.ReductionSingleton().user_settings.execute(i.ReductionSingleton())
def _get_correct_instrument(self, instrument_name, idf_path=None): ''' Creates an ISIS instrument based on the name and the chosen idf_path @param instrument_name: the name of the instrument @param idf_path: the full path to the IDF ''' instrument = None try: if instrument_name.upper() == "LARMOR": instrument = isis_instrument.LARMOR(idf_path) elif instrument_name.upper() == "SANS2D": instrument = isis_instrument.SANS2D(idf_path) elif instrument_name.upper() == "LOQ": instrument = isis_instrument.LOQ(idf_path) # pylint: disable=bare-except except: instrument = None return instrument
def cleanReduction(self, user_settings): i.ReductionSingleton.clean(isis_reducer.ISISReducer) i.ReductionSingleton().set_instrument(isis_instrument.SANS2D()) #i.ReductionSingleton().user_file_path='' i.ReductionSingleton().user_settings = user_settings i.ReductionSingleton().user_settings.execute(i.ReductionSingleton())