home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- from Scientific.Physics.PhysicalQuantities import PhysicalQuantity
- import math
-
- class PhysicalQuantityFunction:
-
- def __init__(self, name):
- self.name = name
-
-
- def __call__(self, x):
- if isinstance(x, PhysicalQuantity):
- return PhysicalQuantity.__dict__[self.name](x)
- return math.__dict__[self.name](x)
-
-
-
- class PhysicalQuantityInteractive(PhysicalQuantity):
- b = PhysicalQuantity.inBaseUnits
- u = PhysicalQuantity.inUnitsOf
-
- def __str__(self):
- return PhysicalQuantity.__repr__(self)
-
-
- def __repr__(self):
- value = '%.4G' % self.value
- units = self.unit.name().replace('**', '^')
- return value + ' ' + units
-
-
- sin = PhysicalQuantityFunction('sin')
- cos = PhysicalQuantityFunction('cos')
- tan = PhysicalQuantityFunction('tan')
- sqrt = PhysicalQuantityFunction('sqrt')
-