Back

Customize ODTK Reports with Python and Pandas

ODTK includes a wealth of reporting and graphic options for analysis that an engineer would commonly perform. But, many users want to customize reports . Well, as of ODTK 7.0 customization became significantly easier because report generation is now handled by simple Python scripts that use the Pandas library to dictate how information is written and displayed. The best part is that these scripts are completely customizable, so you can create custom metrics, print custom wording, and display data from a variety of sources. This post contains all the information you need to start customizing your reports in ODTK and start tailoring the results you see to your use case.

Pandas

Pandas is quickly becoming an industry-standard library for data handling, with thousands upon thousands of users interacting and sharing code samples all over the internet. The foundational object for the Pandas library is a data frame, which you can think of as a table in which each column header is an indexable handle and each row is either indexed by number or another assigned index like date or time.

In ODTK reporting, you can specify a set of data for each report style. That dataset gets pulled into a Pandas data frame in the back-end Python script, and then the script performs any specified customization, computation, or manipulation on it. Finally, the script prints the data frame to the report file that gets displayed in ODTK. You can find a quick introduction to Pandas, along with the rest of the detailed documentation, here.

ODTK Reporting and Python

The Python scripts that run to create ODTK reports not only use Pandas, but they are fully executable Python scripts in a native Python environment. The possibilities for what you can do with these scripts are only limited to what you can do within the Python environment. AGI even provides a set of helper functions for you to use in your report creation.

Looking at the properties of a report style in ODTK, we can see a data selection window like what you might see in the STK Report and Graph Manager, and we can also see a Python script selection field:

All the built-in Python report scripts are installed to C:\Program Files\AGI\ODTK 7\ODTK\AppData\PythonReport. You’ll notice there are some reports that have a dedicated script and others that reference the basic odtk_report.py, which simply takes the input data and prints it straight into the report. All you need to do once you have created your own report generation script is to ensure the input fields are correct and point the Python Script field to it.

For more information on how to edit these scripts or create one for yourself, check out this YouTube video.

Example

I recently uncovered a great use for this custom report scripting as I was creating a sensor calibration scenario. I found myself constantly looking at sensor bias plots and attempting to visually estimate the average bias correction that the filter was placing on my bias estimate. So instead of relying on my human eye, I decided to create a new report that printed out the filter’s average, min, max, and standard deviation bias correction on each sensor for each measurement type. My properly configured custom report in ODTK looks like the following:

The customized report looks like this:

Leveraging the statistical capabilities within Pandas, I can now see all my bias estimates compared side-by-side with ODTK’s filter corrections, all in one nice bias statistics table. Rather than staring at a line plot and trying to visually estimate, I can see right here that the filter is correcting my Range measurement bias on RadarSite1 by an average of 5.788 m. I can then immediately update my bias estimate from 40 m to 45 m.

I could then extend this further to have my Python script reach out to the ODTK scenario and make these bias changes for me. Or maybe I think this report will take a while to generate and I want to use a Python library to email me when the report is done generating. The possibilities are endless…

Resources

Orbit Determination Tool Kit (ODTK)

Process tracking data and generate orbit ephemeris with realistic covariance.

Systems Tool Kit (STK)

Modeling and simulation software for digital mission engineering and systems analysis.