opensimModel#

class pyCGM2.Model.Opensim.osimProcessing.opensimModel(osimFile, cgmModel)#

Wrapper of an OpenSim model associated with a pyCGM2 model.

Parameters:
__init__(osimFile, cgmModel)#

Methods

__init__(osimFile, cgmModel)

addMarkerSet(markersetFile)

Replace the marker set of the model.

addmarkerFromModel(label[, osimBodyName, ...])

Create an OpenSim marker from a node of the pyCGM2 model.

createMarkerSet()

Add the created markers to the marker set of the OpenSim model.

setOsimJoinCentres(R_OSIM_CGM, ...[, toMeter])

Set the location of an OpenSim joint from a joint centre of the pyCGM2 model.

updateMarkerInMarkerSet(label[, ...])

Update the location of a marker of the marker set from the pyCGM2 model.

addMarkerSet(markersetFile)#

Replace the marker set of the model.

Parameters:

markersetFile (str) – Path of the marker set file.

addmarkerFromModel(label, osimBodyName='', modelSegmentLabel='', rotation_osim_model=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]), toMeter=1000.0)#

Create an OpenSim marker from a node of the pyCGM2 model.

Parameters:
  • label (str) – Node label.

  • osimBodyName (str, optional) – OpenSim body name.

  • modelSegmentLabel (str, optional) – pyCGM2 segment label.

  • rotation_osim_model (np.ndarray, optional) – Rotation from pyCGM2 to OpenSim segment frame.

  • toMeter (float, optional) – Conversion factor to metres. Defaults to 1000.0.

createMarkerSet()#

Add the created markers to the marker set of the OpenSim model.

setOsimJoinCentres(R_OSIM_CGM, jointLabelInOsim, parentSegmentLabel, childSegmentLabel, nodeLabel, toMeter=1000.0)#

Set the location of an OpenSim joint from a joint centre of the pyCGM2 model.

Parameters:
  • R_OSIM_CGM (dict) – Rotation matrices from pyCGM2 to OpenSim segment frames, by segment label.

  • jointLabelInOsim (str) – Joint name in the OpenSim model.

  • parentSegmentLabel (str) – Parent segment label in the pyCGM2 model.

  • childSegmentLabel (str) – Child segment label in the pyCGM2 model.

  • nodeLabel (str) – Label of the joint-centre node.

  • toMeter (float, optional) – Conversion factor to metres. Defaults to 1000.0.

updateMarkerInMarkerSet(label, modelSegmentLabel='', rotation_osim_model=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]), toMeter=1000.0)#

Update the location of a marker of the marker set from the pyCGM2 model.

Parameters:
  • label (str) – Marker label.

  • modelSegmentLabel (str, optional) – pyCGM2 segment label.

  • rotation_osim_model (np.ndarray, optional) – Rotation from pyCGM2 to OpenSim segment frame.

  • toMeter (float, optional) – Conversion factor to metres. Defaults to 1000.0.