Beispiel #1
0
    def _validateIsInQ(self, property_name):
        ws = self.getProperty(property_name).value
        if not ws:
            return True  # Mandatory validators to take care of this. Early exit.

        targetUnit = UnitFactory.create('MomentumTransfer')
        return targetUnit.caption() == ws.getAxis(0).getUnit().caption()
Beispiel #2
0
    def _validateIsInQ(self, property_name):
        ws = self.getProperty(property_name).value
        if not ws:
            return True  # Mandatory validators to take care of this. Early exit.

        targetUnit = UnitFactory.create('MomentumTransfer')
        return targetUnit.caption() == ws.getAxis(0).getUnit().caption()
Beispiel #3
0
 def _get_unit_from_unit_factory(self, parameter_name: str) -> str:
     """Returns the units of a parameter if it exists in the UnitFactory."""
     if self._is_in_unit_factory(parameter_name):
         return UnitFactory.create(parameter_name).label()
     return ""
 def test_known_unit_can_be_created(self):
     energy = UnitFactory.create("Energy")
     self.assertTrue(isinstance(energy, Unit))
Beispiel #5
0
 def test_known_unit_can_be_created(self):
     energy = UnitFactory.create("Energy")
     self.assertTrue(isinstance(energy, Unit))