Skip to content

liveplotting⚓︎

On-line (live) plots of the DA process for various models and methods.

Liveplotters are given by a list of tuples as property or arguments in mods.HiddenMarkovModel.

  • The first element of the tuple determines whether the liveplotter is shown if the names of liveplotters are not given by liveplots argument in assimilate.

  • The second element in the tuple gives the corresponding liveplotter function/class. See example of function LPs in mods.Lorenz63.

The liveplotters can be fine-tuned by each DA experiments via argument of liveplots when calling assimilate.

  • liveplots = True turns on liveplotters set to default in the first argument of the HMM.liveplotter and default liveplotters defined in this module (sliding_diagnostics and weight_histogram).

  • liveplots can also be a list of specified names of liveplotter, which is the name of the corresponding liveplotting classes/functions.

Modules:

Name Description
pb

Make progbar (wrapper around tqdm) and read1.

viz

Plot utilities.

LivePlot ⚓︎

Live plotting manager.

Deals with

  • Pause, skip.
  • Which liveploters to call.
  • plot_u
  • Figure window (title and number).

__init__(stats, liveplots, key0=(0, None, 'u'), E=None, P=None, speed=1.0, replay=False, **kwargs) ⚓︎

Initialize plots.

  • liveplots: figures to plot; alternatives:
    • "default"/[]/True: All default figures for this HMM.
    • "all" : Even more.
    • non-empty list : Only the figures with these numbers (int) or names (str).
    • False : None.
  • speed: speed of animation.
    • >100: instantaneous
    • 1 : (default) as quick as possible allowing for plt.draw() to work on a moderately fast computer.
    • <1 : slower.

update(key, E, P) ⚓︎

Update liveplots

correlations ⚓︎

Plots the state (auto-)correlation matrix.

sliding_diagnostics ⚓︎

Plots a sliding window (like a heart rate monitor) of certain diagnostics.

spectral_errors ⚓︎

Plots the (spatial-RMS) error as a functional of the SVD index.

weight_histogram ⚓︎

Plots histogram of weights. Refreshed each analysis.

circulant_ACF(C, do_abs=False) ⚓︎

Compute the auto-covariance-function corresponding to C.

This assumes it is the cov/corr matrix of a 1D periodic domain.

Vectorized or FFT implementations are possible.

d_ylim(data, ax=None, cC=0, cE=1, pp=(1, 99), Min=-1e+20, Max=+1e+20) ⚓︎

Provide new ylim's intelligently, from percentiles of the data.

  • data: iterable of arrays for computing percentiles.
  • pp: percentiles

  • ax: If present, then the delta_zoom in/out is also considered.

  • cE: exansion (widenting) rate ∈ [0,1]. Default: 1, which immediately expands to percentile.

  • cC: compression (narrowing) rate ∈ [0,1]. Default: 0, which does not allow compression.

  • Min/Max: bounds

Despite being a little involved, the cost of this subroutine is typically not substantial because there's usually not that much data to sort through.

duplicate_with_blanks_for_resampled(E, dims, key, has_w) ⚓︎

Particle filter: insert breaks for resampled particles.

not_empty(xx) ⚓︎

Works for non-iterable and iterables (including ndarrays).

update_alpha(key, stats, lines, scatters=None) ⚓︎

Adjust color alpha (for particle filters).

validate_lag(Tplot, tseq) ⚓︎

Return validated T_lag such that is is:

  • equal to Tplot with fallback: HMM.tseq.Tplot.
  • no longer than HMM.tseq.T.

Also return corresponding K_lag, a_lag.