Spacecraft coordinates.
Project description
scoords
The scoords library defines an astropy custom coordinate frame. This allows to specify coordinates relative to the local spacecraft coordinates and transform them to any other system using astropy's machinery.
SkyCoord objects are instantiated by passing a location with specified units and a coordinate frame. Use SpacecraftFrame to specify a coordinate in the reference system attached to the spacecraft:
import astropy.units as u
from astropy.coordinates import SkyCoord
from scoords import SpacecraftFrame
c = SkyCoord(lon = 45*u.deg, lat = 10*u.deg, frame = SpacecraftFrame())
This allows you to know the reference frame of the coordinate, e.g.
c.frame
<SpacecraftFrame Coordinate (attitude=None, obstime=None, location=None): (lon, lat) in deg
(45., 10.)>
However, in order to transform it into other coordinate system you need to specify the orientation of the spacecraft with respect to an inertial reference frame --i.e. the attitude
from scoords import Attitude
attitude = Attitude.from_rotvec(45*u.deg*[0,0,1], frame = 'icrs')
c = SkyCoord(lon = 0*u.deg, lat = 0*u.deg, frame = SpacecraftFrame(attitude = attitude))
There are class methods to specify the orientation in any of the following formats:
- A rotation matrx
- A vector co-directional to the axis of rotation
- A quaternion
- A
scipy'sRotationobject - The direction the spacecraft coordinates axes point to
Once the attitude is specified, we can transform from/to any other frame supported by astropy
c.transform_to('icrs')
<SkyCoord (ICRS): (ra, dec) in deg
(45., 0.)>
c.transform_to('galactic')
<SkyCoord (Galactic): (l, b) in deg
(176.96129126, -48.90264434)>
Although it does not play a role in this particular coordinates transformation, the observation time and location can also be specified in case it is needed by any other algorithm:
from astropy.time import Time
from astropy.coordinates import EarthLocation
frame = SpacecraftFrame(attitude = attitude,
obstime = Time('2026-01-01T00:00:00'),
location = EarthLocation(lon = 10*u.deg, lat = 46*u.deg, height = 400*u.km))
c = SkyCoord(lon = 45*u.deg, lat = 10*u.deg, frame = frame)
c.frame.obstime
<Time object: scale='utc' format='isot' value=2026-01-01T00:00:00.000>
c.frame.location.geodetic
GeodeticLocation(lon=<Longitude 10. deg>, lat=<Latitude 46. deg>, height=<Quantity 400. km>)
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scoords-0.0.3.tar.gz.
File metadata
- Download URL: scoords-0.0.3.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02e2af135e22fe00829a1ba8a21f663b9491e5654c4b7e15dd78d72ad9638f27
|
|
| MD5 |
9c6896b6276677b08bb237e9c4c229ae
|
|
| BLAKE2b-256 |
650636715317321651fa2a3bb618281888b721058df7cccd24a75d41adcc9cc8
|
File details
Details for the file scoords-0.0.3-py3-none-any.whl.
File metadata
- Download URL: scoords-0.0.3-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed6be76363b6d2c7fd3854b8c9f56c2c126f34b19723f6b35be127333b78c303
|
|
| MD5 |
b6426b8cfb74efc96d5e9f69a8273910
|
|
| BLAKE2b-256 |
4da8a8fd512e44f4c6f2574395a189f9aaf1b1d0fb1c7036a29e79f184858e9e
|