Created
December 15, 2016 13:51
-
-
Save joleroi/73c4f1477f750f493a4e3264e2a6e9e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--------------------------------------------------------------------------- | |
UnitConversionError Traceback (most recent call last) | |
<ipython-input-1-99b7b96cd801> in <module>() | |
1 import astropy.units as u | |
2 myunit = u.keV | |
----> 3 myunit.decompose(bases=[u.TeV]) | |
/home/kingj/Software/astropy/astropy/units/core.pyc in decompose(self, bases) | |
1952 | |
1953 def decompose(self, bases=set()): | |
-> 1954 return self._represents.decompose(bases=bases) | |
1955 | |
1956 def is_unity(self): | |
/home/kingj/Software/astropy/astropy/units/core.pyc in decompose(self, bases) | |
2128 | |
2129 x = CompositeUnit(self.scale, self.bases, self.powers, decompose=True, | |
-> 2130 decompose_bases=bases) | |
2131 if len(bases) == 0: | |
2132 self._decomposed_cache = x | |
/home/kingj/Software/astropy/astropy/units/core.pyc in __init__(self, scale, bases, powers, decompose, decompose_bases, _error_check) | |
2012 self._powers = powers | |
2013 self._decomposed_cache = None | |
-> 2014 self._expand_and_gather(decompose=decompose, bases=decompose_bases) | |
2015 self._hash = None | |
2016 | |
/home/kingj/Software/astropy/astropy/units/core.pyc in _expand_and_gather(self, decompose, bases) | |
2085 for b, p in zip(self.bases, self.powers): | |
2086 if decompose and b not in bases: | |
-> 2087 b = b.decompose(bases=bases) | |
2088 | |
2089 if isinstance(b, CompositeUnit): | |
/home/kingj/Software/astropy/astropy/units/core.pyc in decompose(self, bases) | |
1952 | |
1953 def decompose(self, bases=set()): | |
-> 1954 return self._represents.decompose(bases=bases) | |
1955 | |
1956 def is_unity(self): | |
/home/kingj/Software/astropy/astropy/units/core.pyc in decompose(self, bases) | |
2128 | |
2129 x = CompositeUnit(self.scale, self.bases, self.powers, decompose=True, | |
-> 2130 decompose_bases=bases) | |
2131 if len(bases) == 0: | |
2132 self._decomposed_cache = x | |
/home/kingj/Software/astropy/astropy/units/core.pyc in __init__(self, scale, bases, powers, decompose, decompose_bases, _error_check) | |
2012 self._powers = powers | |
2013 self._decomposed_cache = None | |
-> 2014 self._expand_and_gather(decompose=decompose, bases=decompose_bases) | |
2015 self._hash = None | |
2016 | |
/home/kingj/Software/astropy/astropy/units/core.pyc in _expand_and_gather(self, decompose, bases) | |
2085 for b, p in zip(self.bases, self.powers): | |
2086 if decompose and b not in bases: | |
-> 2087 b = b.decompose(bases=bases) | |
2088 | |
2089 if isinstance(b, CompositeUnit): | |
/home/kingj/Software/astropy/astropy/units/core.pyc in decompose(self, bases) | |
1952 | |
1953 def decompose(self, bases=set()): | |
-> 1954 return self._represents.decompose(bases=bases) | |
1955 | |
1956 def is_unity(self): | |
/home/kingj/Software/astropy/astropy/units/core.pyc in decompose(self, bases) | |
2128 | |
2129 x = CompositeUnit(self.scale, self.bases, self.powers, decompose=True, | |
-> 2130 decompose_bases=bases) | |
2131 if len(bases) == 0: | |
2132 self._decomposed_cache = x | |
/home/kingj/Software/astropy/astropy/units/core.pyc in __init__(self, scale, bases, powers, decompose, decompose_bases, _error_check) | |
2012 self._powers = powers | |
2013 self._decomposed_cache = None | |
-> 2014 self._expand_and_gather(decompose=decompose, bases=decompose_bases) | |
2015 self._hash = None | |
2016 | |
/home/kingj/Software/astropy/astropy/units/core.pyc in _expand_and_gather(self, decompose, bases) | |
2085 for b, p in zip(self.bases, self.powers): | |
2086 if decompose and b not in bases: | |
-> 2087 b = b.decompose(bases=bases) | |
2088 | |
2089 if isinstance(b, CompositeUnit): | |
/home/kingj/Software/astropy/astropy/units/core.pyc in decompose(self, bases) | |
1952 | |
1953 def decompose(self, bases=set()): | |
-> 1954 return self._represents.decompose(bases=bases) | |
1955 | |
1956 def is_unity(self): | |
/home/kingj/Software/astropy/astropy/units/core.pyc in decompose(self, bases) | |
2128 | |
2129 x = CompositeUnit(self.scale, self.bases, self.powers, decompose=True, | |
-> 2130 decompose_bases=bases) | |
2131 if len(bases) == 0: | |
2132 self._decomposed_cache = x | |
/home/kingj/Software/astropy/astropy/units/core.pyc in __init__(self, scale, bases, powers, decompose, decompose_bases, _error_check) | |
2012 self._powers = powers | |
2013 self._decomposed_cache = None | |
-> 2014 self._expand_and_gather(decompose=decompose, bases=decompose_bases) | |
2015 self._hash = None | |
2016 | |
/home/kingj/Software/astropy/astropy/units/core.pyc in _expand_and_gather(self, decompose, bases) | |
2085 for b, p in zip(self.bases, self.powers): | |
2086 if decompose and b not in bases: | |
-> 2087 b = b.decompose(bases=bases) | |
2088 | |
2089 if isinstance(b, CompositeUnit): | |
/home/kingj/Software/astropy/astropy/units/core.pyc in decompose(self, bases) | |
1690 raise UnitConversionError( | |
1691 "Unit {0} can not be decomposed into the requested " | |
-> 1692 "bases".format(self)) | |
1693 | |
1694 return self | |
UnitConversionError: Unit kg can not be decomposed into the requested bases |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment