simHelpers
General-purpose simulation helpers.
These utilities are used by modules such as simIncludeGravBody and
vizSupport. They are kept here so that importing those user-facing
modules does not pull in the test-only pytest dependency that
unitTestSupport transitively would introduce.
- simHelpers.checkMethodKeyword(karglist, kwargs)[source]
Check that keyword arguments are in the allowed keyword list.
- simHelpers.decimalYearToDateTime(start)[source]
Convert a decimal year to a
datetime.datetimeobject.
- simHelpers.flattenList(matrix)[source]
Return a flattened list.
- Parameters:
matrix – List of lists.
- Returns:
Flattened list.
- simHelpers.getScenarioFigureFileName(figureName, path, extension='.svg')[source]
Return the documentation image path for a scenario figure.
- simHelpers.pullVectorSetFromData(inpMat)[source]
Extract vector data from a matrix whose first column is time data.
- simHelpers.samplingTime(simTime, baseTimeStep, numDataPoints)[source]
Return a sample time that approximates a target number of samples.
- Parameters:
simTime – [ns] Total simulation duration.
baseTimeStep – [ns] Baseline sampling period.
numDataPoints – Nominal desired number of data points over the simulation duration.
- Returns:
[ns] Sampling period.
- simHelpers.saveScenarioFigure(figureName, plt, path, extension='.svg')[source]
Save a Python scenario result into the documentation image folder.
- simHelpers.saveScenarioGraphvizFigure(figureName, simulationBase, path, extension='.svg', show_plots=False, **kwargs)[source]
Save a Graphviz message flow figure into the documentation image folder.
- simHelpers.timeStringToGregorianUTCMsg(DateSpice, **kwargs)[source]
convert a general time/date string to a gregoarian UTC msg object
- simHelpers.writeFigureLaTeX(figureName, caption, plt, format, path)[source]
Save a figure and associated TeX code snippet.