solprop.plotting.spectrograms#
Time-frequency maps of a saved plane, through a Gaussian-gated short-time transform.
spectrogram() draws solprop.processing.fields.get_spectrogram()’s map. The
gate width and the number of gate positions default from the time range asked for, and
a multimode run must say which mode it means, rather than silently taking the first.
Functions
|
Return the time-frequency map of one saved plane. |
- solprop.plotting.spectrograms.spectrogram(output, z=None, axis='wavelength', *, plane=None, modes=None, time_range=None, gate_fwhm=None, positions=256, spec_range=None, log=False, db_min=-40.0, cmap=None, ax=None, transfer=None)[source]#
Return the time-frequency map of one saved plane.
The real field is gated by a Gaussian of the given full width at half maximum and transformed at evenly spaced positions, which trades time resolution against frequency resolution in the usual way: a gate of duration
tauresolves frequencies no better than1/tau.- Parameters:
- outputsolprop.output.store.Output
An opened output handler.
- zfloat or None
Position of the plane, m: the nearest saved plane; the end of the run by default.
- axis{‘wavelength’, ‘f’, ‘omega’}
Spectral abscissa of the ordinate.
- planeint or None
The saved plane by index, negative from the end; refused beside z.
- modesint, sequence of int, ‘sum’ or None
Which mode to draw. A multimode run must name one: a spectrogram is of a field, and modal fields do not add away from a point in space.
- time_rangetuple of float or None
Time range to gate over and show, s. By default where the plane’s light is (
default_time_range()).- gate_fwhmfloat or None
Width of the gate, s; a twentieth of the time range by default.
- positionsint
How many gate positions to place across the time range.
- spec_rangetuple of float or None
Spectral limits in the units of
axis: m, Hz or rad/s. By default the run’s band (default_spec_range());wavelength_to_axis()converts a wavelength range.- logbool
Whether to show decibels below the peak rather than a linear scale.
- db_minfloat
Bottom of a logarithmic colour scale, dB below the peak: -40 dB by default, where
prop_2d()andspec_1d()default to -60 dB.- cmapstr, matplotlib.colors.Colormap or None
Colour map.
- axmatplotlib.axes.Axes or None
Axis to draw into; a new figure is made when none is given.
- transferTransferFunction or None
A linear optical element of
solprop.opticsapplied to the field first, so that the map is of the pulse after a compressor.
- Returns:
- matplotlib.figure.Figure
The figure the map was drawn on.
- Raises:
- solprop.exceptions.ModeError
If a multimode run does not name a single mode.
- solprop.exceptions.ProcessingError
If
spec_rangeselects no sample of the spectral axis, or both z and plane are given.
Examples
>>> import matplotlib.pyplot as plt >>> from solprop.plotting.spectrograms import spectrogram >>> from solprop.processing._examples import example_output >>> figure = spectrogram(example_output(), 0.0) >>> figure.axes[0].get_xlabel() 'Time (fs)' >>> plt.close(figure)