plot_spectral_density¶
Plot Spectral Density¶
Plots the generalized spectral density \(J_{\alpha\beta}(\omega)\) as a function of energy (eV) for user-selected emitter pairs or separations.
Reads spectral density data from the HDF5 file produced by
mqed.analysis.spectral_density.
Usage:
python -m mqed.plotting.plot_spectral_density
Configuration via configs/plots/plt_spec_dens_direct_sg.yaml.
- mqed.plotting.plot_spectral_density._apply_font_config(cfg)[source]¶
Apply font configuration from config, following plot_pr.py conventions.
- mqed.plotting.plot_spectral_density._curve_sequence_style(curve_cfg: Any, prefix: str, selection_position: int, style_key: str) Any[source]¶
Return a per-selected separation/pair style from a curve config, if present.
Supported forms under each
curvesentry are either explicit style dicts:separation_styles: - {linestyle: "-", marker: "o"} - {linestyle: "--", marker: "s"}
or compact per-property lists/scalars:
separation_linestyles: ["-", "--"] separation_markers: ["o", "s"]
The list order follows
plot_settings.separation_indicesorplot_settings.pair_indicesafter physical-value resolution.
- mqed.plotting.plot_spectral_density._curve_style_for_selection(curve_cfg: Any, prefix: str, selection_position: int, style_key: str, fallback: Any = None) Any[source]¶
Resolve style precedence for one selected separation or pair.
Precedence is per-selected style on the input-file curve, then file-level curve defaults, then the global plot-settings fallback for that selected separation or pair.
- mqed.plotting.plot_spectral_density._format_scaled_label(base_label: str, scale_factor: float) str[source]¶
Append a multiplier annotation to the legend label when needed.
- mqed.plotting.plot_spectral_density._is_nested_index_collection(value: Any) bool[source]¶
Return True when a selection entry is itself a collection of indices.
- mqed.plotting.plot_spectral_density._load_spectral_density_h5(filepath: str) dict[source]¶
Load spectral density data from HDF5.
- Returns:
J_eV, energy_eV, gf_layout, and layout-specific position metadata.
- Return type:
Dictionary with keys
- mqed.plotting.plot_spectral_density._normalize_curve_scales(raw_scales: Any, count: int, setting_name: str) list[float][source]¶
Return one multiplicative scale factor per plotted curve.
- mqed.plotting.plot_spectral_density._normalize_curve_styles(raw_styles: Any, count: int, setting_name: str) list[Any][source]¶
Return one optional style entry per plotted curve.
- mqed.plotting.plot_spectral_density._normalize_pair_indices(raw_selection: Any) list[list[int]][source]¶
Return a validated list of [alpha, beta] pair indices.
- mqed.plotting.plot_spectral_density._normalize_separation_indices(raw_selection: Any) list[int][source]¶
Return a validated list of separation indices.
- mqed.plotting.plot_spectral_density._parse_index_selection(raw_selection: Any, default_value: Any, selection_name: str) Any[source]¶
Normalize Hydra index selection values into plain Python objects.
- mqed.plotting.plot_spectral_density._plot_pair_layout(J_eV, energy_eV, cfg, emitter_positions_nm=None, ax=None, curve_cfg=None)[source]¶
Plot J_αβ(ω) for pair-indexed data.
Produces one curve per selected (α, β) pair.
- mqed.plotting.plot_spectral_density._plot_scan_layout(J_eV, energy_eV, cfg, observer_distances_nm=None, ax=None, curve_cfg=None)[source]¶
Plot J(ω) for fixed-source scan data.
- mqed.plotting.plot_spectral_density._plot_separation_layout(J_eV, energy_eV, Rx_nm, cfg, ax=None, curve_cfg=None)[source]¶
Plot J(ω) for separation-indexed data.
Produces one curve per selected separation Rx.
- mqed.plotting.plot_spectral_density._resolve_curve_multipliers(ps, primary_key: str, legacy_key: str, count: int) list[float][source]¶
Load curve multipliers with a backwards-compatible fallback key.
- mqed.plotting.plot_spectral_density._resolve_curve_styles(ps, prefix: str, count: int) tuple[list[Any], list[Any]][source]¶
Load optional per-curve colors and linestyles for one plot layout.
- mqed.plotting.plot_spectral_density._style_entry_value(entry: Any, style_key: str) Any[source]¶
Read one style value from a per-selection style entry.
- mqed.plotting.plot_spectral_density._style_list_key(style_key: str) str[source]¶
Return the plural config key used for per-selected-curve style lists.
- mqed.plotting.plot_spectral_density._validate_curve_multiplier(scale_factor: float, yscale: str, setting_name: str) None[source]¶
Reject invalid multipliers for the active y-axis scale.
- mqed.plotting.plot_spectral_density.plot_spectral_density(cfg=None) None¶
Plot spectral density from pre-computed HDF5 data.
This is the Hydra CLI entry point. Configuration is loaded from
configs/plots/plt_spec_dens_direct_sg.yamlby default.