Skip to main content

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's Rotation object
  • 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scoords-0.0.2.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

scoords-0.0.2-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file scoords-0.0.2.tar.gz.

File metadata

  • Download URL: scoords-0.0.2.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/49.6.0.post20210108 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.6

File hashes

Hashes for scoords-0.0.2.tar.gz
Algorithm Hash digest
SHA256 ba194a29e10feee20aa6d7b4b8537757690e12075f8bb675790c8f75cc44a4d8
MD5 ab30d3b1cc3f095662d9124130f16c39
BLAKE2b-256 e203e35b2ac977146d2fcc5c249d1b851a5f45cdda0d80917197241b1dca1303

See more details on using hashes here.

File details

Details for the file scoords-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: scoords-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/49.6.0.post20210108 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.6

File hashes

Hashes for scoords-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3be806aec1ab327b62b5d2ba6d017a33276cd8afb315d614c1984effa8d5d23e
MD5 f999421fba3878ce13ac62e8de0dc019
BLAKE2b-256 de76ed13df72c91825eae0af38255f62dd20bad157059fff8b36f8b257d2c5bb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page