Skip to main content

maglimit

codeastro pypi DOI CI Documentation Status

A package to determine observability of an astronomical object using its magnitude and telescope's limiting magnitude. As a rule of thumb, the limiting magnitude of a telescope depends on the aperture of mirror / lens:

$$L_{mag} = 2 + 5\log{D_0}$$ Where $D_0$ is the aperture in mm. lim_mag() uses this formula and ignores the sky.

Since 0.3, maglimit can also tell you how well a deep-sky object will show, offline, with a graded verdict (easy, moderate, challenging, very hard or not visible), the best eyepiece and the numbers behind it. It uses the contrast-threshold model of Crumey (2014), MNRAS 442, 2600, a fit to Blackwell's (1946) measurements of the dark-adapted eye, tested against historical telescope observations. sky_lim_mag(), the star limit under a given sky, uses the same model, so its numbers differ from 0.2.

Treat the answers as a guide: eyes vary by half a magnitude or more. The model's limits:

  • it treats objects as evenly bright. Galaxies, globular clusters and M42 are also tested as a bright core holding half the light in a quarter of the diameter, a calibrated rule rather than physics from the paper;
  • filters aren't modelled, and catalogue magnitudes for nebulae are unreliable, so nebulae get a low-confidence answer;
  • objects are assumed to be at the zenith, with no Moon, until 0.4.

Installation

Requires Python 3.10+.

pip install maglimit

or, in a uv project:

uv add maglimit

Quick start

import maglimit as ml

scope = ml.Telescope(aperture=100, fstop=4.5)   # 100 mm f/4.5
scope.lim_mag()                                  # 12.0
scope.magnification(f_eyepiece=25)               # 18.0
ml.is_object_observable("M31", scope.lim_mag())  # True (queries NED)
ml.smallest_scope("NGC 244", fs=4.5)             # (13.83, <Quantity 232.27 mm>, <Quantity 1045.22 mm>)

site = ml.Site(bortle=5)                         # or sqm=20.1
scope.sky_lim_mag(site)                          # 10.73, at low power
scope.sky_lim_mag(site, eyepiece=10)             # 11.72
scope.exit_pupil(25)                             # 5.56 (mm)
scope.dawes_limit()                              # 1.16 (arcseconds)

ml.find_object("andromeda galaxy")               # CatalogueObject(name='NGC 224', messier=31, ...)
result = ml.explain("M33", ml.Telescope(200, 5), ml.Site(bortle=7))
result["verdict"], result["margin"]              # ('challenging', 0.82)

From the command line, for a summary of a telescope and its eyepieces:

maglimit scope --aperture 200 --fstop 5 --eyepieces 32,25,10 --bortle 5

To check one object, with no network needed:

maglimit check M33 --aperture 200 --fstop 5 --bortle 7

Add --json to either command to get the same numbers as JSON.

Development

git clone https://github.com/iamstarstuff/maglimit
cd maglimit
uv sync --all-groups
uv run pytest                     # add -m "not network" to skip the live NED test
uv run sphinx-build -b html docs docs/_build/html

Releases are published to PyPI from GitHub releases via trusted publishing (see .github/workflows/publish.yml).

Tutorials

You can find the tutorial here: docs/Tutorial/limiting_magnitude.ipynb

Data and license

maglimit is MIT licensed. The bundled catalogue, maglimit/data/openngc.csv, is derived from OpenNGC by Mattia Verga and is shared under CC-BY-SA-4.0; see maglimit/data/LICENSE-OpenNGC. Seven Messier magnitudes missing from OpenNGC are filled from Wikipedia's List of Messier objects (maglimit/data/corrections.csv). Rebuild it with uv run python scripts/build_catalogue.py.

Future Goals:

  • We use astroquery.ipac.ned catalogue to query the object by Messier and NGC name. Further we plan to add cross-catalogue query feature.

Metadata

Release files for maglimit 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for maglimit 0.3.0
File Size Uploaded Provenance Actions
maglimit-0.3.0.tar.gz 292.0 kB Without provenance Details for maglimit-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for maglimit 0.3.0
File Interpreter ABI Platform Actions
maglimit-0.3.0-py3-none-any.whl Python 3 none any Details for maglimit-0.3.0-py3-none-any.whl

Total release size: 578.6 kB

Release files / maglimit-0.3.0.tar.gz

Download URL maglimit-0.3.0.tar.gz
Size 292.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6169c1f5826b18bfd415cd5579d08c49d3b372d74c2b54335b60e008fdc14993
BLAKE2b-256 checksum
How to use checksums
1eb3ab1d3001e8e6762a114e73e5d521b0ff1da509fe2c86a0ad29b52a043a19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / maglimit-0.3.0-py3-none-any.whl

Download URL maglimit-0.3.0-py3-none-any.whl
Size 286.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f91460bb386262d0f2ecdb2c79fd0e6f48158500d13237e388f522fd16165ea1
BLAKE2b-256 checksum
How to use checksums
33a4dfb2b3d94a8ed763a2b6d351c753f96e08bb8528ea5dd59d71f55577c062
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for maglimit 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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