TS-Length Inversion#
- echopop.inversion.ts_length_regression(length: ndarray | float, slope: float, intercept: float) ndarray#
Convert length values into acoustic target strength (TS, dB re. 1 \(\text{m}^{-2}\)).
- Parameters:
- lengthUnion[np.ndarray, float]
Length value(s) typically represented in ‘cm’ that will be converted into acoustic target strength (TS, dB re. 1 \(\\text{m}^{-2}\)).
- slopefloat
TS-length regression slope coefficient
- interceptfloat
TS-length regression intercept coefficient
- Returns:
- np.ndarray
Target strength values in dB re. 1 \(\\text{m}^{-2}\)
Notes
The TS-length relationship follows the standard log-linear form:
\[\begin{split}\\text{TS} = \\beta_1 \\times \\log_{10}(L) + \\beta_0\end{split}\]where \(L\) is the length, \(\\beta_1\) is the slope, and \(\\beta_0\) is the \(y\)-intercept. This is commonly used in fisheries acoustics where the relationship between fish length and acoustic backscatter follows this logarithmic pattern.
Examples
Single length
>>> ts = ts_length_regression(20.0, slope=20.0, intercept=-68.0) >>> print(f"TS for 20cm fish: {ts:.2f} dB") TS for 20cm fish: -42.00 dB
Multiple lengths
>>> # Multiple length values >>> lengths = np.array([10, 15, 20, 25, 30]) >>> ts_values = ts_length_regression(lengths, slope=20.0, intercept=-68.0) >>> print("Lengths:", lengths) >>> print("TS values:", ts_values) Lengths: [10 15 20 25 30] TS values: [-48. -44.77 -42. -39.82 -38. ]
- class echopop.inversion.InversionLengthTS(model_parameters: dict[str, Any])#
Perform acoustic inversion using a log-linear length–TS relationship.
This class implements acoustic inversion by relating fish length to acoustic backscatter through empirical TS-length relationships. It calculates stratified mean backscattering cross-sections and converts \(S_\\text{A}\) (vertically integrated backscatter) to estimates of number density.
- Parameters:
- model_parametersDict[str, Any]
Dictionary containing model configuration. Required keys:
'ts_length_regression': Dictionary with'slope'and'intercept'for the TS-length regression equation.'stratify_by': str or List[str] - stratification columns (e.g.,'stratum_number')
Optional keys:
'expected_strata': An array of specific strata to expect in the data'impute_missing_strata': A boolean argument that elects whether or not to impute missing strata values'haul_replicates':A boolean argument that elects whether or not to use haul numbers/ids as replicates instead of individuals to account for pseudoreplication.
- Attributes:
- sigma_bs_haulpandas.DataFrame or None
Haul-level backscattering cross-sections
- sigma_bs_stratapandas.DataFrame or None
Stratum-level backscattering cross-sections
Methods
get_stratified_sigma_bs(length_data[, ...])Calculate stratified mean backscattering cross-sections (sigma_bs) by stratum.
invert(nasc_data, length_data)Invert NASC data to number density using the TS-length regression.
set_haul_sigma_bs(length_data)Compute the mean linear scattering coefficient (sigma_bs) for each haul.
Notes
The inversion process follows these steps:
Quantize length data and compute TS using the regression equation
Convert TS to linear backscattering cross-section (\(\\sigma_\\text{bs}\))
Calculate stratified mean sigma_bs values
Impute missing strata if specified
Convert vertically integrated backscatter to number density where:
\[\begin{split}\\rho_\\text{v} = \\frac{S_\\text{A}}{4\\pi \\times \\sigma_\\text{bs}}\end{split}\]where \(\\rho_\\text{v}\) is number density (animals \(\\text{nmi}^{-2}\)) and \(S_\\text{A}\) is the vertically integrated backscatter over an area (\(\\text{m}^2\\, \\text{nmi}^{-2}\)) that is commonly called the nautical area scattering coefficient (NASC).
Examples
>>> # Define model parameters >>> params = { ... "ts_length_regression": {"slope": 20.0, "intercept": -68.0}, ... "stratify_by": "stratum_ks", ... "strata": [1, 2, 3, 4, 5], ... "impute_missing_strata": True ... } >>> >>> # Initialize inverter >>> inverter = InversionLengthTS(params) >>> >>> # Set haul-level sigma_bs from biological data >>> inverter.set_haul_sigma_bs([specimen_df, length_df]) >>> >>> # Perform inversion on NASC data >>> result = inverter.invert(nasc_df) >>> print(result['number_density'].sum()) 1234567.89