[AstroPy] How do you create a dimensionless Cartesian coordinate?

Michael Droettboom mdroe at stsci.edu
Thu Oct 24 12:25:54 EDT 2013


On 10/23/2013 02:03 PM, Demitri Muna wrote:
>
> On Oct 23, 2013, at 1:59 PM, Erik Tollerud <erik.tollerud at gmail.com 
> <mailto:erik.tollerud at gmail.com>> wrote:
>
>> The reason
>> this is necessary is that the default argument to `unit` is None, and
>> None means "no unit given", rather than "dimensionless".
>
> I've been thinking about this. Is there a difference here? I kind of 
> want do to do:
>
> Something(value, unit=None)
>
> to mean it's dimensionless.
>

This was determined early on in the development of astropy.units that we 
need a way to distinguish between "no unit was defined", and "the unit 
is dimensionless".  "None" indicates no unit is assigned to the value.  
This is helpful, for example, for tools that read from files where units 
may be missing when they should be specified.

See this:

http://docs.astropy.org/en/latest/units/standard_units.html#the-dimensionless-unit

Mike

-- 
                    _
|\/|o _|_  _. _ | | \.__  __|__|_|_  _  _ ._ _
|  ||(_| |(_|(/_| |_/|(_)(/_|_ |_|_)(_)(_)| | |

http://www.droettboom.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20131024/49c7eae2/attachment.html>


More information about the AstroPy mailing list