Package topo :: Package patterns :: Module basic :: Class OneDPowerSpectrum
[hide private]
[frames] | no frames]

Class OneDPowerSpectrum

source code

                                  object --+        
                                           |        
base.parameterizedobject.ParameterizedObject --+    
                                               |    
          base.patterngenerator.PatternGenerator --+
                                                   |
                                                  OneDPowerSpectrum
Known Subclasses:
audio.Audio

** This class has not been tested, and is still being written **

Returns the spectral density of a rolling window of the input signal each time it is called. Over time, outputs a spectrogram.



Nested Classes [hide private]

Inherited from base.parameterizedobject.ParameterizedObject: __metaclass__

Instance Methods [hide private]
 
__init__(self, signal=[1, 1, 1, 1], start_location=0, **params)
Reads the given signal into a float32 array.
source code
 
__call__(self)
Perform a DFT (FFT) of the current sample from the signal multiplied by the smoothing window.
source code

Inherited from base.patterngenerator.PatternGenerator: function

Inherited from base.parameterizedobject.ParameterizedObject: __getstate__, __repr__, __setstate__, __str__, as_uninitialized, debug, defaults, force_new_dynamic_value, get_param_values, get_value_generator, inspect_value, message, print_param_values, script_repr, verbose, warning

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Class Methods [hide private]

Inherited from base.parameterizedobject.ParameterizedObject: params, print_param_defaults

Class Variables [hide private]
  window_length = <topo.base.parameterclasses.Integer object at ...
The interval of the signal on which to perform the Fourier transform.
  windowing_function = <topo.base.parameterizedobject.Parameter ...
This function is multiplied with the interval of signal before performing the Fourier transform (i.e.
  window_overlap = <topo.base.parameterclasses.Integer object at...
Amount of overlap between each window of the signal.
  sample_spacing = <topo.base.parameterclasses.Number object at ...
...1/samplerate,relate to time, etc...

Inherited from base.patterngenerator.PatternGenerator: bounds, mask, offset, orientation, output_fn, position, scale, size, x, xdensity, y, ydensity

Inherited from base.parameterizedobject.ParameterizedObject: name, print_level

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, signal=[1, 1, 1, 1], start_location=0, **params)
(Constructor)

source code 

Reads the given signal into a float32 array.

The current position of the 'read pointer' in the signal array is given by self.location. start_location allows the starting point to be set.

self.frequencies gives the DFT's sample frequencies, matching the order returned by __call__().

Overrides: base.parameterizedobject.ParameterizedObject.__init__

__call__(self)
(Call operator)

source code 

Perform a DFT (FFT) of the current sample from the signal multiplied by the smoothing window.

See numpy.fft for information about the Fourier transform.

Overrides: base.patterngenerator.PatternGenerator.__call__

Class Variable Details [hide private]

window_length

The interval of the signal on which to perform the Fourier transform.

The Fourier transform algorithm is most efficient if this is a power of 2 (or can be decomposed into small prime factors - see numpy.fft).

Value:
Integer(constant= True, default= 2, doc= """
    The interval of the signal on which to perform the Fourier transform.
    
    The Fourier transform algorithm is most efficient if this is a power of 2
    (or can be decomposed into small prime factors - see numpy.fft).""")

windowing_function

This function is multiplied with the interval of signal before performing the Fourier transform (i.e. it is used to shape the interval).

The function chosen here dictates the tradeoff between resolving comparable signal strengths with similar frequencies, and resolving disparate signal strengths with dissimilar frequencies.

See http://en.wikipedia.org/wiki/Window_function

Value:
Parameter(default= numpy.hanning, doc= """
    This function is multiplied with the interval of signal before performing the
    Fourier transform (i.e. it is used to shape the interval). 

    The function chosen here dictates the tradeoff between resolving comparable
    signal strengths with similar frequencies, and resolving disparate signal
    strengths with dissimilar frequencies.

...

window_overlap

Amount of overlap between each window of the signal.
Value:
Integer(default= 0, doc= """Amount of overlap between each window of
    the signal.""")

sample_spacing

...1/samplerate,relate to time, etc...
Value:
Number(constant= True, default= 1.0, doc= """
    ...1/samplerate,relate to time, etc...""")