Skip to main content

A library that can be used to communicate and control Celestron NexStar telescope devices.

Project description

NexStar Control

Tests

This is a python 3.11+ library that can be used to communicate and control Celestron NexStar telescope devices. The library does not have support for GPS units or CGE mounts (but could easily be added).

This library was created as an exercise to see if I could image the ISS with my telescope.

To see the latest features and updates, please see the CHANGELOG. If you would like to request a feature or report a bug, please submit directly on the issues tracker on GitHub.

Installation

To install this package, you can use pip:

pip install nexstar-control

or with Poetry

poetry add nexstar-control

Dependencies

This package has the following dependencies:

API Reference

This package was created using the documentation found on the NexStar Resrouce Site.

Usage

For a more complete example of how to use this library, see the sample.py file in the root of this repository.

import datetime
from zoneinfo import ZoneInfo

from nexstar_control.device import NexStarHandControl, TrackingMode, LatitudeDMS, LongitudeDMS

hc = NexStarHandControl("COM1")
if not hc.is_connected():
    print("Failed to connect to device")
    exit(1)

# get the current position of the telescope in ra/dec or alt/az coordinates
ra, dec = hc.get_position_ra_dec()
alt, az = hc.get_position_alt_az()

# issue go to commands in ra/dec coordinates or alt/az coordinates
hc.goto_ra_dec(180, 0)
hc.goto_alt_az(90, 0)

# turn the telescope tracking mode off when doing slewing, but save the current mode to restore later
current_tracking_mode = hc.get_tracking_mode()
hc.set_tracking_mode(TrackingMode.OFF)

# slew the telescope at fixed rates (where negative values indicate the opposite direction)
hc.slew_fixed(9, -9)

# slew the telescope at variable rates (where negative values indicate the opposite direction)
hc.slew_variable(15000, -15000)

# restore the tracking mode
hc.set_tracking_mode(current_tracking_mode)

# set the location and time of the telescope
hc.set_location(lat=LatitudeDMS.from_decimal(49.2849), lng=LongitudeDMS.from_decimal(-122.8678))
dt = datetime.datetime.now(tz=ZoneInfo("America/Vancouver"))
hc.set_time(dt)

Development

This package usings Poetry for dependency management and packaging. To install the development dependencies, run the following command:

poetry install

Formatting

This package uses ruff for code formatting and linting. To format the code, run the following command:

poetry run ruff format

To lint the code, run the following command:

poetry run ruff check --fix

Pre-commit

This package uses pre-commit to run the formatting and linting checks before committing. To install the pre-commit hooks, run the following command:

poetry run pre-commit install

Testing

This package uses pytest for testing. To run the tests, run the following command:

poetry run pytest

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgements

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

nexstar_control-1.0.3.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

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

nexstar_control-1.0.3-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file nexstar_control-1.0.3.tar.gz.

File metadata

  • Download URL: nexstar_control-1.0.3.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nexstar_control-1.0.3.tar.gz
Algorithm Hash digest
SHA256 e74b2d43f493011d7a5e299b17d3228bdfd8d5a3e6c6ff4ac0c3b8d7d3c9f9ba
MD5 a274d1ca012a68b02c3d79e0c8d77894
BLAKE2b-256 d1d5fc6e9dad63faa0f87cabcbf1c8e82b58aa381caa4e3f7db841a200ca2e19

See more details on using hashes here.

Provenance

The following attestation bundles were made for nexstar_control-1.0.3.tar.gz:

Publisher: release.yml on tristeng/nexstar-control

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

File details

Details for the file nexstar_control-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for nexstar_control-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6c45ae638b85789f547ff00ae4338e471f4ae7aa987399ff25c58572d44083d8
MD5 1ea9c846e6f4a5d1f4d83dfef6ba2dfe
BLAKE2b-256 403181aeb57285e7e1a7cfe1fbe61cbcd0258deeaebf622b80f0eec280030e2d

See more details on using hashes here.

Provenance

The following attestation bundles were made for nexstar_control-1.0.3-py3-none-any.whl:

Publisher: release.yml on tristeng/nexstar-control

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