Skip to content

Fix "surface tension" physical type registered as J m^2 instead of N / m - #20683

Closed
pmocz wants to merge 2 commits into
astropy:mainfrom
pmocz:fix-surface-tension-physical-type
Closed

pmocz wants to merge 2 commits into
astropy:mainfrom
pmocz:fix-surface-tension-physical-type

Conversation

@pmocz

@pmocz pmocz commented Oct 23, 2026

Copy link
Copy Markdown

Description

This pull request is to address the "surface tension" physical type being registered with the wrong unit.

It was defined as W m**2 Hz**-1, which is J m**2. Surface tension is N / m = J / m**2 = kg s⁻², which has the same dimensions as the jansky. As a result:

>>> (u.N / u.m).physical_type
PhysicalType('spectral flux density')
>>> (u.J * u.m**2).physical_type
PhysicalType('surface tension')

The fix adds "surface tension" to the names of the Jy physical type, the same way J carries {"energy", "work", "torque"}, and removes the incorrect entry. After the change:

>>> (u.N / u.m).physical_type
PhysicalType({'spectral flux density', 'surface tension'})
>>> (u.J * u.m**2).physical_type
PhysicalType('unknown')

u.Jy.physical_type == "spectral flux density" is still True; only the repr/str of that physical type gains the extra name.

Tests: three cases added to unit_physical_type_pairs (N/m and J/m**2 → "surface tension", J m**2 → "unknown"). They fail on main and pass with the fix; the full astropy/units test suite passes locally.

The same change was proposed in #20682, which was auto-closed.

Fixes #20681

AI Disclosure

Claude Opus 5.5 (via Claude Code) found this bug while auditing astropy for math and unit errors, wrote the code change, tests and changelog entry, and ran the test suite. I reviewed the change before submitting.

  • I certify that I am human and that I take full responsibility for this pull request including all interactions with reviewers.

Merge method

  • By checking this box, the PR author has requested that maintainers do NOT use the "Squash and Merge" button.

🤖 Generated with Claude Code

pmocz and others added 2 commits October 23, 2026 08:47
The "surface tension" physical type was registered as W m^2 Hz^-1
(i.e. J m^2), but surface tension is N / m = J / m^2, which has the
same dimensions as the jansky. Add "surface tension" to the names for
the Jy physical type and remove the incorrect entry.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the units label Oct 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.

  • Do the proposed changes actually accomplish desired goals?
  • Do the proposed changes follow the Astropy coding guidelines?
  • Are tests added/updated as required? If so, do they follow the Astropy testing guidelines?
  • Are docs added/updated as required? If so, do they follow the Astropy documentation guidelines?
  • Is rebase and/or squash necessary? If so, please provide the author with appropriate instructions. Also see instructions for rebase and squash.
  • Did the CI pass? If no, are the failures related? If you need to run daily and weekly cron jobs as part of the PR, please apply the "Extra CI" label. Codestyle issues can be fixed by the bot.
  • Is a change log needed? If yes, did the change log check pass? If no, add the "no-changelog-entry-needed" label. If this is a manual backport, use the "skip-changelog-checks" label unless special changelog handling is necessary.
  • Is this a big PR that makes a "What's new?" entry worthwhile and if so, is (1) a "what's new" entry included in this PR and (2) the "whatsnew-needed" label applied?
  • At the time of adding the milestone, if the milestone set requires a backport to release branch(es), apply the appropriate "backport-X.Y.x" label(s) before merge.

@giles

giles Bot commented Oct 23, 2026

Copy link
Copy Markdown

Hi 👋 and thank you for your contribution! 🙏

This pull request is being closed automatically - but don't worry, this is not the end, and we may re-open it.

For some background, we have recently started seeing a rapid increase in the number of pull requests opened. Some of these are from good-faith humans, but some of which are from autonomous LLM agents or humans using LLMs who do not have a genuine understanding of, or interest in, the project. We are therefore auto-closing pull requests from new contributors, but if you are a good-faith human, we want to make sure your pull request gets considered! So if you would like us to re-open your pull request so that it gets reviewed, you need to do two things:

  1. Add a comment here to explain why you need the changes here to be considered, as in how the bug or missing feature affects your work, or whether this is an issue you have encountered but does not affect you.

  2. Join the astropy slack using this invite link and head over to the #new-contributor-requests channel to introduce yourself and let us know about this pull request

The second step is important, as we may otherwise miss notifications about this pull request.

To be clear, our AI policy does allow the use of LLMs as part of contributions, but we need to see authentic engagement and understanding from humans making the contribution.

Notes for maintainers

If you know this is a genuine user and the PR is is compliance with the AI policy, you may re-open this straight away. After two successful merged pull requests, the user will be added to the allowlist and future PRs will no longer be closed automatically.

This user has not made any pull requests to this repository prior to this one.

In addition, here are some statistics on the user's activity on GitHub:

Last 24 hours Last 7 days
Pull requests opened 5 11
Issues opened 1 1

(u.astrophys.Jy, "spectral flux density"),
(u.N / u.m, "surface tension"),
(u.J / u.m**2, "surface tension"),
(u.J * u.m**2, "unknown"),

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.

Suggested change
(u.J * u.m**2, "unknown"),

Given that the set of physical types with unknown dimensionality is infinite, my inclination would be to remove this particular test.

In the long term, I'm wondering if it would be useful to create a test to make sure that no physical type names are duplicated, though that is outside the scope of this PR. 🤔

@namurphy namurphy 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.

Thank you for submitting this! It looks good to me!

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"surface tension" physical type is registered as J m^2 instead of J / m^2

2 participants