dgf_data¶
HDF5 I/O for dyadic Green’s function data.
Two storage layouts are supported, distinguished by the HDF5 attribute
gf_layout on the root group:
- Separation-indexed (
gf_layout = "separation", legacy default) The Green’s function is stored as
(M, K, 3, 3)where M is the number of energy points and K is the number of distinct inter-emitter separations Rx. This layout exploits translational symmetry: all emitter pairs at the same separation share the same tensor.Applicable to: planar surfaces (2-layer, N-layer), any geometry with full in-plane translational symmetry.
Datasets:
green_function_total (M, K, 3, 3) complex128 green_function_vacuum (M, K, 3, 3) complex128 energy_eV (M,) float64 Rx_nm (K,) float64 position_fixed group {zD_meters, zA_meters}
- Pair-indexed (
gf_layout = "pair") The Green’s function is stored as
(M, N, N, 3, 3)where N is the number of emitters. Entry[m, i, j, :, :]is the full dyadic G(r_i, r_j, ω_m). No symmetry is assumed.Applicable to: nanorods, nanoparticles, arbitrary geometries — any case where translational symmetry is broken.
Datasets:
green_function_total (M, N, N, 3, 3) complex128 green_function_vacuum (M, N, N, 3, 3) complex128 energy_eV (M,) float64 emitter_positions_nm (N, 3) float64 position_fixed group {zD_meters, zA_meters}
Backward compatibility: files written by older code (no gf_layout
attribute) are treated as separation-indexed.
- mqed.utils.dgf_data.load_gf_h5(h5_path: str) Dict[str, numpy.ndarray][source]¶
Load dyadic Green’s function from HDF5, auto-detecting layout.
- Returns:
- Common keys (both layouts):
G_total: Total Green’s function array.G_vac: Vacuum Green’s function array.energy_eV: Energy array, shape(M,).zD: Source z-position (meters).zA: Observer z-position (meters).gf_layout:"separation"or"pair".
- Separation-indexed adds:
Rx_nm: Separation grid, shape(K,).
- Pair-indexed adds:
emitter_positions_nm: Emitter coordinates, shape(N, 3).
- Return type:
Dictionary with keys that depend on the layout
- mqed.utils.dgf_data.save_gf_h5(h5_path: str, Gtot: numpy.ndarray, Gvac: numpy.ndarray, E: numpy.ndarray, Rxnm: numpy.ndarray, zD: float, zA: float) None[source]¶
Save separation-indexed Green’s function arrays to HDF5.
- Parameters:
h5_path – Output file path.
Gtot – Total Green’s function, shape
(M, K, 3, 3).Gvac – Vacuum Green’s function, shape
(M, K, 3, 3).E – Energy grid in eV, shape
(M,).Rxnm – Separation grid in nm, shape
(K,).zD – Source (donor) z-position in meters.
zA – Observer (acceptor) z-position in meters.
- mqed.utils.dgf_data.save_gf_pair_h5(h5_path: str, Gtot: numpy.ndarray, Gvac: numpy.ndarray, E: numpy.ndarray, emitter_positions_nm: numpy.ndarray, zD: float, zA: float) None[source]¶
Save pair-indexed Green’s function arrays to HDF5.
- Parameters:
h5_path – Output file path.
Gtot – Total Green’s function, shape
(M, N, N, 3, 3).Gvac – Vacuum Green’s function, shape
(M, N, N, 3, 3).E – Energy grid in eV, shape
(M,).emitter_positions_nm – 3D positions of all emitters in nm, shape
(N, 3).zD – Source z-position in meters (reference height).
zA – Observer z-position in meters (reference height).