Next: , Previous: , Up: Internal Routines   [Contents][Index]

#### 15.5.231 find_minloc

```find_minloc(data [, sign, diagonal=diagonal, /degree, /subgrid, /coords])```

By default, seeks local minima in `data` and returns their positions as indices to `data`. If `/coords` is specified, then the coordinates of the positions are returned (with the first dimension sampling the different coordinates). `data` must be numerical and may have multiple dimensions.

If `diagonal` is specified, then it must be an array with one element per dimension of `data`. The elements that are equal to 0 indicate which dimensions are not checked for a local minimum. The elements that are equal to 1 and 2 (after conversion to type `long`) indicate in which dimensions checking is performed. The elements that are equal to 2 indicate in which dimensions checked directions may be diagonal. All such directions either have non-zero coordinate offsets only in those dimensions, or have only a single non-zero coordinate offset (i.e., a non-diagnonal or orthogonal direction). Only approved directions are checked for their data curvature. If `diagonal` contains `n1` ones and `n2` twos, then the number of directions per data element in `n` dimensions that will be considered is equal to ```m = (3^n2 - 1)/2 + n1```.

For example, regard a two-dimensional array. We’ll call the first dimension the east-west direction and the second one the north-south dimension. Then, if `diagonal = [1,0]`, all points are returned that are local minima in the east-west direction without regards to any other direction. If `diagonal = [1,1]`, then all points are returned that are local minima in the east-west direction and also in the north-south direction, without regards to the other (northeast-southwest, southeast-northwest) directions. If `diagonal = [2,2]`, then all directions are checked.

For a three-dimensional array, if `diagonal = [2,2,0]`, then the only checked directions that have a non-zero third coordinate offset are those that are along the 3rd axis. If ```diagonal = [1,1,0]```, then only directions along the first two axes are checked.

If `/degree` is specified, then the number of directions per data element where the data shows a local minimum is returned instead. This number always lies between 0 and the total number `m` of directions given above. `find_min(data, /degree) eq m` returns an array with 1s at all positions returned by `find_min(data)`, but the latter form is considerably faster because for each element it stops checking as soon as a direction without a local minimum is found. For noise data in arbitrary numbers of dimensions, on average at most 2 local minimum comparisons per data element are performed if `/degree` is not specified, compared to `m`, which is grows exponentially with the number of dimensions in the worst case, if `/degree` is specified..

The used algorithm decides whether a particular data point is a local minimum by looking at its nearest neighbors only. This means that it cannot decide if a region in which all adjacent data values are equal constitutes a local minimum. Such regions are ignored.