Code Monkey home page Code Monkey logo

nexstar-control's Introduction

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

nexstar-control's People

Contributors

tristeng avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.