Plotting
Utilities for plotting setup and time-series post-processing used in analysis scripts, including figure sizing, tick formatting, and time-averaging helpers.
The API section below documents the functions exported in
edlgt.tools.plotting.__all__.
Plotting and time-series post-processing helpers for analysis scripts.
This module combines small visualization utilities (figure sizing, tick formatters) with helpers for running time averages and windowed smoothing used in dynamics post-processing.
Only the functions listed in __all__ are considered the public API here.
- edlgt.tools.plotting.get_tline(par)[source]
Build a uniform time grid from a parameter dictionary.
- Parameters:
par (
dict) – Dictionary containing at least"start","stop", and"delta_n".- Returns:
Uniform time grid starting at
par["start"]with steppar["delta_n"]and stopping beforepar["stop"].- Return type:
- edlgt.tools.plotting.time_integral(time, observable_values)[source]
Compute a cumulative time average of an observable.
- Parameters:
time (
numpy.ndarray) – One-dimensional time grid.observable_values (
numpy.ndarray) – Observable values sampled ontime.
- Returns:
Array where entry
iis the time-averaged value accumulated up totime[i].- Return type:
- edlgt.tools.plotting.custom_average(arr, staggered=None, norm=None)[source]
Average rows of a 2D array with optional site selection or weighting.
- Parameters:
arr (
numpy.ndarray) – Two-dimensional array where each row is averaged over columns.staggered (
{"even", "odd"}, optional) – If provided, average only even or odd column indices.norm (
numpy.ndarray, optional) – Weight vector used for a dot-product average. If provided, this branch is used instead of thestaggeredselection.
- Returns:
One-dimensional array containing one averaged value per row.
- Return type:
- Raises:
ValueError – If
normis provided and its length does not matcharr.shape[1].
- edlgt.tools.plotting.moving_time_integral(time, observable_values, max_points=100)[source]
Compute a moving-window time average using trapezoidal integration.
- Parameters:
time (
numpy.ndarray) – One-dimensional time grid (can be non-uniform).observable_values (
numpy.ndarray) – Observable values sampled ontime.max_points (
int, optional) – Maximum number of samples used in the averaging window.
- Returns:
Running averaged observable with the same shape as
observable_values.- Return type:
Notes
At early times, when fewer than
max_pointssamples are available, the window includes all samples from the start.
- edlgt.tools.plotting.gaussian_time_integral(time, observable_values, sigma=None)[source]
Smooth a time series with a Gaussian-weighted local average.
- Parameters:
time (
numpy.ndarray) – One-dimensional time grid (can be non-uniform).observable_values (
numpy.ndarray) – Observable values sampled ontime.sigma (
float, optional) – Width of the Gaussian window. IfNone, a default value equal to one-tenth of the total time range is used.
- Returns:
Smoothed observable values with the same shape as
observable_values.- Return type:
- edlgt.tools.plotting.set_size(width_pt, fraction=1, subplots=(1, 1), height_factor=1.0)[source]
Compute figure dimensions in inches from a document width.
- Parameters:
- Returns:
Figure dimensions
(width_in, height_in)in inches.- Return type:
Notes
The height is based on a golden-ratio scaling, adjusted by the subplot layout and
height_factor.