qens.plotting

Plots

Each function here takes already processed inputs (datasets, samples, HWHM table) and writes out a single figure. None of them recomputes the physics — they’re presentation only. The forward-model evaluations are done by :mod:’qens.models’ and called by the inference layer.

All figures use the same colour scheme:

elastic component — blue ‘’#1565c0’’ quasi-elastic — orange ‘’#e67e22’’ fit / MAP — red ‘’#c0392b’’ posterior fan / data — slate ‘’#2471a3’’ resolution — grey ‘’#888’’

Save by passing ‘’save_path’’; if None the figure is returned for the user to handle.

qens.plotting.plot_overview(dataset, save_path=None)[source]

One line elastic-peak summary per loaded file. Useful sanity check after :func:’qens.preprocessing.assign_resolution’.

Parameters:
  • dataset (dict)

  • save_path (str | None)

qens.plotting.plot_sqw_map(d, ewin=1.2, save_path=None)[source]

Single S(Q,ω) heatmap, log-scaled.

Parameters:
qens.plotting.plot_per_q_fits(data_bins, sigma_res, params, model='anisotropic_rotor', save_path=None, **extras)[source]

Grid of subplots, one per Q-bin, showing data vs forward-model fit.

Parameters:
  • model (str)

  • save_path (str | None)

qens.plotting.plot_hwhm_vs_q2(q_centres, hwhm, hwhm_err, model_results=None, samples=None, map_params=None, res_hwhm_uev=50, save_path=None)[source]

Γ(Q) vs Q^2 with optional model curves and posterior fan.

Parameters:
  • model_results (dict | None)

  • samples (ndarray | None)

  • map_params (tuple | None)

  • res_hwhm_uev (float)

  • save_path (str | None)

qens.plotting.plot_posteriors(samples, model='anisotropic_rotor', reference_values=None, derived=None, save_path=None)[source]

Histograms with median, 95% CI band and reference lines.

Parameters:
  • samples (ndarray, shape (n, n_params))

  • model (str) – Registered model name (provides parameter names).

  • reference_values (dict, optional) – ‘’{param_name: [(value, label), …]}’’ to plot vertical reference lines (e.g. literature values).

  • derived (dict, optional) – ‘’{label: callable(samples)->array}’’ for extra panels.

  • save_path (str | None)

qens.plotting.plot_joint_posterior(samples, indices=(0, 1), labels=('p₁', 'p₂'), map_point=None, reference_point=None, save_path=None)[source]

Scatter+contour for any two parameter columns of ‘’samples’’.

Parameters: