line_profile¶
line_profile.py — High-level LineProfile class for Stark-Zeeman calculations.
Typical usage:
import numpy as np
from starkzee.line_profile import LineProfile
lp = LineProfile(n_u=3, n_l=2, B=100.0, Ne_m3=1e23, Te_ev=5.0, species='H')
# Supply a grid in any of: energy [eV], wavelength [nm],
# frequency [THz], or wavenumber [cm⁻¹].
lp.compute_profile(np.linspace(1.80, 2.00, 2000), grid_type='energy_ev')
lp.compute_profile(np.linspace(620, 660, 2000), grid_type='wavelength_nm')
lp.compute_profile(np.linspace(450, 490, 2000), grid_type='frequency_thz')
lp.compute_profile(np.linspace(15000, 16000, 2000), grid_type='wavenumber_cm')
# Results are always available in all unit systems
lp.energies_ev # energy grid [eV]
lp.detuning_ev # E - E0 [eV]
lp.wavelengths_nm # wavelength grid [nm]
lp.frequencies_thz # frequency grid [THz]
lp.wavenumbers_cm # wavenumber grid [cm⁻¹]
lp.detuning_nm # λ - λ0 [nm]
lp.detuning_thz # f - f0 [THz]
lp.detuning_cm # ν̃ - ν̃0 [cm⁻¹]
lp.profile_pi # π component
lp.profile_sig_plus # σ+ component
lp.profile_sig_minus # σ- component
lp.profile # intensity at view_angle_deg (default 90°)
lp.profile_transverse # π + 0.5*(σ+ + σ-) (90° observation)
lp.profile_parallel # σ+ + σ- (0° observation)
# Discrete transitions at a single field configuration
lp.compute_discrete(Fz=0.0, Fx=1e8)
lp.discrete.energy_ev # transition energies [eV]
lp.discrete.detuning_ev # detuning from E0 [eV]
lp.discrete.wavelength_nm
lp.discrete.frequency_thz
lp.discrete.wavenumber_cm
lp.discrete.q # polarization (0, +1, -1)
lp.discrete.strength # \|d_q\|² [a₀²]
- class starkzee.line_profile.DiscreteTransitions(energy_ev, q, strength, upper_idx, lower_idx, E0)[source]¶
Bases:
objectDiscrete Stark-Zeeman dipole transitions at a single (B, Fz, Fx) configuration.
- energy_ev¶
Transition energies E_upper − E_lower [eV], sorted ascending.
- Type:
ndarray
- detuning_ev¶
Detuning from the field-free line center [eV].
- Type:
ndarray
- wavelength_nm¶
Photon wavelength for each transition [nm].
- Type:
ndarray
- frequency_thz¶
Photon frequency [THz].
- Type:
ndarray
- wavenumber_cm¶
Photon wavenumber [cm⁻¹].
- Type:
ndarray
- strength¶
Dipole matrix element squared |d_q(i→j)|² [a₀²].
- Type:
ndarray
- class starkzee.line_profile.LineProfile(n_u, n_l, B, Ne_m3, Te_ev, species='H', Ti_ev=None, view_angle_deg=90)[source]¶
Bases:
objectStark-Zeeman line profile for a single hydrogenic n_u → n_l transition.
Stores all input parameters and computed results as attributes. Call
compute_profile()to run the static profile solver andcompute_discrete()to enumerate the discrete eigenstate transitions at a specific field configuration.- Parameters:
n_u (
int) – Upper and lower principal quantum numbers.n_l (
int) – Upper and lower principal quantum numbers.B (
float) – Magnetic field [T].Ne_m3 (
float) – Electron density [m⁻³].Te_ev (
float) – Electron temperature [eV].species (
str, optional) – Emitting species:'H'/'hydrogen','D'/'deuterium', or'T'/'tritium'. Default is'H'.Ti_ev (
float, optional) – Ion temperature [eV]. When supplied,compute_profile()applies thermal Doppler broadening automatically after the static Stark-Zeeman calculation. Default isNone(no Doppler broadening).view_angle_deg (
float, optional) – Default observation angle relative to B [degrees]. Used bycompute_profile()to setlp.profilevia the Stokes formula. Can be overridden per-call incompute_profile(). Default is90(perpendicular to B).
- GRID_TYPES = ('energy_ev', 'wavelength_nm', 'frequency_thz', 'wavenumber_cm')¶
Accepted values for the
grid_typeparameter ofcompute_profile().
- compute_profile(grid, grid_type='energy_ev', view_angle_deg=None, **kwargs)[source]¶
Compute the static Stark-Zeeman profile on the supplied grid.
- Parameters:
grid (
array-like) – Spectral axis values in the units specified by grid_type.grid_type (
str, optional) –Unit system of grid. One of:
'energy_ev'Photon energy [eV] (default).
'wavelength_nm'Vacuum wavelength [nm].
'frequency_thz'Photon frequency [THz].
'wavenumber_cm'Wavenumber [cm⁻¹].
view_angle_deg (
float, optional) – Observation angle relative to B [degrees] for this call. When given, overrides the class-level default forlp.profile; the class attribute is not modified. When omitted, falls back toself.view_angle_deg(default90).**kwargs – Forwarded to
calculate_static_profile()(num_f,num_mu,use_screening,quadratic_zeeman,fine_structure,frequency_dependent_width).
- Returns:
Allows method chaining.
- Return type:
self
Notes
After this call all spectral-axis attributes are populated regardless of which grid_type was supplied:
energies_ev,wavelengths_nm,frequencies_thz,wavenumbers_cm, and the correspondingdetuning_*arrays.
- compute_discrete(Fz=0.0, Fx=0.0, **kwargs)[source]¶
Enumerate discrete eigenstate transitions at field (Fz, Fx) [V/m].
All keyword arguments are forwarded to
discrete_transitions()(quadratic_zeeman,fine_structure,min_strength).Returns self to allow method chaining.
- property profile_transverse¶
π + 0.5*(σ+ + σ−) — total intensity at 90° to B.
- property profile_parallel¶
σ+ + σ− — total intensity along B (0°).