---
title: "findDeviantKeys"
canonical: "https://help.vicon.com/space/ShogunPost121/1253738781/findDeviantKeys"
format: markdown
---
# Description

Finds and selects keys that deviate over a tolerance between the active clip and another clip. Both clips must have a key at each frame for the comparison to be done.

This is useful when comparing the results of an editing operation with the second figure clip.

## Functional area

Data retrieval

# Command syntax

## Syntax

> Macro (scroll-tablelayout)

|  |
| --- |
| `findDeviantKeys compareClip tolerance length [-ranges] [-primaryOnly] [-selectRanges] [-noFeedback] [-positionOnly] [-rotationOnly]` |

### Arguments

> Macro (scroll-tablelayout)

| Name | Type | Required | Comments |
| --- | --- | --- | --- |
| `compareClip` | string | yes | Name of the clip to compare with. |
| `tolerance` | float | yes | Value in millimeters that key values must be deviant to be selected. |
| `length` | integer | yes | Number of consecutive frames that keys must be deviant to be selected. |

> Macro (scroll-pagebreak)

### Flags

> Macro (scroll-tablelayout)

| Name | Flag arguments | Argument type | Exclusive to | Comments |
| --- | --- | --- | --- | --- |
| `ranges` | 0 | — | — | Restricts the search to the selected time ranges. The default is to search the entire animation range. |
| `primaryOnly` | 0 | — | — | Restricts the search to the primary selected node. The default is to search all selected nodes. |
| `selectRanges` | 0 | — | — | Specifies that the ranges of the deviant keys should be selected as well. |
| `noFeedback` | 0 | — | — | Set this flag to skip writing the results of the operation to the log |
| `positionOnly` | 0 | — | primaryOnly, selectRanges | Check position deviance only, ignoring rotational deviance |
| `rotationOnly` | 0 | — | ranges, selectRanges | Check rotational deviance only, ignoring positional deviance |

## Return value

integer

Returns the number of deviant keys 

> Macro (scroll-pagebreak)

## Examples

```plaintext
// Import a file and create a second figure
loadFile "C:/temp/myFile.c3d" -i -createSecondFig;
 
// Select and filter the head markers using the current filter settings
select LFHD RFHD LBHD RBHD;
selectRange -all;filter;
 
// Now select the keys that deviate from the second figure clip
// by at least 5 mm over at least 10 consecutive keys. 
// Also select the deviant ranges. 
findDeviantKeys myFilec3d_2fg 5 10 -selectRanges;
// Do something with those keys/ranges!
```

# Additional information

## Related commands

- [fillGaps](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253738229)
- [findBadData](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737116)
- [findNonRigid](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737702)
- [findSelectedKeys](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253738574)