Skip to content

Add narrative documentation on physical types #11588

Closed

Description

@namurphy

Description

In #11204 we made the physical_type attribute of units into instances of the new PhysicalType class. Before this, physical_type returned a string. It's now possible to do dimensional analysis along the lines of:

>>> import astropy.units as u
>>> length = u.m.physical_type
>>> area = u.get_physical_type("area")
>>> length * area
PhysicalType('volume')

There are descriptions on how to use physical types in the docstrings for PhysicalType, get_physical_type, and UnitBase.physical_type. Following a suggestion in #11204, it would be helpful to add a discussion of physical types in the narrative documentation for astropy.units.

It might be helpful to write out or have a table of all of the names of physical types. I'm not sure if this would be best in the narrative documentation or in the docstring for get_physical_type.

Activity

  1. nstarman commented on Apr 17, 2021

    @nstarman
    Member

    It might be helpful to write out or have a table of all of the names of physical types. I'm not sure if this would be best in the narrative documentation or in the docstring for get_physical_type.

    If it's in the narrative docs we might be able to x-ref to it so that physical types can better be incorporated into docstrings

        param : quantity-like [physical type]
    

    @adrn, #11555

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions