Module sig :: Class Signal
[frames] | no frames]

Class Signal

Known Subclasses:

Represent infinite signals. This is a generic superclass that provides some basic operations. Every subclass must provide a sample method.

Be sure to start idle with the -n flag, if you want to make plots of signals from inside idle.

Instance Methods
 
plot(self, start=0, end=100, newWindow='Signal value versus time', color='blue', parent=None, ps=None, xminlabel=0, xmaxlabel=0, yOrigin=None)
Make a plot of this signal.
 
__add__(self, other)
Returns: New signal that is the sum of self and other.
 
__rmul__(self, scalar)
Returns: New signal that is self scaled by a constant.
 
__mul__(self, scalar)
Returns: New signal that is self scaled by a constant.
 
period(self, n=None, z=None)
Returns: an estimate of the period of the signal, or 'aperiodic' if it can't get a good estimate
 
crossings(self, n=None, z=None)
Returns: a list of indices into the data where the signal crosses the z value, up through time n
 
mean(self, n=None)
Returns: sample mean of the values of the signal from 0 to n
 
samplesInRange(self, lo, hi)
Returns: list of samples of this signal, from lo to hi-1
Method Details

plot(self, start=0, end=100, newWindow='Signal value versus time', color='blue', parent=None, ps=None, xminlabel=0, xmaxlabel=0, yOrigin=None)

 

Make a plot of this signal.

Parameters:
  • start - first value to plot; defaults to 0
  • end - last value to plot; defaults to 100; must be > start
  • newWindow - makes a new window with this value as title, unless the value is False, in which case it plots the signal in the currently active plotting window
  • color - string specifying color of plot; all simple color names work
  • parent - An instance of tk.tk. You probably should just leave this at the default unless you're making plots from another application.
  • ps - If not None, then it should be a pathname; we'll write a postscript version of this graph to that path.

__add__(self, other)
(Addition operator)

 
Parameters:
  • other - Signal
Returns:
New signal that is the sum of self and other.

Does not modify either argument.

__rmul__(self, scalar)

 
Parameters:
  • scalar - number
Returns:
New signal that is self scaled by a constant.

Does not modify self

__mul__(self, scalar)

 
Parameters:
  • scalar - number
Returns:
New signal that is self scaled by a constant.

Does not modify self

period(self, n=None, z=None)

 
Parameters:
  • n - number of samples to use to estimate the period; if not provided, it will look for a length attribute of self
  • z - zero value to use when looking for zero-crossings of the signal; will use the mean by default.
Returns:
an estimate of the period of the signal, or 'aperiodic' if it can't get a good estimate

crossings(self, n=None, z=None)

 
Parameters:
  • n - number of samples to use; if not provided, it will look for a length attribute of self
  • z - zero value to use when looking for zero-crossings of the signal; will use the mean by default.
Returns:
a list of indices into the data where the signal crosses the z value, up through time n

mean(self, n=None)

 
Parameters:
  • n - number of samples to use to estimate the mean; if not provided, it will look for a length attribute of self
Returns:
sample mean of the values of the signal from 0 to n

samplesInRange(self, lo, hi)

 
Returns:
list of samples of this signal, from lo to hi-1