A library that can be used to communicate and control Celestron NexStar telescope devices.
Project description
NexStar Control
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
- NexStar Resource Site
- website hosted by Michael Swanson
- Celestron
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
File details
Details for the file nexstar_control-1.0.0.tar.gz
.
File metadata
- Download URL: nexstar_control-1.0.0.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4f13d0df7649d0512d358116a158a3fa1ad38072dae020689b69cdb2e278eff |
|
MD5 | 21eed575f97e48f3e58f0ce9b277e597 |
|
BLAKE2b-256 | 0b804e682c0949ee164e3f5f6e4a9c298f1803d25cb5b5d399fc0312616f07a5 |
File details
Details for the file nexstar_control-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: nexstar_control-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56e1ca6f55705ac9475a7e7b7b79dfb0a5284d9a242443b8f4ab42ca51105658 |
|
MD5 | 9e920449f4c0a5bb31a7b4929872f340 |
|
BLAKE2b-256 | a313545c2f667de640a65e013326166b262afc4f1ed7faf8c751eced9fd5f89a |