Skip to main content

A vectorized implementation of the Coleman et al. (2020) Milky Way bulge density model.

Project description

Coleman Bulge Density Model

A vectorized implementation of the Coleman et al. (2020) Milky Way bulge density model.

Features

  • Hybrid Evaluation Engine: Rapidly evaluates density using SciPy's RegularGridInterpolator for coordinates within a pre-computed grid. It gracefully falls back to an analytical "SX" model for extrapolation outside the grid bounds.
  • Vectorized Processing: Fully vectorized to efficiently process large NumPy arrays of coordinates at once.
  • Flexible Coordinate Systems: Accepts inputs in either Sun-centered spherical coordinates (r, lat, lon) or Galactic Cartesian coordinates (x, y, z).
  • Pre-instantiated: The package automatically instantiates the model and loads the pre-computed grid data (model_data.npz) upon import, making it ready to use immediately.

Requirements

  • Python >= 3.8
  • NumPy >= 1.20.0
  • SciPy >= 1.7.0

Installation

You can install this package locally using pip:

pip install coleman_bulge_density_model

Examples

import numpy as np
from coleman_bulge_density import bulge_density_model

# 1. Using Sun-centered spherical coordinates (r, lat, lon)
density, in_bounds = bulge_density_model(r=8.0, lat=0.0, lon=0.0)

# 2. Using Galactic Cartesian coordinates (x, y, z)
# Note: Do not mix coordinate systems.
density, in_bounds = bulge_density_model(x=8.0, y=0.0, z=0.0)

# 3. Processing large arrays
r_arr = np.linspace(0, 15, 100)
lat_arr = np.zeros(100)
lon_arr = np.zeros(100)
densities, bounds = bulge_density_model(r=r_arr, lat=lat_arr, lon=lon_arr)

Hexagonal bin plot showing the spatial distribution of Milky Way bulge density samples across the celestial sphere. The plot uses a color gradient to represent density values, with brighter hexagons indicating higher density regions concentrated toward the galactic center and plane. The visualization demonstrates the model's effectiveness in capturing the bulge structure in Sun-centered coordinates.

Project details


Download files

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

Source Distribution

coleman_bulge_density_model-0.2.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

coleman_bulge_density_model-0.2.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file coleman_bulge_density_model-0.2.0.tar.gz.

File metadata

File hashes

Hashes for coleman_bulge_density_model-0.2.0.tar.gz
Algorithm Hash digest
SHA256 033f5dce4ca8fdc1cb8ca993deb16542d06e71601df57f418b77014d26e76bdf
MD5 ca9417ecc925d85d33ff847bf3275dff
BLAKE2b-256 7fa05d81fed1dd31a3d773d3d758195a9d27ccac4b31f8bc7799d90651b4828c

See more details on using hashes here.

File details

Details for the file coleman_bulge_density_model-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for coleman_bulge_density_model-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 934e5f4049a470f9ffba5491a5504119f59c0234089767d707fd8142ccb8a4cf
MD5 14491a884e7cd01584b6f52a20d4cf09
BLAKE2b-256 a63cef807fb92da7466e18da8aa15aef665676e655bb56e297029f3f868e7c78

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page