Skip to content

Wrap fitcircle - #1550

Open
willschlitzer wants to merge 67 commits into
mainfrom
wrap/fitcircle
Open

Wrap fitcircle#1550
willschlitzer wants to merge 67 commits into
mainfrom
wrap/fitcircle

Conversation

@willschlitzer

@willschlitzer willschlitzer commented Sep 29, 2021

Copy link
Copy Markdown
Contributor

This pull request wraps the module fitcircle.

Preview at https://pygmt-dev--1550.org.readthedocs.build/en/1550/api/generated/pygmt.fitcircle.html

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If adding new functionality, add an example to docstrings or tutorials.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash commands are:

  • /format: automatically format and lint the code
  • /test-gmt-dev: run full tests on the latest GMT development version

@willschlitzer willschlitzer added the feature Brand new feature label Sep 29, 2021
@willschlitzer willschlitzer added this to the 0.5.0 milestone Sep 29, 2021
@willschlitzer willschlitzer self-assigned this Sep 29, 2021
@willschlitzer willschlitzer modified the milestones: 0.5.0, 0.6.0 Oct 7, 2021
@willschlitzer
willschlitzer marked this pull request as ready for review January 14, 2022 00:40
@weiji14 weiji14 removed this from the 0.6.0 milestone Mar 13, 2022
Comment thread pygmt/src/fitcircle.py Outdated
Comment thread pygmt/src/fitcircle.py Outdated
Comment thread pygmt/src/fitcircle.py Outdated
Comment thread pygmt/src/fitcircle.py Outdated
Comment thread pygmt/src/fitcircle.py Outdated
Comment thread pygmt/src/fitcircle.py Outdated
willschlitzer and others added 10 commits August 14, 2026 15:49
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Comment thread pygmt/src/fitcircle.py Outdated
Comment thread pygmt/src/fitcircle.py Outdated
Comment thread pygmt/src/fitcircle.py Outdated
Comment thread pygmt/src/fitcircle.py Outdated
willschlitzer and others added 5 commits August 15, 2026 17:55
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Comment thread pygmt/helpers/caching.py Outdated
Comment thread pygmt/src/fitcircle.py Outdated
Comment thread pygmt/src/fitcircle.py Outdated
Comment thread pygmt/src/fitcircle.py
Comment thread pygmt/src/fitcircle.py
Comment on lines +26 to +54
Find mean position and great or small circle fit to points on sphere.

This method takes (longitude, latitude) values and converts them to Cartesian
three-vectors on the unit sphere. Then two locations are found: the mean
of the input positions, and the pole to the great circle which best fits
the input positions.

Setting ``norm`` to ``1`` (L1 norm) approximates the minimization of the
sum of absolute values of cosines of angular distances. This solution
finds the mean position as the Fisher average of the data, and the pole
position as the Fisher average of the cross-products between the mean
and the data. Averaging cross-products gives weight to points in
proportion to their distance from the mean, analogous to the "leverage"
of distant points in linear regression in the plane.

Setting ``norm`` to ``2`` (L2 norm) approximates the minimization of the
sum of squares of cosines of angular distances. It creates a 3 by 3
matrix of sums of squares of components of the data vectors. The
eigenvectors of this matrix give the mean and pole locations. This
method may be more subject to roundoff errors when there are thousands
of data. The pole is given by the eigenvector corresponding to the
smallest eigenvalue; it is the least-well represented factor in the data
and is not easily estimated by either method.

When the data are closely grouped along a great circle both solutions
are similar. If the data have large dispersion, the pole to the great
circle will be less well determined than the mean. Compare both
solutions as a qualitative check by calling :func:`pygmt.fitcircle`
twice, once for each ``norm``.

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.

Please rewrap these lines to ~88 characters per line.

Comment thread pygmt/src/fitcircle.py Outdated
Comment thread pygmt/src/fitcircle.py
willschlitzer and others added 4 commits September 10, 2026 19:59
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Brand new feature needs review This PR has higher priority and needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants