Skip to content

Add narrative documentation for physical types#11606

Merged
mhvk merged 7 commits into
astropy:mainfrom
namurphy:physical-type-docs
Apr 21, 2021
Merged

Add narrative documentation for physical types#11606
mhvk merged 7 commits into
astropy:mainfrom
namurphy:physical-type-docs

Conversation

@namurphy

Copy link
Copy Markdown
Contributor

Description

This pull request is to add narrative documentation on how to use the PhysicalType instances that were added in #11204.

Fixes #11588.

@github-actions github-actions Bot added the units label Apr 19, 2021
@github-actions

Copy link
Copy Markdown
Contributor

👋 Thank you for your draft pull request! Do you know that you can use [ci skip] or [skip ci] in your commit messages to skip running continuous integration tests until you are ready?

@pllim pllim added this to the v4.3 milestone Apr 19, 2021
@pllim pllim requested a review from mhvk April 19, 2021 21:00
@pllim

pllim commented Apr 19, 2021

Copy link
Copy Markdown
Member

Not necessarily this particular example per se, but maybe include an example where a unit can have multiple physical types? I ran into this one in my downstream package:

>>> from astropy import units as u
>>> FLAM = u.def_unit(
...     'flam', u.erg / (u.cm**2 * u.s * u.AA),
...     format={'generic': 'FLAM', 'console': 'FLAM'})
>>> FLAM.physical_type
PhysicalType({'power density', 'spectral flux density wav'})

@mhvk mhvk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, very nice!

I think it is good to keep it simple (as you did), but it makes sense to, as @pllim suggested, also have one example of a unit whose physical type is ambiguous (maybe just pressure?)

@namurphy

Copy link
Copy Markdown
Contributor Author

Not necessarily this particular example per se, but maybe include an example where a unit can have multiple physical types?

Agreed! I still have to write that part, as well as an example on dimensional analysis with PhysicalType instances.

Comment thread docs/units/physical_types.rst Outdated
@namurphy namurphy marked this pull request as ready for review April 21, 2021 01:57

@mhvk mhvk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good!

Comment thread docs/units/physical_types.rst
Comment thread docs/units/physical_types.rst Outdated
>>> length = u.get_physical_type('length')
>>> time = u.get_physical_type('time')
>>> length ** 2
PhysicalType({'area')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The curly bracket here causes the tests to fail...

@nstarman

Copy link
Copy Markdown
Member

As I did in perhaps a bad way, and @mhvk suggested an alternative in #11595, it would be great to also have a list of the valid physical types in the docs. I agree that @mhvk's proposal is more in line with current astropy conventions... No problems if you don't want to do it here, I'll tackle it at some point in #11595, but then it won't be in v4.3!

@nstarman nstarman mentioned this pull request Apr 21, 2021
10 tasks
@nstarman

Copy link
Copy Markdown
Member

As I did in perhaps a bad way, and @mhvk suggested an alternative in #11595, it would be great to also have a list of the valid physical types in the docs. I agree that @mhvk's proposal is more in line with current astropy conventions... No problems if you don't want to do it here, I'll tackle it at some point in #11595, but then it won't be in v4.3!

never mind. @mhvk is tackling this already!

@mhvk mhvk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Let's just let CI run just to be sure, but otherwise ready to go in. Thanks, @namurphy!

@mhvk mhvk added the zzz 💤 merge-when-ci-passes Do not use: We have auto-merge option now. label Apr 21, 2021
@mhvk mhvk merged commit 5f8866e into astropy:main Apr 21, 2021
@namurphy namurphy deleted the physical-type-docs branch April 21, 2021 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add narrative documentation on physical types

4 participants