Example #1
0
def get_component_name(workspace, detector_type):
    instrument = workspace.getInstrument()
    instrument_name = instrument.getName().strip()
    instrument_name = instrument_name.upper()
    instrument = SANSInstrument.from_string(instrument_name)
    return convert_instrument_and_detector_type_to_bank_name(
        instrument, detector_type)
 def test_that_convert_instrument_and_detector_type_to_bank_name_produces_expected_results(self):
     self.assertTrue("front-detector" == convert_instrument_and_detector_type_to_bank_name(SANSInstrument.SANS2D,
                                                                                           DetectorType.HAB))
     self.assertTrue("rear-detector" == convert_instrument_and_detector_type_to_bank_name(SANSInstrument.SANS2D,
                                                                                          DetectorType.LAB))
     self.assertTrue("HAB" == convert_instrument_and_detector_type_to_bank_name(SANSInstrument.LOQ,
                                                                                DetectorType.HAB))
     self.assertTrue("main-detector-bank" == convert_instrument_and_detector_type_to_bank_name(SANSInstrument.LOQ,
                                                                                               DetectorType.LAB))
     self.assertTrue("DetectorBench" == convert_instrument_and_detector_type_to_bank_name(SANSInstrument.LARMOR,
                                                                                          DetectorType.LAB))
     self.assertTrue("rear-detector" == convert_instrument_and_detector_type_to_bank_name(SANSInstrument.ZOOM,
                                                                                          DetectorType.LAB))
 def test_that_convert_instrument_and_detector_type_to_bank_name_produces_expected_results(self):
     self.assertTrue("front-detector" == convert_instrument_and_detector_type_to_bank_name(SANSInstrument.SANS2D,
                                                                                           DetectorType.HAB))
     self.assertTrue("rear-detector" == convert_instrument_and_detector_type_to_bank_name(SANSInstrument.SANS2D,
                                                                                          DetectorType.LAB))
     self.assertTrue("HAB" == convert_instrument_and_detector_type_to_bank_name(SANSInstrument.LOQ,
                                                                                DetectorType.HAB))
     self.assertTrue("main-detector-bank" == convert_instrument_and_detector_type_to_bank_name(SANSInstrument.LOQ,
                                                                                               DetectorType.LAB))
     self.assertTrue("DetectorBench" == convert_instrument_and_detector_type_to_bank_name(SANSInstrument.LARMOR,
                                                                                          DetectorType.LAB))
     self.assertTrue("rear-detector" == convert_instrument_and_detector_type_to_bank_name(SANSInstrument.ZOOM,
                                                                                          DetectorType.LAB))
Example #4
0
def get_component_name(workspace, detector_type):
    instrument = workspace.getInstrument()
    instrument_name = instrument.getName().strip()
    instrument_name = instrument_name.upper()
    instrument = SANSInstrument.from_string(instrument_name)
    return convert_instrument_and_detector_type_to_bank_name(instrument, detector_type)