Skip to main content

PyPI version Build Status Python versions

Getting started

pip install fb8

import numpy as np
from matplotlib import pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D
from sphere.distribution import fb8


def grid(npts):
    return [_.flatten() for _ in np.meshgrid(np.linspace(0, np.pi, npts), np.linspace(0,2*np.pi, npts))]


def plot_fb8(fb8, npts):
    """
    Plot fb8 on 3D sphere
    """
    xs = fb8.spherical_coordinates_to_nu(*grid(npts))
    pdfs = fb8.pdf(xs)
    z,x,y = xs.T #!!! Note the ordering for xs here is used consistently throughout. Follows Kent's 1982 paper.

    fig = plt.figure(figsize=plt.figaspect(1.))
    ax = fig.add_subplot(111, projection='3d')
    ax.plot_surface(x.reshape(npts, npts),
                    y.reshape(npts, npts),
                    z.reshape(npts, npts),
                    alpha=0.5,
                    rstride=1, cstride=1,
                    facecolors=cm.plasma(pdfs.reshape(npts, npts)/pdfs.max()))
    ax.set_axis_off()
    plt.tight_layout(-5)
    plt.show()


plot_fb8(fb8(np.pi/16,-np.pi/3,0,10,10,-1,0.5,0.3), 200)

Basic information

Implements calculation of the density and fitting (using maximum likelihood estimate) of the FB8 distribution on a sphere, which is a generalization of the FB6, FB5 (Kent), and FB4 (Bingham-Mardia) distributions described below.

Implements the FB6 distribution that is first introduced in Rivest (1984).

Implements calculation of the density and fitting (using maximum likelihood estimate) of the Kent distribution based on Kent (1982). A unittest is performed if distribution.py is called from the command line.

Implements the Bingham-Mardia distribution whose mode is a small-circle on the sphere based on Bingham, Mardia (1978).

Also calculates directional, percentile levels which can be used to indicate the N% highest-posterior-density regions in the sky.

maps

Additional references

Kent, Hussein, Jah, Directional distributions in tracking of space debris

Terdik, Jammalamadaka, Wainwright, Simulation and visualization of spherical distributions

Mardia, Jupp, Directional statistics

Notes

Currently the scipy.special.hyp2f1 is used and may exhibit inaccuracies for large parameters. See github issues.

Acknowledgements

This project was originally developed for the FB5 (Kent) distribution here.

Tianlu Yuan

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fb8-1.2.9.tar.gz (6.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fb8-1.2.9-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file fb8-1.2.9.tar.gz.

File metadata

  • Download URL: fb8-1.2.9.tar.gz
  • Upload date:
  • Size: 6.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for fb8-1.2.9.tar.gz
Algorithm Hash digest
SHA256 d7e62354a93209a9dc9eff8949cca03f52c24f91b003f0e2fc8145766af821cd
MD5 941454dd90dc623882f509aa224c088f
BLAKE2b-256 a1200cda1532905d591343857dc765290251e21ac18c749d48f5bca597afcb31

See more details on using hashes here.

Provenance

The following attestation bundles were made for fb8-1.2.9.tar.gz:

Publisher: publish.yml on tianluyuan/sphere

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fb8-1.2.9-py3-none-any.whl.

File metadata

  • Download URL: fb8-1.2.9-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for fb8-1.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 999d72f1d5ab8fa2d5fc23a7cf142a55400dbf4a30b91c0a10279f5ce29bf095
MD5 9d7674ada6a3653164d1217cfa749695
BLAKE2b-256 5595287c3a83776c6f4d27277491fbd5cfcb6dd4348fa06264696549f5d7f9f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for fb8-1.2.9-py3-none-any.whl:

Publisher: publish.yml on tianluyuan/sphere

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.2.9 This release

2 files

1.2.8

2 files

1.2.7

2 files

1.2.6

2 files

1.2.5

2 files

1.2.4

2 files

1.2.3

2 files

1.2.2

2 files

1.2.1

2 files

1.1.2

2 files

1.1.1

2 files

1.1.0

2 files

1.0.1

2 files

0.3.0

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page