zkit.mwigner.analysis
zkit.mwigner.analysis — deck-driven analysis of the marginal-Wigner phase-space current for a TDSEZ run.
All physics (potential V, mass, laser A(t), snapshot times, PDM
derivatives) is read AUTOMATICALY from the TDSEZ input deck
through zkit.physics.Physics and zkit.simulation.Run.
Nothing is hard-coded.
Functions
analyze_run(deck, wfs, run_dir=”.”) -> writes znse_current.csv + figures animate_run(deck, wfs, run_dir=”.”) -> writes mp4 + gif movie
CLI
python -m zkit.mwigner.analysis <deck.inp> <wfs.h5>
defaults (if omitted) point at the ZnSe 20 nm dot run.
The p-current is J_p = -V’(x) W - A_x(t) W + Q(x,p) with the classical confining force, the velocity-gauge laser drift -A_x(t)W (read from the deck), and the Moyal quantum force Q.
- 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='.')
Compute the 4D covariance diagnostics for every snapshot of a TDSEZ run and write a CSV + a figure.
CSV (znse_covariance.csv) columns, one row per snapshot: snap, t, Sxx, Syy, Spxpx, Spyy, Sxpx, Sypy, Sxy, Spxpy, nu_min, nu_max, mu_G, mu_true, non_gaussian, pc1_x, pc1_px, pc1_y, pc1_py where (pc1_*) is the dominant principal-component eigenvector of Σ (descriptive only – NOT a qubit).
Figure (znse_covariance.pdf): (top) Σxx and Σyy vs time -> wavepacket spreading / transverse spreading during ionisation. (mid) |Σxpy| and |Σypx| (cross-quadrature / which-path) vs time. (bottom) true purity μ_true vs Gaussian purity μ_G vs time, with a shaded band marking where μ_G has underflowed (diagnostic invalid).
All physics is read from the deck via zkit. Run + zkit.physics.
- zkit.mwigner.analysis.analyze_autocorr(deck='ZnSe_d20_A0.005338.inp', wfs='wfs_ZnSe_d20_A0.005338.h5', run_dir='.', ref=0)
Autocorrelation / survival analysis with the rigorous |A|^2 <= P(t) quantum-information bound, for every snapshot of a TDSEZ run.
Writes: CSV (znse_autocorr.csv): columns snap, t, A_re, A_im, |A|^2, P=Tr rho^2, gap=P-|A|^2, bound_ok PDF (znse_autocorr.pdf): two panels – (top) survival |A(t)|^2 (black) and reduced purity P(t) (blue); the shaded region between them is the transverse information loss P - |A|^2 that the autocorrelation alone misses. (bottom) the gap P(t) - |A(t)|^2 vs time.
The inequality |A(t)|^2 <= P(t) is the Cauchy-Schwarz bound for a pure initial state (Sec. autocorr). All physics is read from the deck via zkit.Run / zkit.physics; nothing is hard-coded.
- zkit.mwigner.analysis.analyze_autocorr_sizes(sizes=None, run_dir='.', selected=None, ref=0, snap_dt=280.0)
Multi-size autocorrelation / decay-rate analysis (Figure 5 material).
- Parameters:
sizes – [(”ZnSe_d20_…inp”,”wfs_ZnSe_d20_…h5”,”d20”), …].
If None, auto-discovers every wfs_ZnSe*.h5 in run_dir. :type sizes: list of (deck, wfs, label) tuples, e.g. :param selected: (default: first two discovered, or all if <=4). :type selected: subset of labels to plot |A(t)| and arg A(t) for :param Writes: :param ——: znse_autocorr_sizes.csv : per size: label, n_snaps, Gamma_fit, S_VN_max, |A|(t0), |A|(t_end), and per-snapshot |A|/arg columns. znse_autocorr_A2.pdf : |A_full(t)|^2 vs t for selected sizes (Fig 5a) znse_autocorr_arg.pdf : arg A_full(t) vs t for selected sizes (Fig 5b) znse_autocorr_Gamma.pdf : Gamma_fit vs S_VN^max for all sizes (Fig 5c) :param Returns dict with the per-size result dicts and figure paths.:
- 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 TimeEvolutionData_*.h5.