Spatial Signal Models

draws directivity diagrams for ULA assumption

Contents

dirdiag.py

Draw directivity diagrams

2013 Jean-Louis Durrieu http://www.durrieu.ch

pyfasst.spatial.dirdiag.directivity_filter_diagram_ULA(n_sensors=2, dist_inter_sensor=0.15, w_filter=None, theta_filter=0, freqs=None, thetas=None, nfreqs=256, nthetas=30, samplerate=8000.0, doplot='2d', fig=None, subplot_number=(1, 1, 1), dyn_func=<function db at 0x1022ef668>)[source]

Computes and displays the directivity diagram associated to the provided filter w_filter (optionally parameterized by the targetted direction theta_filter).

the diagram can be interpreted as the amplitude of the filter for a source at frequency f, located at an angle theta from the the ULA array axis.

pyfasst.spatial.dirdiag.generate_steer_vec_thetas(n_sensors=2, dist_inter_sensors=0.15, freqs=None, n_freqs=256, thetas=None, n_thetas=30, samplerate=8000.0, computeRaa=False)[source]

Generates a collection of steering vectors with the provided array and signal parameters.

pyfasst.spatial.dirdiag.make_MVDR_filter_target(steering_vec_target, steering_vec_interf)[source]

make MVDR spatial filter from estimated steering vectors

pyfasst.spatial.dirdiag.produceMVDRplots(theta_filter=0.7853981633974483, freqs=None, n_freqs=256, thetas=None, n_thetas=30, samplerate=8000.0, n_sensors=2, dist_inter_sensors=0.15, dists=[0.15, 0.5, 1.0], doplot='2d', dyn_func=<function db at 0x1022ef668>, theta_interf=None, n_theta_interf=4)[source]

MVDR gains for spatial filtering

Description:

Minimum Variance - Distortionless Response

Examples:

>>># importing the module
>>>import pyfasst.spatial.dirdiag as dd
>>># the MVDR plots, for 4 sensors and 4 interferers: visible rejection
>>>Raa, w, th, fr, thetas, diag = dd.produceMVDRplots(n_sensors=4, 
       n_theta_interf=2, samplerate=8000., dists=[0.15,])
>>># plotting also the filter responses against the angles
>>>plt.figure();plt.plot(thetas,dd.db(diag))
>>>plt.xlabel('$\theta$ (rad)');plt.ylabel('Response (dB)')
>>># MVDR plots 2 sensors for 4 interferers: no rejection!
>>>Raa, w, th, fr, thetas, diag = dd.produceMVDRplots(n_sensors=2,
       n_theta_interf=2, samplerate=8000., dists=[0.15,])
>>># plotting also the filter responses against the angles
>>>plt.figure();plt.plot(thetas,dd.db(diag))
>>>plt.xlabel('$\theta$ (rad)');plt.ylabel('Response (dB)')
pyfasst.spatial.dirdiag.producePicDiagramAgainstDistNSensors(w_filter=None, theta_filter=0.7853981633974483, sensors=None, dists=None, samplerate=8000.0, doplot='2d', dyn_func=<function db at 0x1022ef668>, thetas=None, nthetas=30)[source]

generate a drawing that shows the directivity diagrams for several values of distance between sensors and number of sensors.

STEERING VECTORS

generating steering vectors for arrays of sensors

Content

pyfasst.spatial.steering_vectors.dir_diag_stereo(Cx, nft=2048, ntheta=512, samplerate=44100, distanceInterMic=0.3)[source]

Compute the diagram of directivity for the input short time Fourier transform second order statistics in Cx (this Cx is compatible with the attribute from an instantiation of pyfasst.audioModel.FASST)

\[C_x[0] = E[|x_0|^2]\]\[C_x[2] = E[|x_1|^2]\]\[C_x[1] = E[x_0 x_1^H]\]

Method:

We use the Capon method, on each of the Fourier channel \(k\):

\[\phi_k(\theta) = a_k(\theta)^H R_{xx}^{-1} a_k(\theta)\]

The algorithm therefore returns one directivity graph for each frequency band.

Remarks:

One can compute a summary directivity by adding the directivity functions across all the frequency channels. The invert of the resulting array may also be of interest (looking at peaks and not valleys to find directions):

>>> directivity_diag = dir_diag_stereo(Cx)
>>> summary_dir_diag = 1./directivity_diag.sum(axis=1)

Some tests show that it is very important that the distance between the microphone is known. Otherwise, little can be infered from the resulting directivity measure...

pyfasst.spatial.steering_vectors.gen_steer_vec_acous(freqs, dist_src_mic)[source]

generates a steering vector for the given frequencies and given distances between the microphones and the source.

To the difference with gen_steer_vec_far_src_uniform_linear_array(), this function also includes gains depending on the distance between the source and the mics.

pyfasst.spatial.steering_vectors.gen_steer_vec_far_src_uniform_linear_array(freqs, nchannels, theta, distanceInterMic)[source]

generate steering vector with relative far source, uniformly spaced sensor array

Description:

assuming the source is far (compared to the dimensions of the array) The sensor array is also assumed to be a linear array, the direction of arrival (DOA) theta is defined as in the following incredible ASCII art drawing:

  theta
----->/              /
|    /              /
y   /              /
   /              /
^ /              /
|/              /
+---> x
o    o    o    o    o    o
M1   M2   M3  ...
<--->
  d = distanceInterMic

That is more likely valid for electro-magnetic fields, for acoustic wave fields, one should probably take into account the difference of gain between the microphones (see gen_steer_vec_acous() )

Output:

a (nc, nfreqs) ndarray
contains the steering vectors, one for each channel, and

Table Of Contents

Previous topic

separateLeadFunctions

Next topic

Time-Frequency Transforms

This Page