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

Improve display of dimensionless quantities in tables #9588

Open
astrofrog opened this issue Nov 11, 2019 · 1 comment
Open

Improve display of dimensionless quantities in tables #9588

astrofrog opened this issue Nov 11, 2019 · 1 comment

Comments

@astrofrog
Copy link
Member

In the following example, it's not clear in the table repr that a is a dimensionless quantity as opposed to a unitless array for which units haven't been set:

In [1]: from astropy import units as u                                                                               

In [2]: from astropy.table import QTable                                                                             

In [3]: tab = QTable()                                                                                               

In [4]: tab['a'] = [1, 2, 3] * u.one                                                                                 

In [5]: tab                                                                                                          
Out[5]: 
<QTable length=3>
   a   
       
float64
-------
    1.0
    2.0
    3.0

(this happens for Table` too). Maybe we should consider including (dimensionless)`` in the unit row or something similar?

@Harshil-C
Copy link

Harshil-C commented Jan 24, 2020

@astrofrog i added dimensioless property in the unit row but there was a confusion when there is a dimensionless quantity with scale != 1.0 .In the code it speacifies an output
if self._scale != 1.0: return 'Unit(dimensionless with a scale of {})'.format(self._scale).
So i decided to keep that as it is because i thought it was an important message and putting it into the table header will generally make the plaintext render of the table useless. If you like to suggest any other way for that kindly let me know.
here in wrote a PR

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

Successfully merging a pull request may close this issue.

4 participants