Implementation of FB8, a generalization of the Kent (1982) and Bingham-Mardia (1978) distributions on a sphere
Project description
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.
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fb8-1.2.8.tar.gz.
File metadata
- Download URL: fb8-1.2.8.tar.gz
- Upload date:
- Size: 6.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5285436875fa1540d27aff5817ea96341b61a590ede4b7998fa297a1abb41f6e
|
|
| MD5 |
08f43e0b4fb75a53a6385b57e8a83c0b
|
|
| BLAKE2b-256 |
01453acca88d0faf3ba583889be464d2b29f3e84346d9f287daf8e5547f9072a
|
Provenance
The following attestation bundles were made for fb8-1.2.8.tar.gz:
Publisher:
publish.yml on tianluyuan/sphere
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fb8-1.2.8.tar.gz -
Subject digest:
5285436875fa1540d27aff5817ea96341b61a590ede4b7998fa297a1abb41f6e - Sigstore transparency entry: 546931869
- Sigstore integration time:
-
Permalink:
tianluyuan/sphere@998413c14f0febbb709e22386930b6d242c3937e -
Branch / Tag:
refs/tags/1.2.8 - Owner: https://github.com/tianluyuan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@998413c14f0febbb709e22386930b6d242c3937e -
Trigger Event:
push
-
Statement type:
File details
Details for the file fb8-1.2.8-py3-none-any.whl.
File metadata
- Download URL: fb8-1.2.8-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.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4fb417795ee88c435da360c37a979f73a4bd806149fbc748f51a6911e03103dc
|
|
| MD5 |
afdacfd456be15c0fbbb11a518779b70
|
|
| BLAKE2b-256 |
693616b782145164a1be83cd940d3fcc95b76e7e7751b0532d24b37cff29125f
|
Provenance
The following attestation bundles were made for fb8-1.2.8-py3-none-any.whl:
Publisher:
publish.yml on tianluyuan/sphere
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fb8-1.2.8-py3-none-any.whl -
Subject digest:
4fb417795ee88c435da360c37a979f73a4bd806149fbc748f51a6911e03103dc - Sigstore transparency entry: 546931884
- Sigstore integration time:
-
Permalink:
tianluyuan/sphere@998413c14f0febbb709e22386930b6d242c3937e -
Branch / Tag:
refs/tags/1.2.8 - Owner: https://github.com/tianluyuan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@998413c14f0febbb709e22386930b6d242c3937e -
Trigger Event:
push
-
Statement type: