question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make PhysicalType instances support string methods with deprecation warnings

See original GitHub issue

Description

Prior to #11204, the physical_type attribute of units was a string with the name of the unit. #11204 transformed the physical_type attribute into instances of the new PhysicalType class. #11204 did preserve much of the behavior of the string API (such as having == work between PhysicalType instances and strings), but there were a few ways that it did not. A few of these ways are being discussed in #11204 starting with this comment. A lot of this could probably be done with this suggestion from @mhvk.

Suggestions on specific string behaviors to include and test for would be appreciated!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
namurphycommented, Apr 28, 2021

Will this be fixed by #11625 ?

Thank you for the reminder! I completely forgot I raised this issue. Yep, #11625 will fix this.

0reactions
hugobuddelcommented, Jul 31, 2021

The trouble is worth it though. Units and physical types are extremely hard to get right and the astropy approach of taking it one step at a time is great. And every change will break someone’s workflow.

We use the physical type to determine whether a value is an integrated flux or a flux density, #11204 seems to be a step in the right direction to do this properly through dimensional analysis. So thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

astropy/CHANGES.rst at main - GitHub
Trying to create an instance of astropy.coordinates. ... PhysicalType class instead of strings and the function astropy.units.physical.get_physical_type can ...
Read more >
Full Changelog — Astropy v3.2.dev994
The astropy.io.fits.new_table function is now fully deprecated (though will not be removed for a long time, considering how widely it is used). Instead...
Read more >
python-astropy-4.0.2-bp153.1.10 - SUSE Package Hub
(read|write).help when reader or writer has no docstring. ... New deprecation warnings from numpy 1.19 started to fail the test multibuild again.
Read more >
Astropy Deprecation Warning - python - Stack Overflow
The easiest way to get rid of the warning is to simply remove the ~/.astropy/config/astropy.cfg file, if you have not edited it before....
Read more >
Full Changelog — Astropy v0.4.2 - The University of Texas at Austin
[#2917]; Ensure numpy master is supported, by making np.cbrt work with ... Restored missing information from deprecation warning messages from the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found