adam.stk.astrogatoroutput module

astrogatoroutput.py

class adam.stk.astrogatoroutput.AstrogatorOutput

Bases: object

Fetches output from an STK/Astrogator MCS.

This class is used to create a list of desired outputs from an STK Astrogator Mission Control Sequence (MCS). This is specifically designed to support multiple runs, such as in a parametric study.

This class is also used to retrieve the list of outputs. When fetching the data (using update(), the values are returned in rows. The calling code also specifies an index number which represents the column index. The output is a table, with the desired outputs in each row. Each column contains the values for each different run. Conceptually, it returns a table of the form:

run_1

run_2

run_3

run_4

output_1

###

###

###

###

output_2

###

###

###

###

output_3

###

###

###

###

NOTE: Internally the class stores the runs as rows, and the desired output values as columns. But the supported workflow needs the runs as columns, the output is transposed whenever requested.

This class can save the resulting values to a csv file, and load from it using pandas.

This class can create a pandas dataframe.

__init__()

Initialize attributes.

add(eventName, quantity, unit)

Add a new desired output

This function adds a desired output to the list of outputs that will be generated when this object is updated. It uses the MCS segment name, the desired Astroagtor CalcObject with which to calulate the value, and the desired unit.

Parameters
  • eventName (str) – The MCS segment name (e.g., “Initial_State”)

  • quantity (str) – The desired CalcObject (e.g., “Altitude”)

  • unit (str) – The desired unit in STK format (e.g., “km”)

Returns

None

TODO:
  • Catch erros

  • Decide what to do if add is called after update()

property df

Return a pandas dataframe of the data

Note: The data internally is not the same as the returned dataframe; Eachdesired output is a row in the dataframe, and each run is a column. Since this is the opposite of internal storage, the transpose function is used.

Parameters

None

Returns

Panda data frame

classmethod loadCSV(path)

Load the data from a csv file

This method loads data into the object from a csv file. It is inteneded to load a csv that was created with this same object.

Parameters

path (str) – The filepath to the output csv file, including the suffix, “.csv”

Returns

The class

property rowNames

Return the names of the row as a list

This creates the row name from the event name, the desired quantity, and the units. Put the untis in parenthesis which is common for human-readable tables.

Parameters

None

Returns

List of row names

saveCSV(path)

Save the output values to a csv file

This uses the pandas dataframe funcationality to save the data. A csv file is used to support the workflow that a user may want to import into a spreadsheet.

Note: The data internally is not the same as the csv; Each desired output is a row in the csv, and each run is a column. Since this is the opposite of internal storage, the transpose function is used.

Parameters

path (str) – The filepath to the output csv file, including the suffix, “.csv”

Returns

Return type

None

TODO:
  • Catch erros

update(gatorDefn, index)

Fetch & store the desired data from STK/Astrogator

This method fetches the desired output values from the STK/AStrogator Satellite Object.

Parameters
  • gatorDefn (STK COM object) – The Astrogator definition of the STK Satellite Object.

  • index – The run number, designed to be used in a loop that increments each time.