Skip to content

Replaced isoareal quotient formula with sqrt of isperimetric quotient…#405

Merged
ljwolf merged 3 commits into
pysal:mainfrom
leehach:ipq
Jan 23, 2026
Merged

Replaced isoareal quotient formula with sqrt of isperimetric quotient…#405
ljwolf merged 3 commits into
pysal:mainfrom
leehach:ipq

Conversation

@leehach

@leehach leehach commented Jan 13, 2026

Copy link
Copy Markdown
Contributor

Proposed fixes to #403 .

Commit includes the following changes:

  1. Very minor code change to _cast(). Replaces nested if; if; else with if;elif;else.
  2. Replaced standalone formula in isoareal_quotient() with square root of isoperimetric_quotient(). Tested against builtin example data virginia, and the new version yields the same result.
  3. Expanded docstring for both functions. Removed some of the math from isoperimetric_quotient() while providing LaTeX math formulas for both functions.

I have tested the code, but regarding 3, I do not have my environment set up for producing documentation. I will follow up with someone on how to do that, but if a maintainer already has that set up and wants to check that the docstrings work, and in particular the math equations, that would be great.

@codecov

codecov Bot commented Jan 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 82.7%. Comparing base (bb0f069) to head (d53ef41).

Files with missing lines Patch % Lines
esda/shape.py 75.0% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main    #405     +/-   ##
=======================================
- Coverage   82.7%   82.7%   -0.0%     
=======================================
  Files         27      27             
  Lines       3829    3828      -1     
=======================================
- Hits        3166    3165      -1     
  Misses       663     663             
Files with missing lines Coverage Δ
esda/shape.py 77.0% <75.0%> (-0.1%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@martinfleis

Copy link
Copy Markdown
Member

If you install these to your env, then you should be able to build the docs by navigating to docs and running make html.

  - nbsphinx
  - numpydoc
  - pandoc
  - sphinx
  - sphinxcontrib-bibtex
  - sphinx_bootstrap_theme

@leehach

leehach commented Jan 13, 2026

Copy link
Copy Markdown
Contributor Author

When I run make html, sphinx attempts to import esda, but since I am developing esda in this environment, I don't have it installed. How do I get around this?

@martinfleis

Copy link
Copy Markdown
Member

I normally install editable versions of packages to my environment.

pip install . -e

@leehach

leehach commented Jan 13, 2026

Copy link
Copy Markdown
Contributor Author

I normally install editable versions of packages to my environment.

pip install . -e

Had to change to:

pip install -e .

which worked.

Docs compiled successfully (I didn't break anything) and the equations rendered correctly.

@martinfleis martinfleis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@martinfleis martinfleis requested a review from ljwolf January 14, 2026 08:17
@martinfleis martinfleis linked an issue Jan 14, 2026 that may be closed by this pull request
Comment thread esda/shape.py Outdated
@ljwolf

ljwolf commented Jan 14, 2026

Copy link
Copy Markdown
Member

I've just got one change, and then it's all fine w/ me!

Co-authored-by: Levi John Wolf <levi.john.wolf@gmail.com>
Comment thread esda/shape.py Outdated
Comment on lines +202 to +204
With some manipulation, :math:`IAQ` can also be expressed as the square root of the Isoperimetric quotient, given by
implemented as `numpy.sqrt(isoperimetric_quotient(collection))`. Importantly, this means
that the :math:`IAQ` and :math:`IPQ` will rank shapes identically.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I know you're likely aware, but this sentence now reads as "... given by implemented as...". Just flagging this so it does not get merged.

@leehach leehach Jan 22, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, I'm aware. Thanks for bringing to my attention. I'm not used to editing files directly in GitHub. @ljwolf had proposed an edit, and I thought it would be easier to accept the edit and then add my own. I wasn't sure what would happen to his proposal if I edited the file in the same area.

Let me know if I should do this differently.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It is fine like this if there's a follow-up commit. His proposal is just a comment that Github can turn into a commit. So if you did push your own without accepting, his suggestion would never make it to the commit history.

Added mathematical expression for Isoperimetric Area Quotient (IAQ) and clarified its relationship with Isoperimetric Quotient (IPQ).
@leehach

leehach commented Jan 23, 2026

Copy link
Copy Markdown
Contributor Author

@ljwolf I have updated the documentation for isoareal_quotient per your suggestion to demonstrate that the IAQ is the square root of the IPQ. You said you were OK with self-merge, but the PR is now failing CI checks that it wasn't failing a few days ago. Since my changes are only to documentation, something else is going on. Can someone let me know what's up with the CI checks?

@jGaboardi

Copy link
Copy Markdown
Member

@leehach – those new failures are due to pandas==v3 compatibility issues; nothing to with your updates in this PR.

@leehach leehach closed this Jan 23, 2026
@leehach leehach reopened this Jan 23, 2026
@leehach

leehach commented Jan 23, 2026

Copy link
Copy Markdown
Contributor Author

OK, everything is good to go, but I don't have merge power. Please merge when ready. (Sorry for accidental close and reopen, I thought it would be a combined merge/close PR.)

@ljwolf ljwolf merged commit d54eaf5 into pysal:main Jan 23, 2026
4 of 30 checks passed
@leehach leehach deleted the ipq branch January 23, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use isoperimetric_quotient to calculate isoareal_quotient

4 participants