geopulse.earth.impedance
Surface-impedance abstraction — the polymorphism spine of GeoPulse.
The surface impedance Z relates the horizontal magnetic field B to the
geoelectric field E. Its mathematical rank depends on Earth-model
complexity:
1-D —
Z(ω)is a complex SCALAR per frequency:E_x = (Z / μ₀) · B_y, E_y = -(Z / μ₀) · B_x
2-D —
Z̃(ω)is a 2×2 TENSOR per frequency:E_i(ω) = Σ_j Z_ij(ω) · B_j(ω) / μ₀
3-D —
Z̃(r, r', ω)is a spatial KERNEL (convolution):E(r, ω) = ∬ Z̃(r, r', ω) · B(r', ω) d²r' / μ₀
All three implement Impedance.apply() and return (Ex_f, Ey_f). The
efield layer calls apply() blindly.
HDF5 storage
References
Classes
|
Abstract base class for surface impedance. |
|
3-D volumetric-response kernel |
|
1-D scalar impedance |
|
2-D magnetotelluric impedance tensor |
- class geopulse.earth.impedance.Impedance(freqs_Hz)[source]
Bases:
ABCAbstract base class for surface impedance.
- Parameters:
freqs_Hz (
ndarray) – Frequency array in Hz. Cast internally tofloat64. Shape:(n_freqs,).
- freqs_Hz
The stored frequency array.
- Type:
- abstractmethod apply(Bx_f, By_f)[source]
Apply the impedance to frequency-domain B-field, returning E-field.
- Parameters:
- Return type:
- Returns:
Ex_f (numpy.ndarray) – FFT of
Exin V/m. Shape matches subclass semantics.Ey_f (numpy.ndarray) – FFT of
Eyin V/m. Shape matches subclass semantics.
- abstract property rank: int
0 for scalar (1-D), 2 for tensor (2-D), 4 for kernel (3-D).
- Type:
Rank marker
- class geopulse.earth.impedance.ScalarImpedance(freqs_Hz, Z_values)[source]
Bases:
Impedance1-D scalar impedance
Z(ω).For a horizontally layered Earth under plane-wave excitation, the surface impedance is a single complex number per frequency. This is the standard magnetotelluric relation for the 1-D case.
- Parameters:
- Raises:
ShapeMismatchError – If
Z_values.shapedoes not equalfreqs_Hz.shape.
Notes
The applied relation is [1]:
E_x(ω) = (Z(ω) / μ₀) · B_y(ω) E_y(ω) = -(Z(ω) / μ₀) · B_x(ω)
Examples
>>> import numpy as np >>> freqs = np.array([1e-3, 1e-2, 1e-1]) >>> Z = np.array([1+1j, 3+3j, 10+10j]) >>> imp = ScalarImpedance(freqs, Z) >>> Ex, Ey = imp.apply(np.ones(3), np.ones(3)) >>> Ex.shape (3,)
- apply(Bx_f, By_f)[source]
Apply the 1-D plane-wave MT relation
E = (Z/μ₀) · B_perp.- Parameters:
- Return type:
- Returns:
Ex_f, Ey_f (numpy.ndarray) – FFT of the horizontal E-field components in V/m. Shape:
(n_freqs,).- Raises:
ShapeMismatchError – If
Bx_forBy_fdo not have the same length asfreqs_Hz.
- to_hdf5(group)[source]
Serialise to an HDF5 group with a schema-version attribute.
Layout:
group/ attrs: impedance_type = "scalar_1d" schema_version = 1 freqs_Hz dataset Z_values dataset (complex128)
- Return type:
- Parameters:
group (Group)
- classmethod from_hdf5(group)[source]
Read a
ScalarImpedancefrom an HDF5 group.- Return type:
- Parameters:
group (Group)
- class geopulse.earth.impedance.TensorImpedance(freqs_Hz, Z_tensor)[source]
Bases:
Impedance2-D magnetotelluric impedance tensor
Z̃(ω)— 2×2 per frequency.Applied relation (per frequency
ω_i):Ex(ω_i) = (Z[i,0,0] · Bx(ω_i) + Z[i,0,1] · By(ω_i)) / μ₀ Ey(ω_i) = (Z[i,1,0] · Bx(ω_i) + Z[i,1,1] · By(ω_i)) / μ₀
Shape convention:
Z_tensor[i, :, :]is the 2×2 tensor atfreqs_Hz[i]. A 1-D isotropic Earth is the special caseZ_tensor[i] = [[0, Z], [-Z, 0]].- Parameters:
- Raises:
ShapeMismatchError – If
Z_tensor.shapedoes not equal(n_freqs, 2, 2).
- apply(Bx_f, By_f)[source]
Apply the 2×2 tensor relation
E(ω) = Z̃(ω) · B(ω) / μ₀.- Parameters:
- Return type:
- Returns:
Ex_f, Ey_f (numpy.ndarray) – FFT of horizontal E-field components in V/m. Shape
(n_freqs,).- Raises:
ShapeMismatchError – If either input does not match
freqs_Hzin shape.
- to_hdf5(group)[source]
Serialise to an HDF5 group with a schema-version attribute.
Layout:
group/ attrs: impedance_type = "tensor_2d" schema_version = 1 freqs_Hz dataset Z_tensor dataset (complex128, shape (n_freq, 2, 2))
- Return type:
- Parameters:
group (Group)
- classmethod from_hdf5(group)[source]
Read a
TensorImpedancefrom an HDF5 group.- Return type:
- Parameters:
group (Group)
- class geopulse.earth.impedance.KernelImpedance(freqs_Hz, Z_kernel)[source]
Bases:
Impedance3-D volumetric-response kernel
Z̃(r, r', ω)— STUB (WP3).Shape convention:
(n_freqs, n_r, n_r, 2, 2). In practice the kernel will be sparse or block-structured and use chunked HDF5 storage.- Parameters:
freqs_Hz (np.ndarray)
Z_kernel (np.ndarray)