ValuesInSpikes (FPScript)

21.09.2021

Searches a data set for values that belong to a spike.

Syntax

ValuesInSpikes(DataSet, MinHeight, MaxWidth [ , Operation = EVENT_DEFAULT ])

 

The syntax of the ValuesInSpikes function consists of the following parts:

Part

Description

DataSet

The data set to be searched.

Permitted data structures are data series, data matrix, signal und signal series. All numeric data types are permitted.

For complex data types the absolute value is formed.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

MinHeight

Specifies the amount of minimum delta y that must be reached to detect the beginning or end of a spike.

Permitted data structures are scalar value. All numeric data types are permitted. The unit has to be compatible with that of parameter DataSet.

For complex data types the absolute value is formed.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

MaxWidth

Maximum number of data points a spike may have.

Permitted data structures are scalar value. All real data types are permitted.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

Operation

Specifies the mode of operation of the function.

The argument Operation can have the following values:

Constant

Meaning

EVENT_INDEX

The indices of the values or points meeting the condition are placed in the result data set.

EVENT_EXTRACT

Only the points or values meeting the condition are transferred into the result data set.

EVENT_SETVOID

The points or values that do not meet the condition are also included in the result data set, but there they are marked as void.

EVENT_DEFAULT

Corresponds to EVENT_SETVOID if a data matrix or signal series is present, and otherwise EVENT_INDEX.

+ EVENT_COMPLEMENT

This constant can be optionally added and then reverses the selected operation. Then, for example, for EVENT_EXTRACT, the points that do not meet the condition are copied.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value EVENT_DEFAULT.

Remarks

An upward spike is detected, for example, when the signal rises by at least MinHeight and falls at the latest after MaxWidth data points by at least -MinHeight. Spikes located at the beginning or end of the data set are also detected, i.e. the beginning of the data set is considered the spike beginning and accordingly the end of the data set is considered the spike end.

The following graph shows a signal with highlighted spikes with a maximum width of 2 and minimum height of 0.15. The two spikes at the end were omitted because they were too wide or not high enough.

Available in

FlexPro Basic, Professional, Developer Suite

Examples

Arguments s
Dim idx, y, n
idx = ValuesInSpikes(s, 0.1, 1, EVENT_INDEX)
s.y[idx] = ?
return s
 

This example searches for spikes in a signal and produces a signal in which all values belonging to spikes are set to void.

See Also

NextValueInSpike Function

Event Isolation Analysis Object

Share article or send as email:

You might be interested in these articles