Skip to content

Add narrative documentation on physical types #11588

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions