jwspecabund.direct
Direct T_e method for ionic and total abundances.
Uses PyNEB for the atomic physics: electron temperature from
auroral-to-nebular line ratios, electron density from density-sensitive
doublets, and ionic abundances via getIonAbundance().
References
DESI DR2 (arXiv:2601.02463) T_e-T_e relation
Osterbrock & Ferland (2006) for Case B recombination
Functions
|
Derive T_e(intermediate) from T_e(high) for the S²⁺ zone. |
|
Derive T_e(low) from T_e(high) using an empirical T_e-T_e relation. |
|
Predict the CIII] 1909/1907 flux ratio at a given electron density. |
|
Compute T_e(N+) from the [NII] auroral/nebular ratio. |
|
Compute T_e(O++) from the [OIII] auroral/nebular ratio. |
|
Compute T_e(O++) from the [OIII] UV/optical ratio 1666/(5007+4959). |
|
Compute all available ionic abundances. |
|
Compute electron density from a density-sensitive doublet. |
|
Compute electron density from the [Ar IV] 4711/4740 ratio. |
|
Compute electron density from the CIII] 1907/1909 ratio. |
|
Compute electron density from the NIV] 1483/1486 ratio. |
|
Compute electron density from the [Si III] 1883/1892 ratio. |
|
Derive total element abundances from ionic abundances + ICFs. |
|
Predict the He I 4714 / He I 4472 recombination flux ratio. |
|
Return the redshift-dependent electron-density fallback for a zone. |
|
Predict the NIV] 1483/1486 flux ratio at a given electron density. |
- jwspecabund.direct.Te_int_from_high(Te_high, relation='3_tier')[source]
Derive T_e(intermediate) from T_e(high) for the S²⁺ zone.
The intermediate-ionisation zone traces S²⁺ (23.3-34.8 eV) and is used for S²⁺ and Ar²⁺. Garnett (1992) gives t(S III) = 0.83 t(O III) + 0.17 (in 10⁴ K), i.e. T_int = 0.83 * T_high + 1700. This is the relation adopted by Martinez+2025 (arXiv:2510.21960) for the intermediate zone.
- Parameters:
- Returns:
T_e(intermediate) in K, or
Noneif the relation defines no intermediate zone.- Return type:
float or None
- jwspecabund.direct.Te_low_from_high(Te_high, relation='3_tier')[source]
Derive T_e(low) from T_e(high) using an empirical T_e-T_e relation.
The low-ionisation zone traces O⁺/N⁺ (14.5-29.6 eV).
- Parameters:
Te_high (float) – T_e(O++) in K.
relation (str) –
"3_tier"(default) — Garnett (1992) O⁺ zone, as adopted by Martinez+2025 (arXiv:2510.21960): T_low = 0.70 * T_high + 3000. Pairs withTe_int_from_high()for the intermediate zone so the zones stay monotone (T_high >= T_int >= T_low)."classical"/"garnett"— alias of the Garnett (1992) low relation (identical to"3_tier"for the low zone)."desi"— DESI DR2 (arXiv:2601.02463): T_low = 0.648 * T_high + 3270.
- Returns:
T_e(low) in K.
- Return type:
- jwspecabund.direct.ciii_ratio_at_density(ne, Te=10000.0)[source]
Predict the CIII] 1909/1907 flux ratio at a given electron density.
Useful for fixing the CIII] doublet ratio in the fitter when the density is assumed or known from another diagnostic.
- jwspecabund.direct.compute_Te_NII(flux_5756, flux_6585, ne)[source]
Compute T_e(N+) from the [NII] auroral/nebular ratio.
- jwspecabund.direct.compute_Te_OIII(flux_4363, flux_5007, flux_4959, ne)[source]
Compute T_e(O++) from the [OIII] auroral/nebular ratio.
Uses PyNEB
getTemDen()on the O++ atom with the standard diagnostic ratio [OIII] 4363 / ([OIII] 5007 + [OIII] 4959).
- jwspecabund.direct.compute_Te_OIII_1666(flux_1666, flux_5007, flux_4959, ne)[source]
Compute T_e(O++) from the [OIII] UV/optical ratio 1666/(5007+4959).
Uses the O III] 1666 Å intercombination line (5→2 transition) as a UV auroral diagnostic when [OIII] 4363 is unavailable or low-SNR. The emissivity ratio 1666/(5007+4959) is monotonically increasing with T_e and more temperature-sensitive than 4363/(5007+4959) due to the larger energy gap (7.5 eV vs 2.8 eV).
- jwspecabund.direct.compute_ionic_abundances(fluxes, Te_high, Te_low, ne, ne_mid=None, ne_high=None, Te_int=None, ne_Opp=None)[source]
Compute all available ionic abundances.
- Parameters:
fluxes (dict) – Dust-corrected emission-line fluxes keyed by line name. Must include
"HBETA"for normalisation.Te_high (float) – T_e(O++) in K.
Te_low (float) – T_e(O+/N+) in K.
ne (float) – Electron density in cm^-3 (low-ionisation zone).
ne_mid (float, optional) – Electron density for the intermediate-ionisation zone (cm^-3). Traced by CIII] 1907/1909 (~24 eV). If
None, defaults to ne. Used for O²⁺, Ne²⁺, C²⁺, N²⁺, S²⁺, Ar²⁺. O²⁺ and Ne²⁺ use this intermediate-zone density (not ne_high): the [OIII] 5007/Hβ and [NeIII] 3869/Hβ abundances are density- insensitive below ~10⁴–10⁵ cm⁻³, and CIII] (24–48 eV) overlaps the O²⁺ zone (35–55 eV), whereas NIV] (47–77 eV) traces more highly-ionised gas. This decouples O²⁺/Ne²⁺ from the noisy high-ionisation N IV] density.ne_high (float, optional) – Electron density for the high-ionisation zone (cm^-3). Traced by NIV] 1483/1486 (~47 eV). If
None, defaults to ne_mid. Used for N³⁺, N⁴⁺, C³⁺.Te_int (float, optional) – Intermediate-zone (S²⁺) electron temperature in K, used for S²⁺ and Ar²⁺. If
None(default), the legacy0.5*(Te_high + Te_low)midpoint is used.ne_Opp (float, optional) – Electron density for the O²⁺/Ne²⁺ zone (cm^-3), preferentially from [Ar IV] 4711/4740 (Martinez+2025 Table 2). If
None(default), falls back to ne_mid (CIII] → ne), preserving the previous behaviour.
- Returns:
Ionic abundances, e.g.
{"O+/H+": val, "O++/H+": val, ...}.- Return type:
- jwspecabund.direct.compute_ne(flux_line1, flux_line2, doublet='SII', Te_guess=15000.0)[source]
Compute electron density from a density-sensitive doublet.
- Parameters:
- Returns:
Electron density n_e in cm^-3.
- Return type:
- jwspecabund.direct.compute_ne_ArIV(flux_4711, flux_4740, Te_guess=15000.0)[source]
Compute electron density from the [Ar IV] 4711/4740 ratio.
Probes the high-ionisation zone (Ar³⁺, 40.7-59.8 eV), overlapping the O²⁺ zone, so it is the preferred density for O²⁺ (Martinez+2025 Table 2).
flux_4711must be the He I-deblended [Ar IV] 4711 flux (seeheI_4714_over_4472()); the raw fittedArIV_4713line is blended with He I 4714.
- jwspecabund.direct.compute_ne_CIII(flux_1907, flux_1909, Te_guess=15000.0)[source]
Compute electron density from the CIII] 1907/1909 ratio.
Probes the intermediate-ionisation zone.
- jwspecabund.direct.compute_ne_NIV(flux_1483, flux_1486, Te_guess=15000.0)[source]
Compute electron density from the NIV] 1483/1486 ratio.
Probes the high-ionisation zone.
- jwspecabund.direct.compute_ne_SiIII(flux_1883, flux_1892, Te_guess=15000.0)[source]
Compute electron density from the [Si III] 1883/1892 ratio.
A UV density diagnostic (Si²⁺, 16-33 eV). Used as the low-ionisation density fallback for O⁺/N⁺ when the optical [SII]/[OII] doublets are out of coverage (e.g. high-z UV-only stacks; Martinez+2025 Table 2 list n_e(Si²⁺) for the low/intermediate zone).
- jwspecabund.direct.compute_total_abundances(ionic, logU=None, Z_Zsun=None, ne=None, icf_method='auto', ionic_upper_limits=None, _lock_NO_icf=None)[source]
Derive total element abundances from ionic abundances + ICFs.
- Parameters:
ionic (dict) – Ionic abundance dict from
compute_ionic_abundances().logU (float, optional) – Ionisation parameter log(U). Required for Martinez+25 ICFs.
Z_Zsun (float, optional) – Gas-phase metallicity in solar units. Required for Martinez+25 ICFs.
ne (float, optional) – Electron density in cm^-3 for Martinez+25 ICF density interpolation.
icf_method (str) –
"auto"(default): use Martinez+25 for N/O when logU is provided, fall back to Izotov+06 otherwise."martinez25": force Martinez+25 ICFs (requires logU and Z_Zsun)."izotov06": use Izotov+06 ICFs only."direct_sum": sum all detected nitrogen ions directly (Topping+2024, Yanagisawa+2025, Cameron+2023). Tiered fallback: Tier 1 (N⁺ + N²⁺ + N³⁺) / (O⁺ + O²⁺), Tier 2/3 (N²⁺ + N³⁺) / O²⁺, Tier 4 Izotov+06 optical fallback._lock_NO_icf (str | None)
- Returns:
Total abundance ratios:
"O/H","N/O","S/O","Ne/O","Ar/O","C/O","N/O_UV"as available. When Martinez+25 is used, also includes"NO_icf_name"and"icf_method"keys.- Return type:
- jwspecabund.direct.heI_4714_over_4472(Te, ne)[source]
Predict the He I 4714 / He I 4472 recombination flux ratio.
Used to deblend the [Ar IV] 4711 line from the He I 4714 line that falls in the same fitted feature (
ArIV_4713). The He I 4714 contribution is estimated asratio * F(HEI_4472)and subtracted:F([Ar IV] 4711) = F(ArIV_4713) - ratio * F(HEI_4472).
The ratio is computed from PyNEB He I recombination emissivities (Storey & Hummer 1995) rather than hard-coded, so it tracks the assumed T_e and n_e (~0.11 at 10⁴ K to ~0.18 at 2x10⁴ K).
- jwspecabund.direct.ne_zone_fallback(zone, z)[source]
Return the redshift-dependent electron-density fallback for a zone.