Closed Sheshuk closed 1 year ago
Thanks for investigating this further. As I already said on the AstroPy issue: Very nice detective work!
Regarding this PR, one quick example:
>>> data = [1, 2, 3] << 1/u.MeV/u.s
>>> data.decompose()
<Quantity [6.24150907e+12, 1.24830181e+13, 1.87245272e+13] s / (kg m2)>
So, yes, I think we would need to provide a custom unit list for decomposition; otherwise this will be unintuitive.
Also, have you had a chance to look at the test failures?
Thanks! You're right, I didn't think about MeVs. Now using [MeV, m, s, kg]
as the bases. Will this be enough for general use cases?
Also it fixes these obscure test failures.
Call "decompose" each time a new Container is created - this should prevent situations like "cm2/cm2" or "h/min" units.
Note: this reduces the units to SI bases. If we want, we can list standard SNEWPY units here, so everything will be converted to them instead.