zkit.mwigner.analysis

Campaign driver for the marginal-Wigner analysis of TDSE-Z runs.

The functions read the physics (potential, mass, field, snapshot times) from the TDSE-Z input deck through zkit.physics.Physics and zkit.simulation.Run, and the wavefunction snapshots from td/<name>_wfs.h5. They write CSV tables and figures with fixed file names (znse_*) into the working or run directory; the default deck and wavefunction file names are those of the ZnSe quantum-dot campaign this module was written for.

The momentum current is

\[J_p = -V'(x)\,W - A_x(t)\,W + Q(x, p),\]

with the confining force, the field term of the vector potential read from the deck, and the Moyal quantum force \(Q\) (zkit.mwigner.current).

Command line:

python -m zkit.mwigner.analysis <deck.inp> <wfs.h5>

runs analyze_run() and animate_run().

zkit.mwigner.analysis.analyze_run(deck='ZnSe_d20_A0.005338.inp', wfs='wfs_ZnSe_d20_A0.005338.h5', run_dir='.')

Per-snapshot Moyal-bracket closure + figure set. Returns a summary dict.

Parameters:
  • deck (str)

  • wfs (str)

  • run_dir (str)

Return type:

dict

zkit.mwigner.analysis.animate_run(deck='ZnSe_d20_A0.005338.inp', wfs='wfs_ZnSe_d20_A0.005338.h5', run_dir='.')

Two-panel movie (classical+semiclassical vs full Moyal-Q) per snapshot.

Parameters:
  • deck (str)

  • wfs (str)

  • run_dir (str)

Return type:

dict

zkit.mwigner.analysis.analyze_covariance(deck, wfs, run_dir='.')

Covariance diagnostics for every snapshot of a run.

Uses zkit.mwigner.covariance.covariance_diagnostics() on each snapshot.

Parameters:
  • deck (str) – TDSE-Z input deck.

  • wfs (str) – Wavefunction file td/<name>_wfs.h5.

  • run_dir (str, optional) – Directory of the run and of the output files.

Returns:

csv and figure (paths) and n_snaps.

Return type:

dict

Notes

Writes znse_covariance.csv (one row per snapshot: snap, t, Sxx, Syy, Spxpx, Spypy, Sxpx, Sypy, Sxy, Spxpy, nu_min, nu_max, mu_G, mu_true, non_gaussian, and the dominant principal component pc1_x, pc1_px, pc1_y, pc1_py) and znse_covariance.pdf (variances, the cross-quadrature covariances \(\lvert\Sigma_{x p_y}\rvert\) and \(\lvert\Sigma_{y p_x}\rvert\), and the true against the Gaussian purity, with the range where \(\mu_G\) underflows marked).

zkit.mwigner.analysis.analyze_autocorr(deck='ZnSe_d20_A0.005338.inp', wfs='wfs_ZnSe_d20_A0.005338.h5', run_dir='.', ref=0)

Autocorrelation and reduced purity for every snapshot of a run.

For a pure initial state the survival probability of the reduced state is bounded by the purity of the reduced density matrix (Cauchy-Schwarz); the function evaluates the bound with zkit.mwigner.autocorr.autocorr_analysis().

Parameters:
  • deck (str) – TDSE-Z input deck.

  • wfs (str) – Wavefunction file td/<name>_wfs.h5.

  • run_dir (str, optional) – Directory of the run and of the output files.

  • ref (int, optional) – Index of the reference snapshot.

Returns:

csv and figure (paths), result (the decay analysis), n_snaps and bound_all_hold.

Return type:

dict

Notes

Writes znse_autocorr.csv with the columns snap, t, A_re, A_im, survival_red, survival_full, P, P0, bound_rhs, gap and bound_ok, and znse_autocorr.pdf.

zkit.mwigner.analysis.analyze_autocorr_sizes(sizes=None, run_dir='.', selected=None, ref=0, snap_dt=280.0)

Autocorrelation and decay rates for a series of runs of different size.

Parameters:
  • sizes (list of tuple, optional) – (deck, wfs, label) per run. By default every wfs_ZnSe*.h5 in run_dir is used.

  • run_dir (str, optional) – Directory of the runs and of the output files.

  • selected (list of str, optional) – Labels whose \(\lvert A(t)\rvert^2\) and \(\arg A(t)\) are plotted (default: the first two, or all when there are at most four).

  • ref (int, optional) – Index of the reference snapshot.

  • snap_dt (float, optional) – Time between snapshots (a.u.) when it cannot be taken from the deck.

Returns:

The per-run results and the paths of the CSV file and figures.

Return type:

dict

Notes

Writes znse_autocorr_sizes.csv (per run: label, number of snapshots, fitted decay rate, maximal von Neumann entropy, \(\lvert A\rvert\) at the first and last snapshot, and per-snapshot \(\lvert A\rvert\) and \(\arg A\)) and the figures znse_autocorr_A2.pdf, znse_autocorr_arg.pdf and znse_autocorr_Gamma.pdf.

zkit.mwigner.analysis.crosscheck_timedata(wfs, ted, run_dir='.', deck='ZnSe_d20_A0.005338.inp', ref=0)

Validate the wfs-derived autocorrelation against the TDSE code’s own TimeEvolutionData A(t), at high fidelity.

TimeEvolutionData stores, per timestep dt=TimeStep, the columns [t, Re A(t), Im A(t)] (attribute ‘complex’=1) where A(t) = <Psi(0)|Psi(t)> computed by the TDSE propagation (raw states, not re-normalised; A(0)=1). We reproduce A(t) directly from the wfs snapshots (autocorr.survival_amplitude_full) using the SAME convention (raw psi(t), reference normalised so A(0)=1) and compare at the wfs snapshot times. The real part of the two must agree; the imaginary part of our overlap is a gauge/frame phase that the TDSE file strips (it stores A(t) as purely real).

Returns a dict with the per-snapshot comparison, the full-resolution TDSE curve (for overlay plots), and the max/RMS differences.

zkit.mwigner.analysis.plot_autocorr_overlay(sizes=None, run_dir='.', selected=None, ref=0, out_prefix='znse_autocorr')

Figure 5a upgraded: full-resolution TDSE TimeEvolutionData |A(t)|^2 (native dt) with the wfs-derived validation points overlaid. Uses the autocorrelation dataset already present in <name>_observables.h5.