Package pype :: Module vectorops
[frames] | no frames]

Module vectorops

source code

Simple vector operations

Implements a bunch of common but useful vector operations using Numeric (if possible). If Numeric's not available, tries to fall back to (slower) raw-python.

Author -- James A. Mazer (mazerj@gmail.com)

Functions
 
find(boolvec)
Find indices of all TRUE elements in boolvec.
source code
 
sem(v, sig=None)
Compute standard error of the mean of vector.
source code
 
zeros(v)
Count number of zero entries in vector.
source code
 
smooth_boxcar(v, kn=1)
Smooth vector using a boxcar (square) filter (ie, running average), where kn=1 is a 3pt average, kn=2 is a 5pt average etc..
source code
 
decimate(v, n)
Simple decimatation (ie, downsampling) vector by n. No effort to be smart about this -- integer decimation only!
source code
 
sparseness(v)
Compute (Tove & Rolls) sparseness of vector.
source code
 
nanround(n, digits=0) source code
Variables
  mean = np.mean
  std = np.std
  diff = np.diff
Function Details

find(boolvec)

source code 

Find indices of all TRUE elements in boolvec.

You can use like this:

take(x, find(greater(x, 0)))

to select all elements of x greater than zero..