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
Empresas do Brasil (CNPJs)

Biblioteca em Python que coleta informações cadastrais de empresas do Brasil (CNPJ) obtidas de fontes oficiais (Receita Federal) e exporta para um formato legível por humanos (CSV ou JSON).

BR-API: Democratizando dados do Brasil. 8 Aug 17, 2022
Script to change official Kali repository to mirrors

Script to change official Kali repository to mirrors. This helps increase packages update and downloading for some user.

Vineet Bhavsar 2 Nov 29, 2021
A collection of resources on neural rendering.

awesome neural rendering A collection of resources on neural rendering. Contributing If you think I have missed out on something (or) have any suggest

1.8k Dec 30, 2022
Replay Felica Exchange For Python

FelicaReplay Replay Felica Exchange Description Standalone Replay Module Usage Save FelicaRelay (=2.0) output to file, then python replay.py [FILE].

3 Jul 14, 2022
Very simple encoding scheme that will encode data as a series of OwOs or UwUs.

OwO Encoder Very simple encoding scheme that will encode data as a series of OwOs or UwUs. The encoder is a simple state machine. Still needs a decode

1 Nov 15, 2021
Modify the value and status of the records KoboToolbox

Modify the value and status of the records KoboToolbox (Modica el valor y status de los registros de KoboToolbox)

1 Oct 30, 2021
A simple countdown timer in eazy code to show timer with python

Countdown_Timer The simple CLI countdown timer in eazy code to show timer How Work First you fill the input by int-- (Enter the time in Seconds:) for

Yasin Rezvani 3 Nov 15, 2022
Kellogg bad | Union good | Support strike funds

KelloggBot Credit to SeanDaBlack for the basis of the script. req.py is selenium python bot. sc.js is a the base of the ios shortcut [COMING SOON] Set

407 Nov 17, 2022
Birthday program - A program that lookups a birthday txt file and compares to the current date to check for birthdays

Birthday Program This is a program that lookups a birthday txt file and compares

Daquiver 4 Feb 02, 2022
Insights in greek football league 2020-2021 and bookmaker's accuracy

Greek_Football_League_Analysis_2020_2021 Aim of Project: This project aims in deriving useful insights from greek football league 2020-2021 by mean st

2 Jan 16, 2022
Reverse the infix string. Note that while reversing the string you must interchange left and right parentheses

Reverse the infix string. Note that while reversing the string you must interchange left and right parentheses. Obtain the postfix expression of the infix expression Step 1.Reverse the postfix expres

Sazzad Hossen 1 Jan 04, 2022
A set of tools for ripping music from Konami mobile games

Konami Mobile Ripping Toolset A set of tools for ripping music from Konami mobile games Contents nigger.py for niggering konami's website, ripping all

5 Oct 20, 2022
A collection of common regular expressions bundled with an easy to use interface.

CommonRegex Find all times, dates, links, phone numbers, emails, ip addresses, prices, hex colors, and credit card numbers in a string. We did the har

Madison May 1.5k Dec 31, 2022
Visualize Data From Stray Scanner https://keke.dev/blog/2021/03/10/Stray-Scanner.html

StrayVisualizer A set of scripts to work with data collected using Stray Scanner. Usage Installing Dependencies Install dependencies with pip -r requi

Kenneth Blomqvist 45 Dec 30, 2022
Funchacks - Fun module which is a small set of utilities

funchacks 👋 Introduction Funchacks is a fun module that provides a small packag

DenyS 6 Aug 04, 2022
Data-driven Computer Science UoB

COMS20011_2021 Data-driven Computer Science UoB Staff Laurence Aitchison [ 6 May 16, 2022

Explore-bikeshare-data - GitHub project as part of the Programming for Data Science with Python Nanodegree from Udacity

Date created February 10, 2022 Project Title Explore US Bikeshare Data Descripti

Thárcyla 1 Feb 14, 2022
Code for Crowd counting via unsupervised cross-domain feature adaptation.

CDFA-pytorch Code for Unsupervised crowd counting via cross-domain feature adaptation. Pre-trained models Google Drive Baidu Cloud : t4qc Environment

Guanchen Ding 6 Dec 11, 2022
Distributed behavioral experiments

Autopilot Docs Paper Forum Hardware Autopilot is a Python framework for performing complex, hardware-intensive behavioral experiments with swarms of n

70 Dec 14, 2022
SimBiber - A tool for simplifying bibtex with official info

SimBiber: A tool for simplifying bibtex with official info. We often need to sim

336 Jan 02, 2023