Nexus API

class ViconNexus.ViconNexus

ViconNexus Creates a connection to Vicon Nexus for offline data access

Documentation and usage examples provided assume that an object named vicon has been created to access the class methods vicon = ViconNexus()

ClearAllEvents()

Delete all events currently defined in the loaded trial

CloseTrial(timeout)

Close the trial currently open in the connected host application without saving. This command may be used from within Python but can not be used in a script that is executing from the application. The trial will fail to close if a pipeline is running or the application is is live mode.

Input
timeout = integer value, timeout value (in seconds) used to return control in the case that
the trial does not close in a timely fashion. It is important to note that the timeout value has no effect in the host application itself and the trial may continue to save after the time allocated has expired.

Usage Example:

vicon.CloseTrial( 30 )
Connect()

Re-connect to the host application if we are not currently connected

CreateAnEvent(subject, context, event, frame, offset)

Create a new event at the specifed ( frame + offset )

Input

subject = string, name of an existing subject context = string, name of the context.

*** use the DisplayCommandHelp method to get more information on
context names that are valid for the connected application
event = string, name of the event type.
*** use the DisplayCommandHelp method to get more information on
event type names that are valid for the connected application

frame = integer value, trial frame number as displayed in the application time bar offset = double value, offset (in seconds) from the beginning of the frame to the event occurrence

The value should be in the range of 0.00 to 1/FrameRate

Usage Example:

vicon.CreateAnEvent( ‘Patricia’, ‘Foot Strike’, ‘Left’, 137, 0.0 )
CreateAnalysisParam(subject, param, value, unit)

Create a new analysis parameter for the specified subject. Analysis parameter names must be unique within the subject.

Input

subject = string, name of an existing subject param = string, name of the new analysis parameter value = floating point number, desired value of the analysis parameter unit = string, unit associated with the value

*** use the DisplayCommandHelp method to get more information on
units that are valid for the connected application

Usage Example: create a new analysis parameter

vicon.CreateAnalysisParam( ‘Colin’, ‘MyParam’, 1.23, ‘mm’ )
CreateModelOutput(subject, modelOutputName, groupName, componentNames, QuantityTypes)

Create a new model output Add data to the newly created model output using SetModelOutput or SetModelOutputAtFrame

Input

subject = string, name of an existing subject modelOutputName = string, name of new model output associated with the subject group = string, name of the group the model output belongs to components = list of strings, list of component names for the model output types = list of strings, list of the quantity types for each component

*** use the DisplayCommandHelp method to get more information on
quantity types that are valid for the connected application

Usage Example: Create model output matching the Plug-in Gait Bone HED

BonesNames = [‘RX’,’RY’,’RZ’,’TX’,’TY’,’TZ’,’SX’,’SY’,’SZ’] BonesTypes = [‘Angle’,’Angle’,’Angle’,’Length’,’Length’,’Length’,’Length’,’Length’,’Length’] vicon.CreateModelOutput( ‘Patricia’, ‘HED’, ‘Plug-in Gait Bones’, BonesNames, BonesTypes )
CreateModeledMarker(subject, modelOutputName)

Creates a new model output that can be displayed in the application workspace Add data to the newly created model output using SetModelOutput or SetModelOutputAtFrame

Input
subject = string, name of an existing subject modelOutputName = string, name of new model output associated with the subject

Usage Example: Create a midpoint

vicon.CreateModeledMarker( ‘Colin’, ‘Midpoint’ ) kneeX, kneeY, kneeZ, kneeExists = vicon.GetTrajectory( ‘Colin’, ‘RKNE’ ) ankX, ankY, ankZ, ankExists = vicon.GetTrajectory( ‘Colin’, ‘RANK’ ) data, exists = vicon.GetModelOutput( ‘Colin’, ‘Midpoint’ ) framecount = vicon.GetFrameCount() for i in xrange(framecount):

if kneeExists[i] and ankExists[i]
exists[i] = True data[0][i] = ( kneeX[i] + ankX[i] ) / 2 data[1][i] = ( kneeY[i] + ankY[i] ) / 2 data[2][i] = ( kneeZ[i] + ankZ[i] ) / 2
else:
exists[i] = False

vicon.SetModelOutput( ‘Colin’, ‘Midpoint’, data, exists )

CreateSubjectParam(subject, param, value, unit, default, required)

Create a new subject parameter for the specified subject. Subject parameter names must be unique within the subject.

Input

subject = string, name of an existing subject param = string, name of the new subject parameter value = floating point number, desired value of the subject parameter unit = string, unit associated with the value

*** use the DisplayCommandHelp method to get more information on
units that are valid for the connected application

default = floating point number, PRIOR value of the subject parameter required = logical, indication as to whether the subject parameter is a required parameter

Usage Example: create a new subject parameter

vicon.CreateSubjectParam( ‘Colin’, ‘MyParam’, 1.23, ‘mm’, 0, False )
DisplayCommandHelp(commandname)

Displays more detailed information about the specified Vicon SDK command This information is retrieved from the connected application

DisplayCommandList()

Displays a list of commands available in the underlying Vicon SDK for the connected host application

GetAnalysisParam(subject, param)

Retrieve the current value of an analysis parameter

Input
subject = string, name of an existing subject param = string, name of an existing analysis parameter
Returns
value = floating point number, current value of the analysis parameter hasvalue = logical, indication as to whether the analysis parameter has a value

Usage Example: negate the value of a analysis parameter

value = vicon.GetAnalysisParam( ‘Colin’, ‘MyParam’ ) value = value * (-1) vicon.SetAnalysisParam( ‘Colin’, ‘MyParam’, value )
GetAnalysisParamDetails(subject, param)

Retrieve detailed information about an analysis parameter

Input
subject = string, name of an existing subject param = string, name an existing analysis parameter
Returns

value = floating point number, current value of the analysis parameter unit = string, unit associated with the value

*** use the DisplayCommandHelp method to get more information on
units that are valid for the connected application

hasvalue = logical, indication as to whether the analysis parameter has a value

Usage Example: Display analysis parameter details

value, unit, default, required = vicon.GetAnalysisParamDetails( ‘Colin’, ‘MyParam’ )

ParamInfo = ‘MyParam = {0} [{1}]’.format( value, unit ) print ParamInfo

GetAnalysisParamNames(subject)

Retrieve the names of the analysis parameters associated with the specified subject

Input
subject = string, name of an existing subject
Returns
names = list of strings, one for each analysis parameter

Usage Example: Display all of the analysis parameters

params = vicon.GetAnalysisParamNames( ‘Colin’ ) print params
GetDeviceChannel(deviceID, deviceOutputID, channelID)

Returns a single channel of device data from the channel identified by deviceID:deviceOutputID:channelID A device can have multiple device outputs and each device output can have multiple channels associated with it

Devices can run at different rates than the trial data. Channel data could have multiple samples for each trial frame. All samples for a channel are output. For data that has a higher sample rate than the trial frame rate, channel data can be interpreted as:

frame1[sample1], frame1[sample2], … frame1[sampleN], … frameN[sample1], frameN[sample2], … frameN[sampleN]
Input
deviceID = unsigned int, DeviceID of and existing device deviceOutputID = unsigned int, DeviceOutputID of the device output you are interested in channelID = unsigned int, ID of the channel
Returns

channelData = numerical(double) list, component data list of size NumberOfFrames * samplesPerFrame ready = logical, T/F indication as to whether or not the device output is in the ready state

if the device output is not in the ready state, there will not be any valid data associated with this device output component

rate = double value, sample rate of the channel data

Usage Example:

GetDeviceChannelAtFrame(deviceID, deviceOutputID, channelID, frame)

Retrieve a single frame of data from the channel identified by deviceID:deviceOutputID:channelID A device can have multiple device outputs and each device output can have multiple channels associated with it

Devices can run at different rates than the trial data. Channel data could have multiple samples for each trial frame. All samples for a channel are output. Channel data list will be in the format:

[sample1], [sample2], … [sampleN]
Input
deviceID = unsigned int, DeviceID of and existing device deviceOutputID = unsigned int, DeviceOutputID of the device output you are interested in channelID = unsigned int, ID of the channel frame = integer value, trial frame number as displayed in the application time bar
Returns

channelData = numerical(double) list, component data list for the frame of size samplesPerFrame ready = logical, T/F indication as to whether or not the device output is in the ready state

if the device output is not in the ready state, there will not be any valid data associated with this device output component

rate = double value, sample rate of the channel data

Usage Example:

GetDeviceChannelForFrame(deviceID, deviceOutputID, channelID, frame)

Retrieve a single frame of data from the channel identified by deviceID:deviceOutputID:channelID This function will return data corresponding to the requested optical frame. A device can have multiple device outputs and each device output can have multiple channels associated with it

Devices can run at different rates than the trial data. Channel data could have multiple samples for each trial frame. All samples for a channel are output. Channel data list will be in the format:

[sample1], [sample2], … [sampleN]
Input
deviceID = unsigned int, DeviceID of and existing device deviceOutputID = unsigned int, DeviceOutputID of the device output you are interested in channelID = unsigned int, ID of the channel frame = integer value, trial frame number as displayed in the application time bar
Returns

channelData = numerical(double) list, component data list for the frame of size samplesPerFrame ready = logical, T/F indication as to whether or not the device output is in the ready state

if the device output is not in the ready state, there will not be any valid data associated with this device output component

rate = double value, sample rate of the channel data

Usage Example:

GetDeviceChannelGlobal(deviceID, deviceOutputID, channelID)

Returns a single channel of global device data from the channel identified by deviceID:deviceOutputID:channelID A device can have multiple device outputs and each device output can have multiple channels associated with it

Devices can run at different rates than the trial data. Channel data could have multiple samples for each trial frame. All samples for a channel are output. For data that has a higher sample rate than the trial frame rate, channel data can be interpreted as:

frame1[sample1], frame1[sample2], … frame1[sampleN], … frameN[sample1], frameN[sample2], … frameN[sampleN]
Input
deviceID = unsigned int, DeviceID of and existing device deviceOutputID = unsigned int, DeviceOutputID of the device output you are interested in channelID = unsigned int, ID of the channel
Returns

channelData = numerical(double) list, component data list of size NumberOfFrames * samplesPerFrame ready = logical, T/F indication as to whether or not the device output is in the ready state

if the device output is not in the ready state, there will not be any valid data associated with this device output component

rate = double value, sample rate of the channel data

Usage Example:

GetDeviceChannelGlobalAtFrame(deviceID, deviceOutputID, channelID, frame)

Retrieve a single frame of global data from a channel identified by deviceID:deviceOutputID:channelID A device can have multiple device outputs and each device output can have multiple channels associated with it

Devices can run at different rates than the trial data. Channel data could have multiple samples for each trial frame. All samples for a channel are output. Channel data list will be in the format:

[sample1], [sample2], … [sampleN]
Input
deviceID = unsigned int, DeviceID of and existing device deviceOutputID = unsigned int, DeviceOutputID of the device output you are interested in channelID = unsigned int, ID of the channel frame = integer value, trial frame number as displayed in the application time bar
Returns

channelData = numerical(double) list, component data list for the frame of size samplesPerFrame ready = logical, T/F indication as to whether or not the device output is in the ready state

if the device output is not in the ready state, there will not be any valid data associated with this device output component

rate = double value, sample rate of the channel data

Usage Example:

GetDeviceChannelGlobalForFrame(deviceID, deviceOutputID, channelID, frame)

Retrieve a single frame of global data from a channel identified by deviceID:deviceOutputID:channelID A device can have multiple device outputs and each device output can have multiple channels associated with it This function will return data corresponding to the requested optical frame.

Devices can run at different rates than the trial data. Channel data could have multiple samples for each trial frame. All samples for a channel are output. Channel data list will be in the format:

[sample1], [sample2], … [sampleN]
Input
deviceID = unsigned int, DeviceID of and existing device deviceOutputID = unsigned int, DeviceOutputID of the device output you are interested in channelID = unsigned int, ID of the channel frame = integer value, trial frame number as displayed in the application time bar
Returns

channelData = numerical(double) list, component data list for the frame of size samplesPerFrame ready = logical, T/F indication as to whether or not the device output is in the ready state

if the device output is not in the ready state, there will not be any valid data associated with this device output component

rate = double value, sample rate of the channel data

Usage Example:

GetDeviceChannelIDFromName(deviceID, deviceOutputID, name)

Returns the channel ID for the named device output channel ‘name’ associated with device output ‘deviceOutputID’ fof the device with the ID ‘deviceID’ GetDeviceChannelIDFromName will search the specified device output and return the channel ID with the name ‘name’. The deviceChannelID is used for all device output channelcommunication.

Input
deviceID = unsigned int, DeviceID of and existing device deviceOutputID = unsigned int, DeviceOutputID of the device output you are interested in name = string, name of a known channel, names are case sensitive
Returns
channelID = unsigned int, ChannelID of the device with name ‘name’

Usage Example:

channelID = vicon.GetDeviceChannelIDFromName( 1, 1, ‘Fx’ )
GetDeviceDetails(deviceID)

Return detailed information about a specific device. Every device will have associated device outputs. Communication with the device outputs is done by using a DeviceOutputID to identify the specific device output.

Input
deviceID = string, DeviceID of the device you are interested in
Returns

name = string, name of the device (may be blank) type = string, device type. Valid options are

‘ForcePlate’, ‘EyeTracker’, ‘Other’

rate = double value, rate at which the device runs deviceOutputIDs = unsigned int, list of the DeviceOutputIDs forceplate = NexusForcePlate, additional info if the device

is a force plate
eyetracker = NexusEyeTracker, additional info if the device
is an eye tracker

Usage Example: Display the name and type of a device

name, type, rate, deviceOutputIDs, forceplate, eyetracker = vicon.GetDeviceDetails( ‘1’ ) DeviceDisplay = ‘DeviceID: {0} is named {1} and it is a {2} device’ ].format( deviceID, name, type ) print DeviceDisplay
GetDeviceIDFromName(name)

Returns the device ID for the device using the specified name The DeviceID is used for all device communication.

Input
name = string, name of a known device, device names are case sensitive
Returns
deviceID = string, DeviceID of the device with name ‘name’

Usage Example: retrieve the DeviceID for a named forceplate

DeviceID = vicon.GetDeviceIDFromName( ‘MyForcePlate’ )
GetDeviceIDs()

Retrieve a list of the unique identifiers of the analog devices The DeviceID is used for all device communication. A device may also be ‘named’ although having a device name is not a requirement.

Returns
deviceIDs = list of unsigned ints, one for each device

Usage Example: retrieve the list of device identifiers

devices = vicon.GetDeviceIDs() for device in devices:

print device
GetDeviceNames()

Retrieve a list device names. Device names are not required, access to device data is done using the DeviceID

Returns
deviceNames = list of strings, one for each named device

Usage Example:

deviceNames = vicon.GetDeviceNames()
GetDeviceOutputDetails(deviceID, deviceOutputID)

Returns detailed information about a specific device output.

Input
deviceID = unsigned int, DeviceID of and existing device deviceOutputID = unsigned int, DeviceOutputID of the device output you are interested in
Returns

name = string, name of the device (may be blank) type = string, device output type. unit = string, unit name ready = logical value, indication of whether or not the output is in the ready state channelNames = string list, list of channel names associated with the output,

channel names are not required, data access is acheived using the channelID

channelIDs = unsigned int list, list of channel IDs associated with the output

Usage Example:

GetDeviceOutputIDFromName(deviceID, name)

Returns the device output ID for the named device output ‘name’ associated with device with the ID ‘deviceID’ The DeviceOutputID is used for all device output communication.

Input
deviceID = unsigned int, DeviceID of and existing device name = string, name of a known device output, names are case sensitive
Returns
deviceOutputID = unsigned int, DeviceOutputID of the device output with name ‘name’ from device with the ID ‘deviceID’

Usage Example: retrieve the DeviceOutputID for a named output

DeviceOutputID = vicon.GetDeviceOutputIDFromName( 1, ‘Force’ )
GetEvents(subject, context, event)

Return all of the events that match the specified subject, context, and event type

Input

subject = string, name of an existing subject context = string, name of the context.

*** use the DisplayCommandHelp method to get more information on
context names that are valid for the connected application
event = string, name of the event type.
*** use the DisplayCommandHelp method to get more information on
event type names that are valid for the connected application
Returns

frames = integer list, list of the event frame numbers offsets = double list, offset (in seconds) from the beginning of the frame

to the event occurrence for each event The value should be in the range of 0.00 to 1/FrameRate

Usage Example:

frames, offsets = vicon.GetEvents( ‘Patricia’, ‘Left’, ‘Foot Strike’ )
GetFrameRate()

Retrieves the base frame rate for the loaded trial

GetJointDetails(subject, joint)

Retrieves detailed information about a joint

Input
subject = string, name of an existing subject joint = string, name of an existing joint for the subject
Returns
parent = string, name of the parent segment child = string, name of the child segment

Usage Example: Display information about the first joint

joints = vicon.GetJointNames( ‘Colin’ ) firstjoint = joints[0] parent, child = vicon.GetJointDetails( ‘Colin’, firstjoint ) JointDisplay = ‘Joint: ‘ % firstjoint % ‘ ( ‘ % parent % ‘ - ‘ % child, ‘ )’ print JointDisplay
GetJointNames(subject)

Retrieve the names of the joints associated with the specified subject

Input
subject = string, name of an existing subject
Returns
names = list of strings, one for each joint

Usage Example: Display the name of the first joint

joints = vicon.GetJointNames( ‘Colin’ ) firstjoint = joints[0] print firstjoint
GetMarkerNames(subject)

Retrieve the names of the markers associated with the specified subject

Input
subject = string, name of an existing subject
Returns
names = list of strings, one for each marker

Usage Example: Display the name of the first marker

markers = vicon.GetMarkerNames( ‘Colin’ ) firstmarker = markers[0] print firstmarker
GetModelOutput(subject, modelOutputName)

Get the data values for all components of a model output for all frames in the trial

Input
subject = string, name of an existing subject modelOutputName = string, name of an existing model output associated with the subject
Returns
components = numerical(double) NxM matrix where N is the number of components, M is the number of frames e = logical list, T/F indication as to whether the data exists for each frame

Usage Example: Copy the data from one model output to another

[data, exists] = vicon.GetModelOutput( ‘Colin’, ‘LeftHipAngle’ ) vicon.SetModelOutput( ‘Colin’, ‘NewAngle’, data, exists )
GetModelOutputAtFrame(subject, modelOutputName, frame)

Get the data values for all components of a model output at a specific frame

Input
subject = string, name of an existing subject modelOutputName = string, name of an existing model output associated with the subject frame = integer value, trial frame number as displayed in the application time bar
Returns
components = numerical(double) list, one value for each component e = logical value, T/F indication as to whether the data exists for the frame

Usage Example: offset model output data by 100.0 at frame 50

data, exists = vicon.GetModelOutputAtFrame( ‘Colin’, ‘NewAngle’, 50 ) for value in data:

value = value + 100.0

vicon.SetModelOutputAtFrame( ‘Colin’, ‘NewAngle’, 50, data, True )

GetModelOutputDetails(subject, modelOutputName)

Retrieve detailed information about a model output

Input
subject = string, name of an existing subject modelOutputName = string, name of an existing model output associated with the subject
Returns

group = string, name of the group the model output belongs to components = list of strings, list of component names for the model output types = list of strings, list of the quantity types for each component

*** use the DisplayCommandHelp method to get more information on quantity types that are valid for the connected application

Usage Example: Create a new model output with the same properties as an existing model output

group, components, types = vicon.GetModelOutputDetails( ‘Colin’, ‘LeftHipAngle’ ) vicon.CreateModelOutput( ‘Colin’, ‘NewModelOutput’, group, components, types )
GetModelOutputNames(subject)

Retrieve the names of the model outputs associated with the specified subject

Input
subject = string, name of an existing subject
Returns
names = list of strings, one for each model output

Usage Example: Display the name of the first model output

modeloutputs = vicon.GetModelOutputNames( ‘Colin’ ) firstmodeloutput = modeloutputs[0] print firstmodeloutput
GetRootSegment(subject)

Retrieve the name of the root segment associated with the specified subject

Input
subject = string, name of an existing subject
Returns
name = string, name of the root segment

Usage Example: Display the children of the root segment

root = vicon.GetRootSegment( ‘Colin’ ) children = vicon.GetSegmentDetails( ‘Colin’, root )[1] for child in children:

print child
GetSegmentDetails(subject, segment)

Retrieves detailed information about a segment

Input
subject = string, name of an existing subject segment = string, name of an existing segment for the subject
Returns
parent = string, name of the parent segment
*** the root segment will have a parent named ‘World’

children = list of strings, names of the child segments markers = list of strings, names of the markers associated with the segment

Usage Example: Display the children of the root segment

root = vicon.GetRootSegment( ‘Colin’ ) children = vicon.GetSegmentDetails( ‘Colin’, root )[1] for child in children:

print child
GetSegmentNames(subject)

Retrieve the names of the segments associated with the specified subject

Input
subject = string, name of an existing subject
Returns
names = list of strings, one for each segment

Usage Example: Display the name of the first segment

segments = vicon.GetSegmentNames( ‘Colin’ ) firstsegment = segments[0] print firstsegment
GetServerInfo()

Return information about the connected server

GetSplineResults(derivative)

Return derivative values from an initialized spline object.

Input
frames = numerical(int) list, frame numbers of the supplied data x = numerical(double) list, x-coordinate of the trajectory y = numerical(double) list, y-coordinate of the trajectory z = numerical(double) list, z-coordinate of the trajectory frameRate = double, frame rate of the supplied data

Usage Example:

frameRate = vicon.GetFrameRate() startFrame, endFrame = vicon.GetTrialRange() frames = range( startFrame, endFrame + 1 ) [trajX, trajY, trajZ, e] = vicon.GetTrajectory( ‘Colin’, ‘LKNE’ ) # get valid indices; we only want to submit good values here! validIndices = [ x for x, y in enumerate(e) if y ] validF = [ frames[ Index ] for Index in validIndices ] validX = [ trajX[ Index ] for Index in validIndices ] validY = [ trajY[ Index ] for Index in validIndices ] validZ = [ trajZ[ Index ] for Index in validIndices ] vicon.SubmitSplineTrajectory(validF, validX, validY, validZ, frameRate)

accX, accY, accZ = vicon.GetSplineResults(2);

GetSubjectInfo()

Retrieves the names, templates and active states of the currently loaded subjects

Returns
names = list of strings, one for each subject templates = list of strings, one for each subject active = list of bools, one for each subject

Usage Example: list the names of the currently loaded subjects

subjects, templates, activeStates = vicon.GetSubjectInfo() for subject, template, active in zip( subjects, templates, activeStates ):

print ‘Subject Name: {}, Template Name: {}, Active: {}’.format( subject, template, active )
GetSubjectNames()

Retrieves the names of the currently loaded subjects

Returns
names = list of strings, one for each subject

Usage Example: list the names of the currently loaded subjects

subjects = vicon.GetSubjectNames() for subject in subjects:

print subject
GetSubjectParam(subject, param)

Retrieve the current value of a static subject parameter

Input
subject = string, name of an existing subject param = string, name of an existing subject parameter
Returns
value = floating point number, current value of the subject parameter hasvalue = logical, indication as to whether the subject parameter has a value

Usage Example: negate the value of a subject parameter

value = vicon.GetSubjectParam( ‘Colin’, ‘MyParam’ ) value = value * (-1) vicon.SetSubjectParam( ‘Colin’, ‘MyParam’, value )
GetSubjectParamDetails(subject, param)

Retrieve detailed information about a subject parameter

Input
subject = string, name of an existing subject param = string, name an existing subject parameter
Returns

value = floating point number, current value of the subject parameter unit = string, unit associated with the value

*** use the DisplayCommandHelp method to get more information on
units that are valid for the connected application

default = floating point number, PRIOR value of the subject parameter required = logical, indication as to whether the subject parameter is a required parameter hasvalue = logical, indication as to whether the subject parameter has a value

Usage Example: Display subject parameter details

value, unit, default, required = vicon.GetSubjectParamDetails( ‘Colin’, ‘MyParam’ ) isRequired = ‘ Not Required’ if( required ):

isRequired = ‘ Required’

SubjectParamInfo = ‘MyParam = {0} [{1}] Default={2}, {3}’.format( value, unit, default, isRequired ) print SubjectParamInfo

GetSubjectParamNames(subject)

Retrieve the names of the static subject parameters associated with the specified subject

Input
subject = string, name of an existing subject
Returns
names = list of strings, one for each subject parameter

Usage Example: Display all of the subject parameters

subjectparams = vicon.GetSubjectParamNames( ‘Colin’ ) print subjectparams
GetTrajectory(subject, marker)

Get all frames of data for the trial for the specified marker.

Input
subject = string, name of an existing subject marker = string, name of an existing marker
Returns
x = numerical(double) list, x-coordinates of the trajectory y = numerical(double) list, y-coordinates of the trajectory z = numerical(double) list, z-coordinates of the trajectory e = logical list, T/F indication as to whether the data exists for each frame

Usage Example: Display trajectory coordinate at frame 50

trajX, trajY, trajZ, trajExists = vicon.GetTrajectory( ‘Colin’, ‘C7’ ) doesexist = ‘ - Missing Data’ if( trajExists[49] ):

doesexist = ‘ - exists’

framedata = ‘frame 50 = ({0}, {1}, {2}){3}’.format( trajX[49], trajY[49], trajZ[49], doesexist ) print framedata

GetTrajectoryAtFrame(subject, marker, frame)

Get trajectory data at a specific frame for the specified marker

Input
subject = string, name of an existing subject marker = string, name of an existing marker frame = integer value, trial frame number as displayed in the application time bar
Returns
x = double value, x-coordinate of the trajectory y = double value, y-coordinate of the trajectory z = double value, z-coordinate of the trajectory e = logical value, T/F indication as to whether the data exists for the frame

Usage Example: Display trajectory coordinate at frame 50

[markerX, markerY, markerZ, markerExists] = vicon.GetTrajectoryAtFrame( ‘Colin’, ‘C7’, 50 ) doesexist = ‘ - Missing Data’ if( markerExists ):

doesexist = ‘ - exists’

framedata = [‘frame 50 = ‘, num2str(markerX), ‘, ‘, num2str(markerY), ‘, ‘, num2str(markerZ), doesexist ] print framedata

GetTrialName()

Retrieves the name and path for the loaded trial

Returns
path = string, path to the trial on disk name = string, name of the trial

Usage Example: create a filename to be used for a user generated output file

path, name = vicon.gettrialname() MyFilename = path % name %’.MyFile’
GetTrialRange()

Retrieves the starting and ending frame numbers of the updateable range for the loaded trial

GetTrialRegionOfInterest()

Retrieves the starting and ending frame numbers of the user set region of interest for the loaded trial

GetUnlabeled(index)

Get all frames of data for the trial for the specified unlabeled trajectory.

Input
index = index of the unlabeled trajectory to return
Returns
x = numerical(double) list, x-coordinates of the trajectory y = numerical(double) list, y-coordinates of the trajectory z = numerical(double) list, z-coordinates of the trajectory e = logical list, T/F indication as to whether the data exists for each frame

Usage Example: Display trajectory coordinate at frame 50 of unlabeled trajectory 25

trajX, trajY, trajZ, trajExists = vicon.GetUnlabeled( 25 ) doesexist = ‘ - Missing Data’ if( trajExists[49] ):

doesexist = ‘ - exists’

framedata = ‘frame 50 = ({0}, {1}, {2}){3}’.format( trajX[49], trajY[49], trajZ[49], doesexist ) print framedata

GetUnlabeledCount()

Returns the number of unlabeled trajectories in the loaded trial

HasTrajectory(subject, marker)

Returns true if the specified marker is associated with a trajectory

Input
subject = string, name of an existing subject marker = string, name of an existing marker
Returns
exists = T/F indication as to whether the specified marker is associated with a trajectory
OpenTrial(trial, timeout)

Open a trial in the connected host application. This command may be used from within Python but can not be used in a script that is executing from the application. The trial will fail to load if a pipeline is running, the application is in live mode, the ENF file for the trial can not be located, or the application is in a state where trial opening is prohibited.

If unsaved data is currently loaded in the application, the application may prompt you to save the data. To prevent the application prompt, you should save the current trial data prior to attempting to load another trial.

Input

trial = string, name of an existing trial including its full path, excluding any file extensions. timeout = integer value, timeout value (in seconds) used to return control in the case that

the trial does not open in a timely fashion. It is important to note that the timeout value has no effect in the host application itself and the trial may continue to load after the time allocated has expired.

Usage Example:

vicon.OpenTrial( r’C:UsersPublicDocumentsViconNexus Sample DataColinWalking TrialsWalking 2’, 30 )
RunPipeline(pipeline, location, timeout)

Run a pipeline in the connected host application. This command may be used from within Python but can not be used in a script that is executing from the application. The pipeline will fail to run if another pipeline is already in progress.

Input

pipeline = string, name of an existing pipeline. location = string, location of the pipeline. Pass a blank string to use the default

searching mechanism to locate the pipeline. Valid options when specifying the pipeline location are Private, Shared or System.
timeout = integer value, timeout value (in seconds) used to return control in the case that
the pipeline does not complete in a timely fashion. It is important to note that the timeout value has no effect in the host application itself and the pipeline may continue to run after the time allocated has expired.

Usage Example:

vicon.RunPipeline( ‘Reconstruct’, ‘’, 45 )
SaveTrial(timeout)

Save the trial currently open in the connected host application to disk. This command may be used from within Python but can not be used in a script that is executing from the application. The trial will fail to save if a pipeline is running or the application is is live mode.

Input
timeout = integer value, timeout value (in seconds) used to return control in the case that
the trial does not save in a timely fashion. It is important to note that the timeout value has no effect in the host application itself and the trial may continue to save after the time allocated has expired.

Usage Example:

vicon.SaveTrial( 30 )
SetAnalysisParam(subject, param, value)

Set the current value of an analysis parameter

Input
subject = string, name of an existing subject param = string, name of an existing analysis parameter value = floating point number, desired value of the analysis parameter

Usage Example: negate the value of a analysis parameter

value = vicon.GetAnalysisParam( ‘Colin’, ‘MyParam’ ) value = value * (-1) vicon.SetAnalysisParam( ‘Colin’, ‘MyParam’, value )
SetDeviceChannel(deviceID, deviceOutputID, channelID, channelData)

Update a single channel of device data for the specified deviceID:deviceOutputID:channelID combination A device can have multiple device outputs and each device output can have multiple channels associated with it

You may not update frames of data that have been marked as missing in the originally captured data, data for missing frames will be presented with zero values when retrieving data and input values for those frames will be ignored when updating the device data, although it must be supplied.

Devices can run at different rates than the trial data. Channel data could have multiple samples for each data frame. Channel data must be supplied for all of the samples. In the case that the channel sample rate is higher than the trial frame rate channel data is interpreted as:

frame1[sample1], frame1[sample2], … frame1[sampleN], … frameN[sample1], frameN[sample2], … frameN[sampleN]
Input
deviceID = unsigned int, DeviceID of an existing device deviceOutputID = unsigned int, DeviceOutputID of the device output channelID = unsigned int, ID of the channel channelData = numerical(double) list, channel data list of size NumberOfFrames * samplesPerFrame

Usage Example:

SetDeviceChannelAtFrame(deviceID, deviceOutputID, channelID, frame, channelData)

Update a single frame for a single channel of device data for the specified deviceID:deviceOutputID combination A device can have multiple channels associated with it

You may not update frames of data that have been marked as missing in the originally captured data, data for missing frames will be presented with zero values when retrieving data and input values for those frames will be ignored when updating the device data, although it must be supplied.

CAUTION: updating multiple frames of device data using this may execute noticably slower than using a single call to SetDeviceChannel supplying sample data for each trial frame even if they have not changed depending on the number of samples you are updating.

Devices can run at different rates than the trial data. Channel data could have multiple samples for each trial frame. Channel data list must be in the format:

[sample1], [sample2], … [sampleN]
Input
deviceID = unsigned int, DeviceID of and existing device deviceOutputID = unsigned int, DeviceOutputID of the device output you are interested in channelID = unsigned int, ID of the channel frame = integer value, trial frame number as displayed in the application time bar channelData = numerical(double) list, component data list for the frame of size samplesPerFrame

Usage Example:

SetModelOutput(subject, modelOutputName, components, e)

Set the data values for all components of a model output for all frames in the trial

Input
subject = string, name of the subject modelOutputName = string, name of an existing model output associated with the subject components = numerical(double) NxM matrix where N is the number of components, M is the number of frames e = logical list, T/F indication as to whether the data exists for each frame

Usage Example: Copy the data from one model output to another

[data, exists] = vicon.GetModelOutput( ‘Colin’, ‘LeftHipAngle’ ) vicon.SetModelOutput( ‘Colin’, ‘NewAngle’, data, exists )
SetModelOutputAtFrame(subject, modelOutputName, frame, components, e)

Set the data values for all components of a model output at a specific frame

Input
subject = string, name of an existing subject modelOutputName = string, name of an existing model output associated with the subject frame = integer value, trial frame number as displayed in the application time bar components = numerical(double) list, one value for each component e = logical value, T/F indication as to whether the data exists for the frame

Usage Example: offset model output data by 100.0 at frame 50

data, exists = vicon.GetModelOutputAtFrame( ‘Colin’, ‘NewAngle’, 50 ) for value in data:

value = value + 100.0

vicon.SetModelOutputAtFrame( ‘Colin’, ‘NewAngle’, 50, data, True )

SetSubjectActive(subjectName, activeState)

Set the active state of a subject by name

Usage Examples:

subjects = vicon.GetSubjectNames(); for subject in subjects:

# enable all subjects vicon.SetSubjectActive( subject, ‘1’ )
for subject in subjects:
# disable all subjects vicon.SetSubjectActive( subject, False )
for subject in subjects:
# enable all subjects again vicon.SetSubjectActive( subject, 1 )

# enable only the first subject vicon.SetSubjectActive( subjects[0], ‘Exclusive’ )

SetSubjectParam(subject, param, value, bForce=False)

Set the current value of a static subject parameter

Input
subject = string, name of an existing subject param = string, name of an existing subject parameter value = floating point number, desired value of the subject parameter

Usage Example: negate the value of a subject parameter

value = vicon.GetSubjectParam( ‘Colin’, ‘MyParam’ ) value = value * (-1) vicon.SetSubjectParam( ‘Colin’, ‘MyParam’, value )
SetTrajectory(subject, marker, x, y, z, e)

Update all of the data values for all frames in the trial for the specified marker.

Input
subject = string, name of an existing subject marker = string, name of an existing marker x = numerical(double) list, x-coordinate of the trajectory y = numerical(double) list, y-coordinate of the trajectory z = numerical(double) list, z-coordinate of the trajectory e = logical list, T/F indication as to whether the data exists for each frame

Usage Example: Put the trajectory at 0,0,0 for all frames

frameCount = vicon.GetFrameCount() trajX = [0]*frameCount trajY = [0]*frameCount trajZ = [0]*frameCount exists = [True]*frameCount

vicon.SetTrajectory(‘Colin’,’C7’,trajX,trajY,trajZ,exists)

SetTrajectoryAtFrame(subject, marker, frame, x, y, z, e)

Update the trajectory data values at a specific frame for the specified marker

Input
subject = string, name of an existing subject marker = string, name of an existing marker frame = integer value, trial frame number as displayed in the application time bar x = double value, x-coordinate of the trajectory y = double value, y-coordinate of the trajectory z = double value, z-coordinate of the trajectory e = logical value, T/F indication as to whether the data exists for the frame

Usage Example: Create a gap at frame 50

vicon.SetTrajectoryAtFrame( ‘Colin’, ‘C7’, 50, 0.0, 0.0, 0.0, False )
SetTrialRegionOfInterest(startFrame, EndFrame)

Sets the starting and ending frame numbers of the user set region of interest for the loaded trial

SubmitSplineTrajectory(frames, xData, yData, zData, frameRate)

Initialize a spline object

Input
frames = numerical(int) list, frame numbers of the supplied data x = numerical(double) list, x-coordinate of the trajectory y = numerical(double) list, y-coordinate of the trajectory z = numerical(double) list, z-coordinate of the trajectory frameRate = double, frame rate of the supplied data

Usage Example:

frameRate = vicon.GetFrameRate() startFrame, endFrame = vicon.GetTrialRange() frames = range( startFrame, endFrame + 1 ) [trajX, trajY, trajZ, e] = vicon.GetTrajectory( ‘Colin’, ‘LKNE’ ) # get valid indices; we only want to submit good values here! validIndices = [ x for x, y in enumerate(e) if y ] validF = [ frames[ Index ] for Index in validIndices ] validX = [ trajX[ Index ] for Index in validIndices ] validY = [ trajY[ Index ] for Index in validIndices ] validZ = [ trajZ[ Index ] for Index in validIndices ] vicon.SubmitSplineTrajectory(validF, validX, validY, validZ, frameRate)