Skip to main content

Celerity is a lightweight, zero-dependency and type-safe Python library for astronomical calculations.

Project description

Celerity

Celerity is a lightweight, research-grade, zero-dependency type-safe Python library for astronomical calculations to plan your observations. It's only dependency is the Python 3.11+ standard library.

It has been designed to be independent of any other popular astronomical libraries, with a focus on providing a simple and intuitive API for performing common astronomical calculations.

N.B. This project is currently in the early stages of development and is not yet ready for production use.


Usage

Installation

Celerity can be installed using pip:

pip install celerity

or poetry:

poetry add celerity

API

The API has been designed to be written in an idiomatic and natural way for English speakers, as well as idiomatic to Python.

It has been specifically designed to only depend on the core set of Python modules, such that it is not strictly dependent on other popular astronomical libraries, e.g., astropy (although it can compliment the usage of these libraries).

It's important to note that the API does not perform string parsing of times and coordinates, but instead requires the user to provide the correct data types. This is to ensure that the API is type-safe and that the user is aware of the data types being used at all times.

For example, to find out the horizontal coordinate for the star Betelgeuse on the 14th May 2021 at 12:00 UTC, at Mauna Kea, Hawaii, you would write:

from datetime import datetime, timezone

from celerity import Observer, Time

# Mauna Kea, Hawaii:
observer = Observer(
    latitude=19.82,
    longitude=-155.47,
    elevation=4205,
)

# Time of observation in UTC:
time = Time(
    when=datetime(2021, 5, 14, 12, 0, 0, tzinfo=timezone.utc)
)

# Provide a Sky target in equatorial coordinates at epoch J2000:
betelgeuse = { ra: 88.792938, dec: 7.407064 }

# Observe the target:
betelgeuse = observer.at(time).observe({ ra: 88.792938, dec: 7.407064 })

# Get the horizontal coordinates:
{ alt, az } = betelgeuse.altAz()

# What is the Local Sidereal Time at the time of observation?
lst = observer.at(time).LST()

# What is the Julian Date at the time of observation?
jd = observer.at(time).JD()

Package Development

Project Requirements

Installing Dependencies

The Celerity project manages Python package dependencies using Poetry. You'll need to follow the instructions for installation there.

Then you can start a shell session with the new environment with:

$ poetry shell

N.B. For development with vscode you will need to run the following command:

$ poetry config virtualenvs.in-project true

This will installed the poetry .venv in the root of the project and allow vscode to setup the environment correctly for development.

To start development, install all of the dependencies as:

$ poetry install

N.B. Ensure that any dependency changes are committed to source control, so everyone has a consistenct package dependecy list.

Local Development

The Celerity development stack can be built with the following docker compose command, with the $INSTALL_DEV build environment argument*.

$ docker compose -f local.yml build --build-arg INSTALL_DEV="true"

* This is required to install the development dependencies in the container.

Then start the development stack with a running shell session with:

$ docker compose -f local.yml run app bash

N.B. The docker compose command will build the development stack if it has not been built already.

Running Tests

To run the tests, please ensure you have followed the steps for building the development server:

The Celerity development stack can be built with the following docker compose command, with the $INSTALL_DEV build environment argument*.

$ docker compose -f local.yml build --build-arg INSTALL_DEV="true"

You can then run the pytest suite using the following command:

$ docker compose -f local.yml exec api pytest

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

celerity-0.3.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

celerity-0.3.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file celerity-0.3.0.tar.gz.

File metadata

  • Download URL: celerity-0.3.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.3 Linux/5.15.0-1036-azure

File hashes

Hashes for celerity-0.3.0.tar.gz
Algorithm Hash digest
SHA256 09c214467e1b383484aad739d367b764bd26cb4a505c3fd2f77f11b508fd4cc6
MD5 70f1b96f0d706899ec2def965167943c
BLAKE2b-256 09ef016515d2903d848faaa00985270726af7630693cf3335038dfebbd27572a

See more details on using hashes here.

File details

Details for the file celerity-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: celerity-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.3 Linux/5.15.0-1036-azure

File hashes

Hashes for celerity-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0dd7f2bd8bdc80c02e06db9bc42d54195b7fc3af21f349ea23b5e7115b6c19bf
MD5 e5f909d623ae49ce43f03c9d0d30e1b2
BLAKE2b-256 f4d02ace12d8c3c0e9f076ca850f7d244b5dd2ebfacb32898ca49b9563f02c5f

See more details on using hashes here.

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