MCPcopy Create free account
hub / github.com/Cantera/cantera / inverse

Method inverse

test/python/test_units.py:91–98  ·  view source on GitHub ↗
(self, name: Optional[str] = None)

Source from the content-addressed store, hash-verified

89 return self.name
90
91 def inverse(self, name: Optional[str] = None) -> "Dimensions":
92 dimensionality = {}
93 for dimension in self.dimensions:
94 value = getattr(self, dimension)
95 if value is not None:
96 dimensionality[dimension] = -1 * value
97 new_name = name if name is not None else f"inverse_{self.name}"
98 return Dimensions(name=new_name, **dimensionality)
99
100 def as_dict(self) -> Dict[str, float]:
101 """Add the square brackets around the dimension for comparison with pint"""

Callers 2

test_units.pyFile · 0.80
invertFunction · 0.80

Calls 1

DimensionsClass · 0.85

Tested by

no test coverage detected