NextValueInSpike (FPScript)

21.09.2021

Searches for the next value in a spike starting from a given position.

Syntax

NextValueInSpike(DataSet, [ Position ], MinHeight, MaxWidth [ , Direction = EVENT_RIGHT ])

 

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

Part

Description

DataSet

The data set to be searched.

Permitted data structures are data series und signal. 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.

Position

If you are searching in a signal, this is the X value where the search is to start. If you are searching a data series, this is the index of the value from which to start the search. A negative index determines a position relative to the end of the data set. If you omit the argument or pass the value Empty, the search starts at the beginning or end of the data set, depending on the search direction. The first or last value of the data set is only taken into account if you omit the argument or pass the Empty value.

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.

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.

Direction

Specifies the direction of the search in the function.

The argument Direction can have the following values:

Constant

Meaning

EVENT_RIGHT

Search to the right.

EVENT_LEFT

Search to the left.

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_RIGHT.

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 the end of the data set is considered the spike end accordingly. If DataSet is a data series, then the result is the index of the value found. If DataSet is a signal, the result is the X value. If no next value could be found in a spike, then the value Empty is output as the result.

The following graphic shows a signal with two spikes highlighted:

Available in

FlexPro Basic, Professional, Developer Suite

Examples

NextValueInSpike(Signal, , 0.2 V, 1, EVENT_LEFT)

Searches in a signal from the signal end to the left for the next value in a spike. The minimum spike height is 0.2 V and the maximum width is one data point. The result is the X value of the found spike.

Signal[[NextValueInSpike(Signal, 4.5 s, 0.2 V, 1)]]

Searches in a signal from position X = 4.5 s to the right for the next value in a spike. The result is the Y value of the found position.

See Also

ValuesInSpikes Function

Event Isolation Analysis Object

Share article or send as email:

You might be interested in these articles