Package: 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.UsageInstallationCelerity can be installed usingpip:pip install celerityorpoetry:poetry add celerityAPIThe 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:fromdatetimeimportdatetime,timezonefromcelerityimportObserver,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 an equatorial target in equatorial coordinates at epoch J2000 in units of degrees: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()Notes & CaveatsCelerity is designed such that fundamental SI units of measurement are used, e.g., degrees, metres, seconds, etc. This is to ensure that the API is as accurate as possible, and that the user is aware of the units being used at all times.TheObserverclass requires the user to provide the latitude and longitude in degrees, and the elevation in metres. Latitude is positive for the northern hemisphere, and negative for the southern hemisphere between -90° at the southern pole and +90° at the northern pole. Longitude is always positive for the eastern hemisphere (east of the Prime Meridian), and negative for the western hemisphere (west of the Prime Meridian) representing a longitude between -180° and +180°.TheTimeclass requires the user to provide the time in UTC, and not in any other timezone. The user can, once theTimeobject has been created, convert the time to any other timezone using the provided class methods.TheTargetclass requires the user to provide the right ascension and declination in degrees (and not in hours and degrees).Package DevelopmentProject RequirementsPython3.11.*Docker.Docker Compose.Poetryfor Python package and environment management.Installing DependenciesThe Celerity project manages Python package dependencies usingPoetry. You'll need to follow the instructions for installation there.Then you can start a shell session with the new environment with:$poetryshellN.B.For development with vscode you will need to run the following command:$poetryconfigvirtualenvs.in-projecttrueThis will installed the poetry.venvin the root of the project and allow vscode to setup the environment correctly for development.To start development, install all of the dependencies as:$poetryinstallN.B.Ensure that any dependency changes are committed to source control, so everyone has a consistenct package dependecy list.Local DevelopmentThe Celerity development stack can be built with the followingdockercomposecommand, with the$INSTALL_DEVbuild environment argument*.$dockercompose-flocal.ymlbuild--build-argINSTALL_DEV="true"*This is required to install the development dependencies in the container.Then start the development stack with a running shell session with:$dockercompose-flocal.ymlrunappbashN.B.Thedocker composecommand will build the development stack if it has not been built already.Running TestsTo run the tests, please ensure you have followed the steps for building the development server:The Celerity development stack can be built with the followingdockercomposecommand, with the$INSTALL_DEVbuild environment argument*.$dockercompose-flocal.ymlbuild--build-argINSTALL_DEV="true"You can then run the pytest suite using the following command:$ docker compose -f local.yml exec api pytest