Skip to main content

Astronomical observation logging software

Project description

pydeepskylog User Guide

This guide provides practical examples for common use cases with the pydeepskylog package.

Table of Contents


Description

A Python package with utilities for deep-sky observations. This version of pydeepskylog provides the following functionality:

  • Calculating of contrast reserve and optimal detection magnification for deep-sky objects.
  • Conversion of magnitudes to SQM value and bortle scale and vice versa.
  • Fetching instruments, eyepieces, lenses, and filters from a DeepskyLog user account.

Installation

Install via pip:

pip install pydeepskylog

Development dependencies can be installed with:

pip install -e .[dev]

Basic Usage

Import the main modules:

import pydeepskylog.magnitude as mag
import pydeepskylog.contrast_reserve as cr

Magnitude and Sky Brightness Conversions

Convert NELM to SQM:

sqm = mag.nelm_to_sqm(6.2)
print(f"SQM: {sqm:.2f}")

Convert SQM to Bortle scale:

bortle = mag.sqm_to_bortle(21.0)
print(f"Bortle class: {bortle}")

Contrast Reserve Calculation

Calculate the contrast reserve for an object:

reserve = cr.contrast_reserve(
    sqm=21.0,
    telescope_diameter=200,  # mm
    magnification=100,
    surf_brightness=None,
    magnitude=10.5,
    object_diameter1=120,  # arcsec
    object_diameter2=60    # arcsec
)
print(f"Contrast reserve: {reserve:.2f}")

Optimal Detection Magnification

Find the best magnification for detection:

magnifications = [50, 75, 100, 150, 200]
optimal = cr.optimal_detection_magnification(
    sqm=21.0,
    telescope_diameter=200,
    surf_brightness=None,
    magnitude=10.5,
    object_diameter1=120,
    object_diameter2=60,
    magnifications=magnifications
)
print(f"Optimal magnification: {optimal}")

DeepskyLog API Integration

Fetch user instruments:

from pydeepskylog.deepskylog_interface import dsl_instruments

instruments = dsl_instruments("your_username")
for inst_id, inst in instruments.items():
    print(inst["name"], inst["diameter"])

The API endpoints are documented in the API Endpoints section.

Validation Utilities

Validate a positive number:

from pydeepskylog.validation import validate_positive

validate_positive(42, "Telescope diameter")

Logging Configuration

Set up logging for debugging:

from pydeepskylog.logging_config import configure_logging
import logging

configure_logging(logging.DEBUG)

API

Documentation for the API is available at Read the Docs.

Astronomical background

Contrast Reserve

The contrast reserve is a measure of the difference in brightness between the object and the sky background. It is calculated as the difference between the object's surface brightness and the sky background brightness. The contrast reserve is a useful metric for determining the visibility of deep sky objects through a telescope.

The higher the contrast reserve, the easier it is to see the object. The following table can be used to interpret the contrast reserve:

Contrast Reserve Visibility Typical color
< -0.2 Not visible dark grey
-0.2 < CR < 0.1 Questionable light grey
0.1 < CR < 0.35 Difficult dark red
0.35 < CR < 0.5 Quite difficult to see light red
0.5 < CR < 1.0 Easy to see dark green
1.0 < CR Very easy to see light green

The contrast reserved is calculated for the object as a whole. Smaller details in the object might be visible even if the contrast reserve of the object as a whole is below -0.2. This is certainly the case for galaxies, where the core might be much brighter than the outer regions.

It is important to note that the contrast reserve is a theoretical value and that the actual visibility of an object will depend on a number of other factors, including the observer's experience, the transparency of the sky, and the seeing conditions. The contrast reserve is just a guideline.

The calculation of the contrast reserve depends heavily on the quality of the object database. A small error in the object's magnitude or size can lead to a large error in the contrast reserve.

Only if the observer tries to observe the object, he/she will know if the object is visible or not.

Optimal Detection Magnification

The optimal detection magnification is the magnification at which the object is most easily visible. Take into account that the optimal detection magnification is not the same as the best magnification for observing details in an object, but for the object as a whole.

Magnitudes

Conversion methods are provided to convert magnitudes to SQM value and bortle scale and vice versa.

Different formulae are available to convert magnitudes to SQM value. The formula used here converts a sqm value of 22.0 to a naked eye limiting magnitude of 6.6. The faintest star offset can be given to the formula. If taking a value of -1.4 for the faintest star offset, the formula converts a sqm value of 22.0 to a naked eye limiting magnitude of 8.0.

Measurement Description Conversion Functions
NELM Naked Eye Limiting Magnitude, the faintest star visible to the naked eye under ideal conditions. nelm_to_sqm(), nelm_to_bortle()
SQM Sky Quality Meter, a measure of sky brightness in magnitudes per square arcsecond. sqm_to_nelm(), sqm_to_bortle()
Bortle Scale A qualitative scale that classifies the night sky based on light pollution and visibility. bortle_to_nelm(), bortle_to_sqm()

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. See CONTRIBUTING.md for details on how to contribute.

License

GPL-3.0

Changelog

See CHANGELOG.md for a detailed list of changes and updates to the package.

Acknowledgements

This package is inspired by the DeepskyLog website and the code is based on the formulas used in DeepskyLog. We would like to thank the DeepskyLog developers team.

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

pydeepskylog-1.6.tar.gz (37.9 kB view details)

Uploaded Source

Built Distribution

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

pydeepskylog-1.6-py3-none-any.whl (39.8 kB view details)

Uploaded Python 3

File details

Details for the file pydeepskylog-1.6.tar.gz.

File metadata

  • Download URL: pydeepskylog-1.6.tar.gz
  • Upload date:
  • Size: 37.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pydeepskylog-1.6.tar.gz
Algorithm Hash digest
SHA256 ddeae6d004817cfb50d5c9e0cecaa4654ae72a82cd201bbc5350fa880e1e3e61
MD5 6b38e9d951b3888a4e8ee5a157b016f5
BLAKE2b-256 45edea27d8e554cce16ba402aa349251c9d1bbc269efa93a9546a389b9ea1e4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydeepskylog-1.6.tar.gz:

Publisher: publish.yml on DeepskyLog/pydeepskylog

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

File details

Details for the file pydeepskylog-1.6-py3-none-any.whl.

File metadata

  • Download URL: pydeepskylog-1.6-py3-none-any.whl
  • Upload date:
  • Size: 39.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pydeepskylog-1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 f4fa53b1f980a61846a3e79fa8d4134f809703d9ac346dc98bfc49091ee237f9
MD5 dc748ec75e391c5b934d4b7236eb0510
BLAKE2b-256 9d00e7f11ab824ef760fe22c93012b90631d8772c7af3a58d22f15d0b383f51e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydeepskylog-1.6-py3-none-any.whl:

Publisher: publish.yml on DeepskyLog/pydeepskylog

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

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