unitTestSupport

unitTestSupport.EigenVector3d2list(eig)[source]

convert Eigen vector3d to list

unitTestSupport.EigenVector3d2np(eig)[source]

convert Eigen vector3d to numpy

unitTestSupport.addTimeColumn(time, data)[source]

Add a time column to the data set

unitTestSupport.checkMethodKeyword(karglist, kwargs)[source]

loop through list of method keyword arguments and make sure that an approved keyword is used.

unitTestSupport.columnToRowList(set)[source]

Loop through a column list and return a row list

unitTestSupport.compareArray(trueStates, dataStates, accuracy, msg, testFailCount, testMessages)[source]

Compare two arrays size and values and check absolute accuracy

unitTestSupport.compareArrayND(trueStates, dataStates, accuracy, msg, size, testFailCount, testMessages)[source]

Compare two arrays of size N for size and values and check absolute accuracy

unitTestSupport.compareArrayRelative(trueStates, dataStates, accuracy, msg, testFailCount, testMessages)[source]

Checks whether the relative distance between elements of a pullMessageLogData-derived array and a truth array is below a provided accuracy, and return an error if not.

Parameters:
  • trueStates – iterable of size (m,n);

  • dataStates – iterable of size (m,n)

  • accuracy – Relative accuracy boundary

  • msg

  • testFailCount

  • testMessages

unitTestSupport.compareDoubleArray(trueStates, dataStates, accuracy, msg, testFailCount, testMessages)[source]

Compare two arrays of doubles for size and values and check absolute accuracy

unitTestSupport.compareDoubleArrayRelative(trueStates, dataStates, accuracy, msg, testFailCount, testMessages)[source]

Compare two arrays of doubles for size and values and check relative accuracy

unitTestSupport.compareList(trueStates, dataStates, accuracy, msg, testFailCount, testMessages)[source]

Compare two row lists of values and check relative accuracy

unitTestSupport.compareListRelative(trueStates, dataStates, accuracy, msg, testFailCount, testMessages)[source]

Compare two row lists of values and check relative accuracy

unitTestSupport.compareVector(trueStates, dataStates, accuracy, msg, testFailCount, testMessages, ExpectedResult=1)[source]

Compare two vector size and values and check absolute accuracy

unitTestSupport.decimalYearToDateTime(start)[source]

convert a decimal Year format to a regular dataTime object

unitTestSupport.flattenList(matrix)[source]

returns a flattened list :param matrix: list of list

Returns: flattened list

unitTestSupport.foundNAN(array)[source]

check if an array contains NAN values

unitTestSupport.getLineColor(idx, maxNum)[source]

pick a nicer color pattern to plot 3 vector components

unitTestSupport.isArrayEqual(result, truth, dim, accuracy)[source]

function to check if an array of values is the same as the truth values

unitTestSupport.isArrayEqualRelative(result, truth, dim, accuracy)[source]

Compare relative accuracy of two arrays

unitTestSupport.isArrayZero(result, dim, accuracy)[source]

function to check if an array of values are zero

unitTestSupport.isDoubleEqual(result, truth, accuracy)[source]

function to check if a double equals a truth value

unitTestSupport.isDoubleEqualRelative(result, truth, accuracy)[source]

function to check if a double equals a truth value with relative tolerance

unitTestSupport.isVectorEqual(result, truth, accuracy)[source]

function to check if a 3D vector is the same as the truth values

unitTestSupport.np2EigenMatrix3d(mat)[source]

convert 3D numpy matrix to Eigen matrix

unitTestSupport.np2EigenVectorXd(vec)[source]

Convert numpy to Eigen vector

unitTestSupport.npList2EigenXdVector(list)[source]

Conver a list of arrays to a list of eigen values

unitTestSupport.pullVectorSetFromData(inpMat)[source]

extract the vector data set from a data matrix where the 1st column is the time information

unitTestSupport.removeTimeFromData(dataList)[source]

pull out the time column out of a 4xN data list

unitTestSupport.samplingTime(simTime, baseTimeStep, numDataPoints)[source]

Given a simulation duration, this routine returns a sampling time that yields the closest integer match to a desired number of sampling points

Parameters:
  • simTime – [ns] total simulation duration

  • baseTimeStep – [ns] baseline sampling period

  • numDataPoints – nominal desired number of data points over the simulation duration

unitTestSupport.saveFigurePDF(figureName, plt, path)[source]

Save a Figure as a PDF

unitTestSupport.saveScenarioFigure(figureName, plt, path, extension='.svg')[source]

save a python scenario result into the documentation image folder

unitTestSupport.timeStringToGregorianUTCMsg(DateSpice, **kwargs)[source]

convert a general time/date string to a gregoarian UTC msg object

unitTestSupport.writeFigureLaTeX(figureName, caption, plt, format, path)[source]

Save a figure and associated TeX code snippet

unitTestSupport.writeTableLaTeX(tableName, tableHeaders, caption, array, path)[source]

Take a list and return equivalent LaTeX table code

unitTestSupport.writeTeXSnippet(snippetName, texSnippet, path)[source]

Write a LaTeX snippet to a file