Implementation details - hzovaro/spaxelsleuth GitHub Wiki
This section provides some details as to how various quantities are computed in the DataFrames output by spaxelsleuth. Please see the docstrings for the relevant functions for further details.
Angular diameter distances and luminosity distances are used in the computation of various quantities, including angular scales and luminosities. These distances are computed from the redshifts assuming a flat $\Lambda$CDM cosmology with default cosmological parameters
{
...
"H_0": 68,
"Omega_0": 0.31,
...
}
Currently the distance calculations are performed in the survey-specific submodules of io, e.g. io.sami, using astropy.cosmology.FlatLambdaCDM.
Functions: utils.dqcut.set_flags(), utils.dqcut.apply_flags()
To ensure high-quality kinematics and fluxes of individual components within individual spaxels, the following data quality and S/N cuts are made in each row and are denoted by a series of flags which can be accessed as columns in the DataFrame. In the following, <line> represents an emission line, and <component> corresponds to the kinematic component: "component 1/2/3/etc." denotes individual kinematic emission line components, and "total" corresponds to total fluxes etc. derived by summing together the values across all kinematic components in each spaxel.
-
Flux S/N cuts (
Low flux S/N flag - <line> (<component>)): flags emission line fluxes where the S/N < 5 (defined as the flux divided by the formal uncertainty). This applies both to total emission line fluxes and those within individual components. Discarded fluxes are replaced with NaNs.- Values that get masked out: all quantities based on the emission line flux in this component - e.g. metallicities, SFRs, etc.. If the emission line is is Hɑ, then all quantities based on this component - including kinematics - are also masked out, which is based on the assumption that Hɑ is generally the strongest line.
-
Missing flux cuts (
Missing flux flag - <line> (<component>)): flags emission lines with "missing" (i.e. NaN) fluxes in which the error on the flux is finite.- Values that get masked out: all quantities based on the emission line flux in this component - e.g. metallicities, SFRs, etc.. If the emission line is is Hɑ, then all quantities based on this component - including kinematics - are also masked out.
-
Amplitude-to-noise (A/N) cuts (
Low amplitude flag - <line> (<component>)): flags emission line fluxes where the A/N < 3 (which is defined as the Gaussian amplitude of the component divided by the RMS noise in the rest-frame wavelength range 6500 Å - 6540 Å). In spaxels where all components have low amplitudes, the flagLow amplitude flag - <line> (total)will be set toTrue. Discarded fluxes are replaced with NaNs.- Values that get masked out: all quantities based on the emission line flux in this component - e.g. metallicities, SFRs, etc.. If the emission line is is Hɑ, then all quantities based on this component - including kinematics - are also masked out.
-
Note: the column
HALPHA A/N (measured)is unrelated to this cut: this column measures the
-
Flux fraction cut (
Low flux fraction flag - {eline} (<component>)): flags spaxels where the flux ratio of the broad (component 2) to narrow (component 1) fluxes is less than 0.05. Note: not used by default with SAMI data.- Values that get masked out: all quantities based on the emission line flux in this component - e.g. metallicities, SFRs, etc.. If the emission line is is Hɑ, then all quantities based on this component - including kinematics - are also masked out.
-
Beam smearing cut (
Beam smearing flag (<component>)): flags emission line components likely to be affected by beam smearing, i.e. withsigma_gas(component n) <v_grad(component n) wherev_gradis computed using eqn. 1 of Zhou et al. (2017). Note: not used by default with SAMI data.-
Values that get masked out: gas kinematics (i.e.,
sigma_gasandv_gas) in the corresponding components and all quantities derived using these values.
-
Values that get masked out: gas kinematics (i.e.,
-
Velocity dispersion S/N cut (
Low sigma_gas S/N flag (<component>)): flags components where the gas velocity dispersion S/N (as defined by Federrath et al. 2017) is less than 3, which generally applies to individual emission line components that are very close to the instrumental resolution.- Values that get masked out: gas velocity dispersions in the corresponding components and all quantities derived using these values.
-
Stellar kinematics cuts: flags spaxels with unreliable stellar kinematics, defined as having
sigma_*< 35 km/s,v_*error > 30 km/s,sigma_*error" >=sigma_** 0.1 + 25, or where the stellar kinematics contain NaNs. Note: this should generally not be used with data sets other than SAMI as the threshold values have been taken from Croom et al. (2018).-
Values that get masked out: stellar kinematics (i.e.,
sigma_*andv_*) in the corresponding component and all quantities derived using these values.
-
Values that get masked out: stellar kinematics (i.e.,
In datasets where emission lines have been fitted with multiple Gaussian components, it is important to consider how to handle spaxels where one or more individual components fail to meet S/N or data quality criteria. We refer to these as "missing components".
For example, a 2-component spaxel in which the 2nd component is a low-S/N component may still have high S/N total fluxes, in which case things like e.g. line ratios for the total flux are most likely still reliable. In this case, you would probably want to mask out the fluxes and kinematics of the low-S/N component, but keep the total fluxes.
In spaxelsleuth, flagging of spaxels with missing components is handled by the function utils.dqcut.apply_flags(). By default, (i.e. when base_missing_flux_components_on_HALPHA = True), we define a "missing component" as one in which both the HALPHA flux and velocity dispersion have been masked out for any reason. If base_missing_flux_components_on_HALPHA = False, it is based only on the velocity dispersion.
Note that while spaxelsleuth will flag affected spaxels (denoted by the Missing components flag column), it will not automatically mask out anything out based on this criterion, allowing the user to control how spaxels with missing components are handled based on their specific use case.
utils.dqcut.apply_flags() adds an additional Number of components column to the DataFrame (not to be confused with the Number of components (original) column, which records the number of kinematic components in each spaxel that were originally fitted to the data). Number of components records the number of reliable components ONLY IF they are in the right order. For example, consider a spaxel that originally has 2 components. Say that component 1 has a low S/N in the gas velocity dispersion, so sigma_gas (component 1) is masked out, but HALPHA (component 1) is not, and that component 2 passes all DQ and S/N cuts. In this case, the spaxel will NOT be recorded as having Number of components = 1 or 2 because component 1 fails to meet the DQ and S/N criteria. It will therefore have an undefined Number of components and will be set to NaN.
Spaxels that still retain their original number of components after making all DQ and S/N cuts can be selected as follows:
df_good_quality_components = df[~df["Missing components flag"]]
Functions: utils.extcorr.compute_A_V(), utils.extcorr.apply_extinction_correction()
Total extinction in the V-band, A_V, is computed using the Balmer decrement, i.e. the Hɑ/Hβ ratio, assuming an intrinsic value of 2.86 (corresponding to a standard nebular temperature and density of 10,000 K and 100 cm^-3). The default reddening curve used is that of Fitzpatrick & Massa (2007). Extinctions are only computed where the S/N in both Hɑ and Hβ exceeds 5, and in rows where the measured Balmer decrement is less than the assumed intrinsic value, A_V is assumed to be 0.
The A_V is only computed based on the total emission line fluxes, i.e. summed across all 3 kinematic components, because the fluxes in individual components are only supplied for Hɑ. However, the extinction correction is applied to all 3 Hɑ components.
The extinction correction corresponding to the computed A_V is applied to all emission line fluxes. Note that equivalent widths are not corrected for extinction, because the stellar continuum extinction is assumed to be unknown.
Functions: utils.metallicity.calculate_metallicity()
Gas-phase metallicities (recorded as log(O/H) + 12) and corresopnding errors are computed using a variety of different strong-line metallicity diagnostics. For some metallicity diagnostics, namely those from Kewley (2019) and the R23 diagnostic from Kobulnicky & Kewley (2004), a self-consistent values for log(O/H) + 12 and log(U) are computed using the method of Kewley & Dopita (2002). For SAMI data, metallicities are computed based on the total emission line fluxes, i.e. summed across all 3 kinematic components.
Errors are computed using a Monte-Carlo approach, in which random noise is added to emission line fluxes (sampled from Gaussian distributions with a standard deviation equal to the flux uncertainty) before computing the metallicity and/or ionisation parameter. This process is repeated 1000 times and the final metallicities/ionisation parameters and errors are taken as the mean and standard deviation of the resulting distribution of metallicity/ionisation parameter values.
Important caveat for the Kobulnicky & Kewley (2004) R23 (R23_KK04) and Kewley & Dopita (2002) N2O2 (KD02) diagnostics: both of these diagnostics involve lines in the [OII]3726,9 doublet. In Kobulnicky & Kewley (2004) it is clear that their original definition uses only the [OII]3726 line. Similarly, the definition used by Kewley & Dopita (2002) appears to only incorporate the [OII]3726 line, but this conflicts with the caption in their fig. 3 which says that both lines are used, and so it's unclear whether one or both lines should be included when calculating the N2O2 ratio to use in their diagnostic. To make matters more confusing, Poetrodjojo et al. (2021) use both of these diagnostics in their analysis, in which they include the fluxes of both lines in the doublet when computing their line ratios as input to these diagnostics (this is detailed in their appendix). It is therefore unclear whether it is appropriate to use both lines in the doublet for these diagnostics. Currently, this module uses the [OII]3726,9 fluxes to calculate the line ratios for these diagnostics, which may strictly be incorrect. Please keep this in mind when interpreting metallicities calculated using these diagnostics!
Functions: utils.linefns.bpt_fn()
Spaxels are spectrally classified using the standard optical diagnostic diagrams of Baldwin, Philips and Terlevich (1981) and Veilleux & Osterbrock (1987), which plot the [O III]5007/Hβ ratio (O3) against the [N II]6583/Hɑ (N2), [S II]6717,31/Hɑ (S2), and [O I]6300/Hɑ (O1) ratios. Classifications are based on the total emission line fluxes in each spaxel.
Only the O3 vs. N2 and O3 vs. S2 diagrams are used in spectral classification due to the relative weakness of the [O I] emission line. To ensure reliable classification, only spaxels with a flux S/N of at least 5 in all of Hβ, Hɑ, [O III]5007, [N II]6583, and [S II]6716,31 lines are classified. Note that, in cases where multiple emission line components are present that arise from different excitation mechanisms (e.g., a star-forming component plus a shocked component), the classification is naturally weighted towards the component with the highest luminosity.
Each spaxel is assigned one of the following spectral classification, based on the total emission line fluxes in each spaxel:
- Star-forming (SF): lies below the Kauffmann et al. (2003) line in the N2 diagram, and below the Kewley et al. (2001) "extreme starburst" line in the S2 diagram.
- Composite: lies above the Kauffmann et al. (2003) line in the N2 diagram but below the the Kewley et al. (2001) "extreme starburst" line in both the N2 and S2 diagrams.
- LINER: lies above the Kewley et al. (2001) "extreme starburst" line in both the N2 and S2 diagrams but below the Kewley et al. (2006) LINER/Seyfert line in the S2 diagram.
- Seyfert: lies above the Kewley et al. (2001) "extreme starburst" line in both the N2 and S2 diagrams but above the Kewley et al. (2006) LINER/Seyfert line in the S2 diagram.
- Ambiguous: inconsistent classifications between the O3 vs. N2 and O3 vs. S2 diagrams; e.g., composite-like in the N2 diagram, but LINER-like in the S2 diagram.
- Not classified: low S/N in or missing at least one of Hɑ, Hβ, [N II], [S II] or [O III] fluxes.
Functions: utils.linefns.compute_SFR()
SFRs are computed from the Hɑ luminosity using the calibration of Calzetti (2013), which assumes a stellar mass range 0.1 – 100 M_sun, star formation timescape >= 6 Myr, a temperature 10000 K, and an electron density 100 cm^-3. Note: since SFR maps are provided with SAMI DR3, spaxelsleuth uses these values rather than computing new ones for the SAMI data set.
Where redshifts are available, distances are computed from the redshifts assuming a flat ΛCDM cosmology with H0 = 70 km/s/Mpc, ΩM = 0.3 and ΩΛ = 0.7.