---
title: "What's new in CGM2?"
canonical: "https://help.vicon.com/space/Nexus220/897714945/What's%20new%20in%20CGM2%3F"
format: markdown
---
Depending on the version of Nexus you are using, the following updates apply.

For information on the updates made by Dr Fabien Leboeuf (University of Salford) to the Conventional Gait Model 2 (CGM2) that is included with Nexus, see the [pyCGM2 changelog](https://pycgm2.netlify.app/changelog/).

## Updates to using CGM2 with Nexus 2.14 and later

Nexus 2.14 and later included the following updates:

- CGM2 version updated to v4.2.
- CGM2 now uses Python 3.
- New operations for event detection and Kalman gap-filling (see [Additional information about CGM2](https://vicon-help.atlassian.net/wiki/spaces/Nexus220/pages/897714951/Use+pyCGM2+in+Vicon+Nexus#CGM2AdditionalInfo)).
- In Nexus, all CGM2 pipeline operations are now displayed in their own section in the **Available Operations** list in the** Pipeline Tools **pane.

## Updates to using CGM2 with Nexus 2.20

Nexus 2.20 and later includes the following updates:

- CGM2 operations now run the python scripts directly from the appropriate …*site-packages\pyCGM2\Apps\ViconApps* folders rather than calling the .*exe* files located in *Python\Scripts* folder.

### Modified scripts

These scripts have been added to the Nexus installation:

- *Python\Scripts\CGM1_1_CalibrationUpdatedImports.py*
- *Python\Scripts\CGM1_1_FittingUpdatedImports.py*
- *Python\Scripts\CGM1_CalibrationUpdatedImports.py*
- *Python\Scripts\CGM1_FittingUpdatedImports.py*
- *Python\Scripts\KalmanGapFillingUpdatedImports.py*
- *Python\Scripts\zeniDetectorUpdatedImports.py*

When you run the **CGM2 - Kalman gap filling, CGM2 - Calibration **(Model Version 1.0 and 1.1), **CGM2 - Fitting **(Model Version 1.0 and 1.1) or the **CGM2 - Event Detection (Zeni)** operations from Nexus, using the Nexus-installed version of pyCGM2 (determined by Environment Activation parameter not being set), they call the *UpdatedImports* version of the scripts rather than the scripts in the pyCGM2 package.

> ℹ️ **Note**  
> ℹ️ The only difference between the *UpdatedImports* version of the scripts and the original is the ordering of the import statements at the top of the file.

If the Environment Activation parameter has been set, the original version of the scripts located in *Python\Lib\site-packages\pyCGM2\Apps\ViconApps* is called.

The scripts in use in the Nexus operations are:

```
    std::map<VOpCGM2::EVersion, std::string> s_ModelScriptsCalibration{
    {VOpCGM2::EVersion::E1_0, "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\CGM1\\CGM1_Calibration.py"},
    {VOpCGM2::EVersion::E1_1, "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\CGM1_1\\CGM1_1_Calibration.py"},
    {VOpCGM2::EVersion::E2_1, "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\CGM2_1\\CGM2_1_Calibration.py"},
    {VOpCGM2::EVersion::E2_2, "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\CGM2_2\\CGM2_2_Calibration.py"},
    {VOpCGM2::EVersion::E2_3, "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\CGM2_3\\CGM2_3_Calibration.py"},
    {VOpCGM2::EVersion::E2_4, "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\CGM2_4\\CGM2_4_Calibration.py"},
    {VOpCGM2::EVersion::E2_5, "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\CGM2_5\\CGM2_5_Calibration.py"}};

  std::map<VOpCGM2::EVersion, std::string> s_ModelScriptsCalibrationRunFromNexus{
    {VOpCGM2::EVersion::E1_0, "Scripts\\CGM1_CalibrationUpdatedImports.py"},
    {VOpCGM2::EVersion::E1_1, "Scripts\\CGM1_1_CalibrationUpdatedImports.py"},
    {VOpCGM2::EVersion::E2_1, "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\CGM2_1\\CGM2_1_Calibration.py"},
    {VOpCGM2::EVersion::E2_2, "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\CGM2_2\\CGM2_2_Calibration.py"},
    {VOpCGM2::EVersion::E2_3, "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\CGM2_3\\CGM2_3_Calibration.py"},
    {VOpCGM2::EVersion::E2_4, "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\CGM2_4\\CGM2_4_Calibration.py"},
    {VOpCGM2::EVersion::E2_5, "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\CGM2_5\\CGM2_5_Calibration.py"}};

  std::map<VOpCGM2::EMethod, std::string> s_ModelScriptsFunctionalCalibration{
    {VOpCGM2::E2DoF, "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\CGM2_6\\CGM_Knee2DofCalibration.py"},
    {VOpCGM2::ESARA, "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\CGM2_6\\CGM_KneeSARA.py"}};

  std::map<VOpCGM2::EVersion, std::string> s_ModelScriptsFitting{
    {VOpCGM2::EVersion::E1_0, "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\CGM1\\CGM1_Fitting.py"},
    {VOpCGM2::EVersion::E1_1, "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\CGM1_1\\CGM1_1_Fitting.py"},
    {VOpCGM2::EVersion::E2_1, "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\CGM2_1\\CGM2_1_Fitting.py"},
    {VOpCGM2::EVersion::E2_2, "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\CGM2_2\\CGM2_2_Fitting.py"},
    {VOpCGM2::EVersion::E2_3, "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\CGM2_3\\CGM2_3_Fitting.py"},
    {VOpCGM2::EVersion::E2_4, "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\CGM2_4\\CGM2_4_Fitting.py"},
    {VOpCGM2::EVersion::E2_5, "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\CGM2_5\\CGM2_5_Fitting.py"}};

  std::map<VOpCGM2::EVersion, std::string> s_ModelScriptsFittingRunFromNexus{
    {VOpCGM2::EVersion::E1_0, "Scripts\\CGM1_FittingUpdatedImports.py"},
    {VOpCGM2::EVersion::E1_1, "Scripts\\CGM1_1_FittingUpdatedImports.py"},
    {VOpCGM2::EVersion::E2_1, "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\CGM2_1\\CGM2_1_Fitting.py"},
    {VOpCGM2::EVersion::E2_2, "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\CGM2_2\\CGM2_2_Fitting.py"},
    {VOpCGM2::EVersion::E2_3, "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\CGM2_3\\CGM2_3_Fitting.py"},
    {VOpCGM2::EVersion::E2_4, "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\CGM2_4\\CGM2_4_Fitting.py"},
    {VOpCGM2::EVersion::E2_5, "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\CGM2_5\\CGM2_5_Fitting.py"}};

  const std::string s_ModelScriptZeni = "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\Events\\zeniDetector.py";
  const std::string s_ModelScriptKalman = "Lib\\site-packages\\pyCGM2\\Apps\\ViconApps\\MoGapFill\\KalmanGapFilling.py";

  const std::string s_ModelScriptZeniRunFromNexus = "Scripts\\zeniDetectorUpdatedImports.py";
  const std::string s_ModelScriptKalmanRunFromNexus = "Scripts\\KalmanGapFillingUpdatedImports.py";
```

> ✅ **Tip**  
> ✅ Note the use of two backslashes `\\` in the code, to represent a single backslash `\`.

### How to run a version of CGM2 that is not the version installed with Nexus

Earlier versions of Nexus require any type of Environment Activation to set the path to the Python folder and the folder containing the pyCGM2 .*exe* files. In Nexus 2.20 and later, the scripts are called directly, so the Environment Activation must be made aware of the relative paths to the scripts and must set things up appropriately to locate the scripts.

### Example of running an older version of CGM2

Running the CGM2 installation located in the *Nexus2.18* installation folder, you could just create a .*bat* file with the following:

```
set PATH=C:\Program Files\Vicon\Nexus2.18\Python;C:\Program Files\Vicon\Nexus2.18\Python\Scripts;%PATH%
cd /d "C:\Program Files\Vicon\Nexus2.18\Python"
```

The `cd` command changes the current working directory to the parent folder of the relative path to the pyCGM2 script. The full path to the CGM2_5_Fitting script is:

*C:\Program Files\Vicon\Nexus2.18\Python\Lib\site-packages\pyCGM2\Apps\ViconApps\CGM2_5\CGM2_5_Fitting.py*

The relative path is:

*Lib\site-packages\pyCGM2\Apps\ViconApps\CGM2_5\CGM2_5_Fitting.py*

The current working directory is set to:

*C:\Program Files\Vicon\Nexus2.18\Python*

And the call that the operation makes is:

`CGM2 - Fitting Executing "C:/Users/Public/Documents/Vicon/Nexus2.18/NexusLocalPythonForCGM2.bat" && "python.exe" "C:/Users/Public/Documents/Vicon/Nexus2.20\CGM2Version.py" && "python.exe" "Lib\site-packages\pyCGM2\Apps\ViconApps\CGM2_5\CGM2_5_Fitting.py" -md=14`

Where *NexusLocalPythonForCGM2.bat *does the following:

- Sets the PATH to the Python folder so that *python.exe* can be found.
- Changes the current working directory to the parent of the `“Lib\site-packages\pyCGM2\Apps\ViconApps”` folder so that the relative path to the script finds the .*py* file.

The format to enable it to find the path is:

*C:\Program Files\Vicon\Nexus2.18\Python\Lib\site-packages\pyCGM2\Apps\ViconApps\CGM2_5\CGM2_5_Fitting.py*

Where:

*C:\Program Files\Vicon\Nexus2.18\Python\* is the current working directory

*Lib\site-packages\pyCGM2\Apps\ViconApps\CGM2_5\CGM2_5_Fitting.py* is the relative path to the expected location of the file

> ⚠️ **Important**  
> ⚠️ The current working directory must be set (or you must use some other mechanism to specify the parent folder) such that the relative paths to the script files can be located properly. You may also use the Nexus operation **Run Python Operation** to specify the full path to the script you wish to run.