ArrayLevelCrossing
ptolemy.actor.lib.ArrayLevelCrossing

Search an array from the specified starting index and report the index of the first item in the array that is below or above the specified threshold. If there is no such item, then -1 is returned. The threshold can be absolute or relative to the value at the starting index. If it is relative, it can be given on a linear scale or in decibels. If the threshold is relative and we are looking for values above the threshold, then values that are above the value at the starting index by more than the threshold are reported. If the threshold is relative and we are looking for values below the threshold, then values that are below the value at the starting index by more than the threshold are reported.

This actor is a generalization of Matlab code developed by John Signorotti of Southwest Research Institute. The original function was called UFDipSearch.

Author(s): Edward A. Lee, Steve Neuendorffer
Version:$Id: ArrayLevelCrossing.java,v 1.19 2005/10/28 19:20:13 cxh Exp $
Pt.Proposed Rating:Yellow (eal)
Pt.Accepted Rating:Red (cxh)


array
The array to search for a threshold crossing. This has type {double}.

output
The output port producing the index of the first bin to break the threshold. This has type int.



above
An indicator of whether to look for values above or below the specified threshold. This is a boolean that defaults to false, which specifies to find values below the threshold.

forwards
The direction to search from the start. If true, search forwards. Otherwise, search backwards. This is a boolean that defaults to true.

scale
An indicator of whether threshold should be interpreted as absolute or relative, and if relative, then on a linear scale, in amplitude decibels, or power decibels. If decibels are used, then the corresponding linear threshold is 10^(threshold/N), where N is 20 (for amplitude decibels) or 10 (for power decibels). This parameter is a string with possible values "absolute", "relative linear", "relative amplitude decibels" or "relative power decibels". The default value is "absolute".

start
The index from which to start looking for a threshold crossing. This is an integer that defaults to 0.

threshold
The threshold to look for. This is a double that can be interpreted on an absolute or relative scale, and if relative, on a linear or decibel scale, depending on the scale parameter. It defaults to 0.0.