Solved - Python Interface? - Yes!

Frequently-asked questions

Solved - Python Interface? - Yes!

Postby earetski » Wed Apr 20, 2016 4:52 pm

Is there an easy interface that allows you pass python commands to / from GMAT to do custom function evaluations?

There is a function that allows you to call custom python script. This function can be found under the Reference Guide / Commands / CallPythonFunction

GMAT provides a special command that allows you to call a function written in the Python language. In the GUI, this is the CallPythonFunction command.

In the syntax description, the preface Python is a keyword used to tell GMAT that the scripting is calling into the Python system. The PythonModule identifies a Python file, with the name, containing the function that is to be called. PythonFunction is the function that is called inside of that file. Arguments can be passed into and returned from the function, following the guidelines described below. See Remarks for details.

When a Python function is called, GMAT loads the Python engine in the background. This functionality requires that a compatible installation of Python be properly installed and configured on your system. Once GMAT has loaded the engine, it remains in memory until GMAT is closed.

Original Problem Details:

Details: From a cursory examination of your website and after watching a few of the intro videos, it's clear that you have a strong interface with the Matlab command line which allows you to create custom functions in Matlab. Matlab, however, is a proprietary program so we have been looking at Python as an alternative. We need to be able to generate eclipse information so that we understand when our field of views will be obscured. For that I need coordinates for the Earth/Sun/Mars/Spacecraft and I want to pass it through a custom python program that will solve the eclipse problem for our sensor suite. I want to be able to do this while GMAT is running as opposed to creating an output file of planet locations and post processing. Feedback is appreciated.
Posts: 1
Joined: Wed Apr 20, 2016 4:42 pm

Return to FAQ

Who is online

Users browsing this forum: No registered users and 1 guest