Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDS units are not the same as regular units #7751

Open
taldcroft opened this issue Aug 21, 2018 · 1 comment
Open

CDS units are not the same as regular units #7751

taldcroft opened this issue Aug 21, 2018 · 1 comment

Comments

@taldcroft
Copy link
Member

For example:

In [5]: u.s is u.Unit('s')
Out[5]: True

In [6]: u.s is u.Unit('s', format='cds')
Out[6]: False

In [7]: u.s / u.s
Out[7]: Unit(dimensionless)

In [8]: u.s / u.Unit('s', format='cds')
Out[8]: Unit("s / s")

This first came up here: #7348 (review)

@kyleaoman
Copy link
Contributor

kyleaoman commented Aug 21, 2018

Hm, this is even more complicated than it appears at first. Enabling cds units helps somewhat:

>>> import astropy.units as u
>>> u.Unit('s') is u.Unit('s', format='cds')
False
>>> import astropy.units.cds
>>> with astropy.units.cds.enable():
...     u.Unit('s') is u.Unit('s', format='cds')
... 
True

but not entirely:

>>> u.Unit('s') is u.s
True
>>> u.Unit('s', format='cds') is u.s
False
>>> with astropy.units.cds.enable():
...     u.Unit('s', format='cds') is u.s
... 
False

which implies the very confusing:

>>> u.Unit('s') is u.s
True
>>> with astropy.units.cds.enable():
...     u.Unit('s') is u.s
... 
False

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants