specplot

function of dascore.viz.specplot source

specplot(
    patch: Patch ,
    ax: matplotlib.axes._axes.Axes | None[Axes, None] = None,
    cmap = None,
    scale: float | collections.abc.Sequence[float, collections.abc.Sequence[float], None] = (0, 1),
    scale_type: Literal[‘relative’, ‘absolute’] = relative,
    interpolation: str | None[str, None] = bilinear,
    log: bool = False,
    cbar: bool = True,
    show: bool = False,
    **kwargs ,
)-> ‘plt.Axes’

Plot the spectrum contained in a Fourier-transformed patch.

Wraps waterfall, identifies the Fourier coordinate, and labels it as frequency or wavenumber. log=True uses a logarithmic Fourier axis.

Parameters

Parameter Description
patch The patch containing spectral data. At least one coordinate must
represent a Fourier-transformed dimension (ft_*).
ax Existing matplotlib axes; creates one when omitted.
cmap Colormap passed to waterfall.
scale Scaling limits passed to waterfall.
Defaults to [0, 1], the full data range.
scale_type Scaling mode passed to waterfall.
interpolation Interpolation method used for image rendering. The default here is bilinear
for a smoother look than waterfall’s default antialiased
log If True, display the Fourier-transformed axis on a logarithmic
scale.
For a distance coordinate, positive and negative wavenumbers are shown, while
for a time coordinate only positive frequencies are shown.
cbar Whether to add a colorbar.
show Whether to show the plot.

Returns

matplotlib.axes.Axes The axes containing the spectrum plot.

Examples

import dascore as dc
patch = dc.examples.example_event_2().decimate(time=10).T
spec = patch.dft("time").abs()
ax = spec.viz.specplot(cmap='turbo')
fk_patch = patch.dft(("time", "distance")).abs()
ax = fk_patch.viz.specplot(log=True, cmap='inferno')