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
Earth-to-orbit ballistic trajectories with atmospheric resistance

Earth-to-orbit ballistic trajectories with atmospheric resistance Overview Space guns are a theoretical technology that reduces the cost of getting bu

null 1 Dec 3, 2021
Open source tools to allow working with ESP devices in the browser

ESP Web Tools Allow flashing ESPHome or other ESP-based firmwares via the browser. Will automatically detect the board type and select a supported fir

ESPHome 195 Dec 31, 2022
x-tools is a collection of tools developed in Python

x-tools X-tools is a collection of tools developed in Python Commands\

null 5 Jan 24, 2022
Run Python code right in your Telegram messages

Run Python code right in your Telegram messages Made with Telethon library, TGPy is a tool for evaluating expressions and Telegram API scripts. Instal

null 29 Nov 22, 2022
A python tool for synchronizing the messages from different threads, processes, or hosts.

Sync-stream This project is designed for providing the synchoronization of the stdout / stderr among different threads, processes, devices or hosts.

Yuchen Jin 0 Aug 11, 2021
Provide error messages for Python exceptions, even if the original message is empty

errortext is a Python package to provide error messages for Python exceptions, even if the original message is empty.

Thomas Aglassinger 0 Dec 7, 2021
Telegram bot to remove the forwarded tag from messages.

Anonymous Sender Bot @AnonySendBot Telegram bot to remove the forwarded tag from messages. Table of Contents Usage Deploy To Heroku Local Deploying En

Stark Bots 26 Nov 24, 2022
Automatically remove user join messages when the user leaves the server.

CleanLeave Automatically remove user join messages when the user leaves the server. Installation You will need to install poetry to run this bot local

null 11 Sep 19, 2022
Simple script with AminoLab to send ghost messages

Simple script with AminoLab to send ghost messages

Moleey 1 Nov 22, 2021
A Github Action for sending messages to a Matrix Room.

matrix-commit A Github Action for sending messages to a Matrix Room. Screenshot: Example Usage: # .github/workflows/matrix-commit.yml on: push:

null 3 Sep 11, 2022
ViberExport - Export messages from Viber messenger using viber.db file

?? ViberExport Export messages from Viber messenger using viber.db file ⚡ Usage:

null 7 Nov 23, 2022
Telop - Encode and decode messages using an interpretation of the telegraphic code devised by José María Mathé

telop Telop (TELégrafoÓPtico) - Utilidad para codificar y descodificar mensajes de texto empleando una interpretación del código telegráfico ideado po

Ricardo F. 4 Nov 1, 2022
Automatically unpin old messages so you can always pin more!

PinRotate Automatically unpin old messages so you can always pin more! Installation You will need to install poetry to run this bot locally for develo

null 3 Sep 18, 2022
Utility functions for working with data from Nix in Python

Pynixutil - Utility functions for working with data from Nix in Python Examples Base32 encoding/decoding import pynixutil input = "v5sv61sszx301i0x6x

Tweag 11 Dec 16, 2022
Module for working with the site dnevnik.ru with python

dnevnikru Module for working with the site dnevnik.ru with python Dnevnik object accepts login and password from the dnevnik.ru account Methods: homew

Aleksandr 21 Nov 21, 2022
The first Python 1v1.lol triggerbot working with colors !

1v1.lol TriggerBot Afin d'utiliser mon triggerbot, vous devez activer le plein écran sur 1v1.lol sur votre naviguateur (quelque-soit ce dernier). Vous

Venax 5 Jul 25, 2022
A Python wrapper API for operating and working with the Neo4j Graph Data Science (GDS) library

gdsclient NOTE: This is a work in progress and many GDS features are known to be missing or not working properly. This repo hosts the sources for gdsc

Neo4j 100 Dec 20, 2022
This is a working model for which I have used python.

Jarvis_voiceAssistance This is a working model for which I have used python. This model can: 1)Play a video or song on youtube. 2)Tell us time. 3)Tell

Hardik Jain 1 Jan 30, 2022
Wisdom Tree is a concentration app i am working on.

Wisdom Tree Wisdom Tree is a tui concentration app I am working on. Inspired by the wisdom tree in Plants vs. Zombies which gives in-game tips when it

NO ONE 241 Jan 1, 2023