API  4.3
For MATLAB, Python, Java, and C++ users
OpenSim::TableUtilities Class Reference

Static Public Member Functions

static void checkNonUniqueLabels (std::vector< std::string > labels)
 Throws an exception if the same label appears more than once in the list of labels. More...
 
static bool isInDegrees (const TimeSeriesTable &table)
 Returns true if the table contains 'inDegrees' metadata set to 'yes', and returns false if the table contains 'inDegrees' metadata set to 'no'. More...
 
static int findStateLabelIndex (const Array< std::string > &labels, const std::string &desired)
 Get the index in the provided array of labels that corresponds to the desired label. More...
 
static int findStateLabelIndex (const std::vector< std::string > &labels, const std::string &desired)
 Get the index in the provided array of labels that corresponds to the desired label. More...
 
static void filterLowpass (TimeSeriesTable &table, double cutoffFreq, bool padData=false)
 Lowpass filter the data in a TimeSeriesTable at a provided cutoff frequency. More...
 
static void pad (TimeSeriesTable &table, int numRowsToPrependAndAppend)
 Pad each column by the number of rows specified. More...
 
template<typename TimeVector , typename FunctionType = GCVSpline>
static TimeSeriesTable resample (const TimeSeriesTable &in, const TimeVector &newTime)
 Resample (interpolate) the table at the provided times. More...
 
template<typename FunctionType = GCVSpline>
static TimeSeriesTable resampleWithInterval (const TimeSeriesTable &in, double interval)
 Resample the table using the given time interval (using resample()). More...
 
template<typename FunctionType = GCVSpline>
static TimeSeriesTable resampleWithIntervalBounded (const TimeSeriesTable &in, double interval)
 Same as resampleWithInterval() but the interval may be reduced to ensure the number of sampling points does not exceed Storage::MAX_RESAMPLE_SIZE. More...
 
static TimeSeriesTable_< SimTK::Vec3 > convertRotationsToEulerAngles (const TimeSeriesTable_< SimTK::Rotation > &rotTable)
 

Member Function Documentation

◆ checkNonUniqueLabels()

static void OpenSim::TableUtilities::checkNonUniqueLabels ( std::vector< std::string >  labels)
static

Throws an exception if the same label appears more than once in the list of labels.

Exceptions
NonUniqueLabels

◆ convertRotationsToEulerAngles()

static TimeSeriesTable_<SimTK::Vec3> OpenSim::TableUtilities::convertRotationsToEulerAngles ( const TimeSeriesTable_< SimTK::Rotation > &  rotTable)
static

◆ filterLowpass()

static void OpenSim::TableUtilities::filterLowpass ( TimeSeriesTable table,
double  cutoffFreq,
bool  padData = false 
)
static

Lowpass filter the data in a TimeSeriesTable at a provided cutoff frequency.

If padData is true, then the data is first padded with pad() using numRowsToPrependAndAppend = table.getNumRows() / 2. The filtering is performed with Signal::LowpassIIR()

Referenced by OpenSim::TabOpLowPassFilter::operate().

◆ findStateLabelIndex() [1/2]

static int OpenSim::TableUtilities::findStateLabelIndex ( const Array< std::string > &  labels,
const std::string &  desired 
)
static

Get the index in the provided array of labels that corresponds to the desired label.

This function attempts to handle the change in state variable names that occurred in OpenSim version 4.0; for example, if you search for <coord-name>/speed and it is not found, then this function looks for <coord-name>_u. If you search for <muscle>/activation and it is not found, then this function looks for <muscle>.activation. This function returns -1 if the desired label is not found.

◆ findStateLabelIndex() [2/2]

static int OpenSim::TableUtilities::findStateLabelIndex ( const std::vector< std::string > &  labels,
const std::string &  desired 
)
static

Get the index in the provided array of labels that corresponds to the desired label.

This function attempts to handle the change in state variable names that occurred in OpenSim version 4.0; for example, if you search for <coord-name>/speed and it is not found, then this function looks for <coord-name>_u. If you search for <muscle>/activation and it is not found, then this function looks for <muscle>.activation. This function returns -1 if the desired label is not found.

◆ isInDegrees()

static bool OpenSim::TableUtilities::isInDegrees ( const TimeSeriesTable table)
static

Returns true if the table contains 'inDegrees' metadata set to 'yes', and returns false if the table contains 'inDegrees' metadata set to 'no'.

Exceptions
Exceptionif table does not have 'inDegrees' table metadata.
Exceptionif the 'inDegrees' metadata is neither 'yes' or 'no'.

Referenced by OpenSim::TableProcessor::processAndConvertToRadians().

◆ pad()

static void OpenSim::TableUtilities::pad ( TimeSeriesTable table,
int  numRowsToPrependAndAppend 
)
static

Pad each column by the number of rows specified.

The padded data is obtained by reflecting and negating the data in the table. Postcondition: the number of rows is table.getNumRows() + 2 * numRowsToPrependAndAppend.

◆ resample()

template<typename TimeVector , typename FunctionType = GCVSpline>
static TimeSeriesTable OpenSim::TableUtilities::resample ( const TimeSeriesTable in,
const TimeVector &  newTime 
)
static

Resample (interpolate) the table at the provided times.

In general, a 5th-order GCVSpline is used as the interpolant; a lower order is used if the table has too few points for a 5th-order spline. Alternatively, you can provide a different function type as a template argument; currently, the only other supported function is PiecewiseLinearFunction.

Exceptions
Exceptionif new times are not within existing initial and final times, if the new times are decreasing, or if getNumTimes() < 2.

◆ resampleWithInterval()

template<typename FunctionType = GCVSpline>
static TimeSeriesTable OpenSim::TableUtilities::resampleWithInterval ( const TimeSeriesTable in,
double  interval 
)
static

Resample the table using the given time interval (using resample()).

The new final time is not guaranteed to match the original final time.

◆ resampleWithIntervalBounded()

template<typename FunctionType = GCVSpline>
static TimeSeriesTable OpenSim::TableUtilities::resampleWithIntervalBounded ( const TimeSeriesTable in,
double  interval 
)
static

Same as resampleWithInterval() but the interval may be reduced to ensure the number of sampling points does not exceed Storage::MAX_RESAMPLE_SIZE.


The documentation for this class was generated from the following file: