dhbw.dasp.plot module

Collection of plot functions. Each function returns an instance of this module.

class dhbw.dasp.plot.fft[source]

Bases: object

abs(y, xlim=None, ylim=-120, **kwargs)[source]

Plot DFT amplitude of the audio signal.

Parameters:
xarray

Timeline array.

yarray

Signal amplitude array.

xlimfloat, tuple, optional

Frequency limits in Hz.

ylimfloat, tuple, optional

DFT amplitude limits in dB.

arg(y, xlim=None, ylim=None, **kwargs)[source]

Plot DFT phase of the audio signal.

Parameters:
xarray

Timeline array.

yarray

Signal amplitude array.

xlimfloat, tuple, optional

Frequency limits in Hz.

ylimfloat, tuple, optional

DFT phase value limits.

class dhbw.dasp.plot.filter[source]

Bases: object

frequency(a, xlim=None, ylim=None, **kwargs)[source]

Plot frequency response of the transfer function specified by b and a coefficients.

Parameters:
barray

The numerator coefficient array.

aarray

The denominator coefficient array.

xlimfloat, tuple, optional

Frequency limits in Hz.

ylimfloat, tuple, optional

Amplitude value limits in dB.

impulse(a, clip=1000.0, xlim=None, ylim=None, **kwargs)[source]

Plot impulse response of the transfer function specified by b and a coefficients.

Parameters:
barray

The numerator coefficient array.

aarray

The denominator coefficient array.

clipfloat, optional

Clip response amplitudes outside the specified interval.

xlimfloat, tuple, optional

Time limits.

ylimfloat, tuple, optional

Amplitude limits.

phase(a, xlim=None, ylim=None, **kwargs)[source]

Plot phase response of the transfer function specified by b and a coefficients.

Parameters:
barray

The numerator coefficient array.

aarray

The denominator coefficient array.

xlimfloat, tuple, optional

Frequency limits in Hz.

ylimfloat, tuple, optional

Phase value limits in rad.

poleszeros(a)[source]

Plot poles and zeros in Z plane for the transfer function specified by b and a coefficients.

Parameters:
barray

The numerator coefficient array.

aarray

The denominator coefficient array.

dhbw.dasp.plot.exit()[source]

Exit from Python.

dhbw.dasp.plot.figure(*args, **kwargs)[source]

Create a new figure.

dhbw.dasp.plot.phasogram(x, y, s, t, xlim=None, ylim=None, clim=None, cmap='twilight', **kwargs)[source]

Plot STFT phase of the audio signal.

Parameters:
xarray

Timeline array.

yarray

Signal amplitude array.

sfloat

STFT step size in seconds.

tfloat

STFT time span in seconds.

xlimfloat, tuple, optional

Time limits.

ylimfloat, tuple, optional

STFT frequency limits in Hz.

climfloat, tuple, optional

STFT phase value limits in dB.

cmapstr, optional

Plot color map.

dhbw.dasp.plot.plot(*args, **kwargs)[source]

Plot y versus x.

dhbw.dasp.plot.save(path, size=None, dpi=None)[source]

Save current figure to specified image file.

Parameters:
pathstr

Output image file path.

sizetuple, optional

Output image size (w, h) in inches.

dpiint, optional

Output image resolution in dots per inch.

dhbw.dasp.plot.show(*args, **kwargs)[source]

Display all open figures.

dhbw.dasp.plot.signal(x, y=None, xlim=None, ylim=1.1)[source]

Plot one or multiple audio signals.

Parameters:
xarray or same as y

Timeline array if y is not None.

yarray, tuple or list of arrays, optional

Audio signal(s) to plot, e.g. mono (y) or stereo (y0, y1).

xlimfloat, tuple, optional

Time limits.

ylimfloat, tuple, optional

Amplitude limits.

dhbw.dasp.plot.spectrogram(x, y, s, t, xlim=None, ylim=None, clim=-120, cmap='inferno', **kwargs)[source]

Plot STFT amplitude of the audio signal.

Parameters:
xarray

Timeline array.

yarray

Signal amplitude array.

sfloat

STFT step size in seconds.

tfloat

STFT time span in seconds.

xlimfloat, tuple, optional

Time limits.

ylimfloat, tuple, optional

STFT frequency limits in Hz.

climfloat, tuple, optional

STFT amplitude limits in dB.

cmapstr, optional

Plot color map.

dhbw.dasp.plot.tight(*args, **kwargs)[source]

Adjust the padding between and around subplots.