Python tools for working with Orbit Ephemeris Messages (OEMs).

Overview

Python Orbit Ephemeris Message tools

Python tools for working with Orbit Ephemeris Messages (OEMs).

Development Status

GitHub Release GitHub

GitHub last commit Pipeline Status Coverage Status Documentation Status

Installation

The oem package is available through pip.

pip install oem

Usage

The OrbitEphemerisMessage class is the primary interface for OEM Files.

from oem import OrbitEphemerisMessage

ephemeris = OrbitEphemerisMessage.open("input_file.oem")

Each OEM is made up of one or more segments of state and optional covariance data. The OrbitEphemerisMessage class provides iterables for both.

for segment in ephemeris:
    for state in segment:
        print(state.epoch, state.position, state.velocity, state.acceleration)

    for covariance in segment.covariances:
        print(covariance.epoch, covariance.matrix)

All vectors and matrices are numpy arrays.

It is also possible to retrieve a complete list of states and covariances through the .states and .covariances properties. These attributes streamline interaction with single-segment ephemerides.

for state in ephemeris.states:
    print(state.epoch, state.position, state.velocity)
for covariance in ephemeris.covariances:
    print(covariance.epoch, covariance.matrix)

To sample a state at an arbitrary epoch, simply call the ephemeris with an astropy Time object

epoch = Time("2020-01-01T00:00:00", scale="utc")
sampled_state = ephemeris(epoch)

Note that this type of sampling is only supported if the time system of the target ephemeris is supported by astropy Time objects. The .steps method of both OrbitEphemerisMessage and EphemerisSegment objects enables iterable, equal-time sampling of ephemeris data. The following example samples an OEM at a 60-second interval.

for state in oem.steps(60)
    pass

The above example works for both single- and multi-segment OEMs, however the step sizes may vary at the boundary of the segments. To get consistent step sizes with multiple segments, use the segment interface directly.

for segment in oem:
    for state in segment.steps(60):
        pass

The OrbitEphemerisMessage facilitates writing of OEMs. To save an already-open OEM, use .save_as:

ephemeris.save_as("output.oem", file_format="xml")

To convert an ephemeris from one type to another, use the .convert class method.

OrbitEphemerisMessage.convert("input_file.oem", "output_file.oem", "kvn")

Reference Standards

This implementation follows the CCSDS recommended standards for Orbit Data Messages.

[1] Orbit Data Messages, CCSDS 502.0-B-2, 2012. Available: https://public.ccsds.org/Pubs/502x0b2c1e2.pdf

[2] XML Specification for Navigation Data Messages, CCSDS 505.0-B-1, 2010. Available: https://public.ccsds.org/Pubs/505x0b2.pdf

Comments
  • Namespaced xml

    Namespaced xml

    I prepared this modification in order to handle the reading of an OEM file in XML format that has a namespace in it. The modification will remove from the tag the namespace, it is transparent for XML files without namespace.

    opened by TommasoPino 6
  • Sample OEMs do not work with oacmpy

    Sample OEMs do not work with oacmpy

    Describe the bug I've originally came across your samples folder in a google search when looking for other example OEM other than the ones provided in ccsds2czml: https://gitlab.com/jorispio/ccsds2czml/-/tree/master/example

    All OEM files in samples/real threw a generic datetime microsecond error, but i could not discern any differences between your OEMs and the sample_OEM generated by ccsds2czml. Their sample_OEM worked fine. Below is the traceback error:

    C:\Users\khoohuibo\Desktop\ccsds2czml-master>python -m oacmpy -i LEO_10s.oem -o one_sat.czml -v
    Input File : LEO_10s.oem
    Output File: one_sat.czml
      File:  LEO_10s.oem
    Traceback (most recent call last):
      File "C:\Users\Hubert Khoo\.conda\envs\arcsim\lib\runpy.py", line 193, in _run_module_as_main
        "__main__", mod_spec)
      File "C:\Users\Hubert Khoo\.conda\envs\arcsim\lib\runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "C:\Users\Hubert Khoo\.conda\envs\arcsim\lib\site-packages\oacmpy\__main__.py", line 5, in <module>
        main(sys.argv[1:])
      File "C:\Users\Hubert Khoo\.conda\envs\arcsim\lib\site-packages\oacmpy\oem2czml.py", line 78, in main
        _ccsds2czml(inputfile, outputfile, verbose)
      File "C:\Users\Hubert Khoo\.conda\envs\arcsim\lib\site-packages\oacmpy\oem2czml.py", line 35, in _ccsds2czml
        print(" Simulation time span: {} - {}".format(start, end))
      File "C:\Users\Hubert Khoo\.conda\envs\arcsim\lib\site-packages\oacmpy\datetime\Date.py", line 297, in __str__
        return self.strftime(ISO8601_FORMAT_Z)
      File "C:\Users\Hubert Khoo\.conda\envs\arcsim\lib\site-packages\oacmpy\datetime\Date.py", line 291, in strftime
        return self.datetime.strftime(fmt)
      File "C:\Users\Hubert Khoo\.conda\envs\arcsim\lib\site-packages\oacmpy\datetime\Date.py", line 251, in datetime
        self._datetime = datetime(year=year, month=month, day=day, hour=h, minute=m, second=s, microsecond=ms)
    ValueError: microsecond must be in 0..999999
    

    I have attached the sample_object.oem file generated for easier reference sample_object.zip

    Steps to Reproduce

    1. Download both repositories
    2. Run the following code in the root directory of ccsds2czml-master to generate a sample_OEM file
    python -m example.single.simple_oem
    
    1. Generate CZML file using sample_object.oem file generated in root directory of ccsds2czml-master, using the code below
    python -m oacmpy -i sample_object.oem -o one_sat.czml -v
    
    1. Visualize using Cesium Viewer
    2. Attempt to generate CZML file by using OEM file from oem-master/samples/real, (Used LEO_10s and GEO_20s)
    3. Obtain traceback error as described
    # Insert reproducing code snippet here
    

    Python/Package Version Information Python: [e.g. 3.5.1] oem: [e.g. 1.0.0]

    bug 
    opened by khoohuibo 2
  • Importing OEM data message with long trajectory crashes due to unbounded memory usage of Regex

    Importing OEM data message with long trajectory crashes due to unbounded memory usage of Regex

    Describe the bug When importing an OEM file in KVN format with a size of 450 MB which contains about 7 years of trajectory data the regex match statement in _from_kvm_oem() immediately hogs > 16GB RAM and gets killed. Maybe a transition to a slower, but more stable state machine processing line by line as in https://gitlab.com/jorispio/ccsds2czml. Although the parsing algorithm there is also behaving poorly with multiple segments.

    I've tried to use google/re2 python wrappers for a more efficient processing of the file, but still fails. I'll take a look on rewriting the parser.

    Edit: only the match() call seems to create issues, find_all() and running the match for the header section separately works fine.

    bug 
    opened by noc0lour 2
  • Namespaced xml

    Namespaced xml

    I prepared this modification in order to handle the reading of an OEM file in XML format that has a namespace in it. The modification will remove from the tag the namespace, it is transparent for XML files without namespace.

    opened by TommasoPino 1
  • Add realistic ephemeris compare sample

    Add realistic ephemeris compare sample

    This branch implements a test demonstrating compare between two non-identical ephemerides with reference results taken from an independent software package.

    enhancement 
    opened by bradsease 0
  • Add segment comparison tools

    Add segment comparison tools

    Add EphemerisSegment.__sub__ method to support EphemerisSegment comparisons. Subtraction will return a SegmentCompare instance with steps method for sampling the compare segment.

    enhancement 
    opened by bradsease 0
  • Add state comparison tools

    Add state comparison tools

    Add State.__sub__ method to support State comparisons. Subtraction will return a StateCompare instance with range, range_rate, position, and velocity attributes.

    enhancement 
    opened by bradsease 0
  • Update package metadata

    Update package metadata

    This change updates the package setup.py to better communicate the details and dependencies of the package. The requirements.txt file has also been updated to remove an unused dependency.

    documentation 
    opened by bradsease 0
  • Generalize setup.py for local builds

    Generalize setup.py for local builds

    The current setup.py is configured for CI/CD use only and does not properly support local builds. Find a solution that works for both.

    Issue noted in PR #69

    bug 
    opened by bradsease 0
Releases(v0.3.3)
  • v0.3.3(Dec 8, 2021)

  • v0.3.2(Feb 7, 2021)

  • v0.3.1(Oct 15, 2020)

  • v0.3.0(Aug 29, 2020)

    OEM v0.3.0 Release Notes

    Key Changes

    • Implemented interpolation interface for OrbitEphemerisMessage and EphemerisSegment
    • Implemented .steps and .resample methods to facilitate common usage of interpolation
    • Incorporated defusedxml to address XML-related parsing vulnerabilities
    Source code(tar.gz)
    Source code(zip)
  • v0.2.2(Jun 3, 2020)

  • v0.2.1(May 28, 2020)

  • v0.2.0(May 26, 2020)

    OEM v0.2.0 Release Notes

    Key Changes

    • The primary interface for reading OEM files is now OrbitEphemerisMessage.open.

    • Added support for XML OEM files.

    • Added .save_as method to OrbitEphemerisMessage instances to allow writing of OEMs in both KVN and XML formats.

    • Added OrbitEphemerisMessage.convert class method to allow direct conversion of OEM files between KVN and XML formats.

    • States now use astropy Time objects to represent epochs with the correct scale.

    Source code(tar.gz)
    Source code(zip)
  • v0.1.1(May 23, 2020)

    OEM v0.1.1 Release Notes

    Modified constraints applied to ephemeris segments to prevent rejection of valid ephemerides when a state epoch is outside the useable range but within START_TIME and STOP_TIME.

    Source code(tar.gz)
    Source code(zip)
  • v0.1.0(May 21, 2020)

    OEM v0.1.0 Release Notes

    This is the initial release of the OEM package. At this stage, the OEM module supports basic interactions with ASCII OEM files.

    Source code(tar.gz)
    Source code(zip)
  • v0.0.1(May 21, 2020)

Owner
Brad Sease
Brad Sease
A "multiclipboards" script for an efficient way to improve the original clipboards which are only able to save one string at a time

A "multiclipboards" script for an efficient way to improve the original clipboards which are only able to save one string at a time. Works on both Windows and Linux.

1 Jan 24, 2022
GCP Scripts and API Client Toolss

GCP Scripts and API Client Toolss Script Authentication The scripts and CLI assume GCP Application Default Credentials are set. Credentials can be set

3 Feb 21, 2022
Сервис служит прокси между cервисом регистрации ошибок платформы и системой сбора ошибок Sentry

Sentry Reg Service Сервис служит прокси между Cервисом регистрации ошибок платформы и системой сбора ошибок Sentry. Как развернуть Sentry onpremise. С

Ingvar Vilkman 13 May 24, 2022
A comparison of mesh generators.

This repository creates meshes of the same domains with multiple mesh generators and compares the results.

Nico Schlömer 29 Dec 12, 2022
It was created to conveniently respond to events such as donation, follow, and hosting using the Alert Box provided by twip to streamers

This library is not an official library of twip. It was created to conveniently respond to events such as donation, follow, and hosting using the Alert Box provided by twip to streamers.

junah201 8 Nov 19, 2022
Implementation of the Angular Spectrum method in Python to simulate Diffraction Patterns

Diffraction Simulations - Angular Spectrum Method Implementation of the Angular Spectrum method in Python to simulate Diffraction Patterns with arbitr

Rafael de la Fuente 276 Dec 30, 2022
Sample microservices application demo

Development mode docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d or export COMPOSE_FILE='docker-compose.yml:docker-compose.dev.ym

Konstantinos Bairaktaris 1 Nov 14, 2021
A Microsoft reward automator, designed to work headless on a raspberry pi

MsReward A Microsoft reward automator, designed to work headless on a raspberry pi. Tested with a pi 3b+ and a pi 4 2Gb . Using a discord bot to log e

10 Dec 21, 2022
Calibre Libgen Non-fiction / Sci-tech store plugin

CalibreLibgenSci A Libgen Non-Fiction/Sci-tech store plugin for Calibre Installation Download the latest zip file release from here Open Calibre Navig

IDDQD 9 Dec 27, 2022
Astroquery is an astropy affiliated package that contains a collection of tools to access online Astronomical data.

Astroquery is an astropy affiliated package that contains a collection of tools to access online Astronomical data.

The Astropy Project 631 Jan 05, 2023
Tools for teachers and students using nng (Natural Number Game)

nngtools Usage Place your nngsave.json to the directory in which you want to extract the level files. Place nngmap.json on the same directory. Run nng

Thanos Tsouanas 1 Dec 12, 2021
TinyBar - Tiny MacOS menu bar utility to track price dynamics for assets on TinyMan.org

📃 About A simple MacOS menu bar app to display current coins from most popular Liquidity Pools on TinyMan.org

Al 8 Dec 23, 2022
A gamey, snakey esoteric programming language

Snak Snak is an esolang based on the classic snake game. Installation You will need python3. To use the visualizer, you will need the curses module. T

David Rutter 3 Oct 10, 2022
KUIZ is a web application quiz where you can create/take a quiz for learning and sharing knowledge from various subjects, questions and answers.

KUIZ KUIZ is a web application quiz where you can create/take a quiz for learning and sharing knowledge from various subjects, questions and answers.

Thanatibordee Sihaboonthong 3 Sep 12, 2022
NORETURN is an esoteric programming language, based around the idea of not going back

NORETURN NORETURN is an esoteric programming language, based around the idea of not going back Concept Program coded in noreturn runs over one array,

1 Dec 15, 2021
51AC8 is a stack based golfing / esolang that I am trying to make.

51AC8 is a stack based golfing / esolang that I am trying to make.

7 May 22, 2022
Robotic hamster to give you financial advice

hampp Robotic hamster to give you financial advice. I am not liable for any advice that the hamster gives. Follow at your own peril. Description Hampp

1 Nov 17, 2021
A Python program that generates a maze that solves itself using DFS

Maze Generator And Solver Program Purpose: Generates a maze that then solves itself Language: Python and Pygame Algorithm: Randomized DFS / Floodfill

Joshua Liu 1 Jul 25, 2022
Trusted sessions for falcon using itsdangerous.

Falcon signed sessions This project allows you to easily add trusted cookies to falcon, it works by storing a signed cookie in the client's browser us

Ward 1 Feb 08, 2022
PyGo custom language, New but similar language programming

New but similar language programming. Now we are capable to program in a very similar language to Python but at the same time get the efficiency of Go.

Fernando Perez 4 Nov 19, 2022