| Title: | Physics-Based Models for Acoustic Target Strength |
|---|---|
| Description: | Acoustic target strength (TS) represents the intensity of an echo returning from an individual scatterer such as bubbles, fish, or zooplankton. TS can be used to convert integrated or volumetric backscatter collected from fisheries acoustic surveys into units of number density (e.g. animals per m^3), abundance (e.g. number of animals), and biomass (e.g. kg). This parameter can also be used to aid in classifying backscatter, such as separating likely echoes of large predatory fish (e.g. adult cod) from smaller prey (e.g. shrimp). One way to estimate TS is to use physics-based models to calculate theoretical TS that comprise exact and approximate solutions as well as analytical approaches. The models provided can help provide TS estimates over broad statistical distributions of model parameters. Applications are described by Lucca et al. (2023) <doi:10.1121/10.0022459>, with fisheries-acoustics principles from Simmonds and MacLennan (2005) <doi:10.1002/9780470995303>. |
| Authors: | Brandyn Lucca [aut, cre, cph] (ORCID: <https://orcid.org/0000-0003-3145-2969>), Arnie Lee Van Buren [ctb, cph] (Author and copyright holder of upstream prolate_swf code adapted for this package), Jeffrey E. Boisvert [ctb] (Coauthor of upstream prolate_swf code adapted for this package) |
| Maintainer: | Brandyn Lucca <[email protected]> |
| License: | GPL-3 |
| Version: | 2.0.8 |
| Built: | 2026-10-12 16:01:07 UTC |
| Source: | https://github.com/brandynlucca/acousticts |
Along-matrix summing function
along_sum(rpos, iterations)along_sum(rpos, iterations)
rpos |
Position vector |
iterations |
Number of iterations |
A numeric matrix containing the adjacent column sums of
rpos.
positions <- matrix(1:8, nrow = 2) along_sum(positions, ncol(positions))positions <- matrix(1:8, nrow = 2) along_sum(positions, ncol(positions))
Creates arbitrary body shape from user inputs
arbitrary(..., length_units = "m")arbitrary(..., length_units = "m")
... |
Any coordinate or parameter vectors (e.g., x_body, y_body, z_body, radius_body, w_body, zU_body, zL_body, custom_*). Inputs are stored and padded to a common length; validation happens downstream in model-specific code. |
length_units |
Units for body length. Defaults to meters: "m" |
An Arbitrary shape object containing the padded
position matrix and stored shape metadata.
# Symmetric arbitrary shape using x/y/z + radius arbitrary( x_body = c(0, 0.01), y_body = c(0, 0), z_body = c(0, 0), radius_body = c(0, 0.002) ) # Dorsal/ventral style inputs arbitrary( x_body = c(0, 0.015), w_body = c(0.005, 0.0075), zU_body = c(0.001, 0.002), zL_body = c(-0.001, -0.002) )# Symmetric arbitrary shape using x/y/z + radius arbitrary( x_body = c(0, 0.01), y_body = c(0, 0), z_body = c(0, 0), radius_body = c(0, 0.002) ) # Dorsal/ventral style inputs arbitrary( x_body = c(0, 0.015), w_body = c(0.005, 0.0075), zU_body = c(0.001, 0.002), zL_body = c(-0.001, -0.002) )
List available target-strength models
available_models()available_models()
A data frame describing currently available built-in and user-registered target-strength models.
head(available_models())head(available_models())
A S4 class that stores a fluid-like flesh component together with an explicit elastic backbone component for swimbladder-less fish applications where those two structures should remain separate. The body and backbone each retain their own geometry, orientations, and material properties. This class is intended to support composite flesh-plus-backbone model development and future extensions where additional internal structures may need to be carried alongside the body.
An object of the BBF S4 class.
methods::getClass("BBF")methods::getClass("BBF")
Generate a BBF-class object.
bbf_generate( body_shape, backbone_shape, density_body = NULL, sound_speed_body = NULL, g_body = NULL, h_body = NULL, density_backbone, sound_speed_longitudinal_backbone, sound_speed_transversal_backbone, theta_body = pi/2, theta_backbone = pi/2, x_offset_backbone = 0, z_offset_backbone = 0, theta_units = "radians", length_units = "m", ID = NULL )bbf_generate( body_shape, backbone_shape, density_body = NULL, sound_speed_body = NULL, g_body = NULL, h_body = NULL, density_backbone, sound_speed_longitudinal_backbone, sound_speed_transversal_backbone, theta_body = pi/2, theta_backbone = pi/2, x_offset_backbone = 0, z_offset_backbone = 0, theta_units = "radians", length_units = "m", ID = NULL )
body_shape |
Pre-built body shape. Must inherit from |
backbone_shape |
Pre-built backbone shape. Must be a cylindrical
|
density_body |
Flesh density (ρbody, kg m3). |
sound_speed_body |
Flesh sound speed (cbody, m s-1). |
g_body |
Body density contrast. |
h_body |
Body sound speed contrast. |
density_backbone |
Backbone density (ρbb, kg m3). |
sound_speed_longitudinal_backbone |
Longitudinal wave speed in the backbone (m/s). |
sound_speed_transversal_backbone |
Transversal wave speed in the backbone (m/s). |
theta_body |
Body orientation relative to the incident wave (radians). |
theta_backbone |
Backbone orientation relative to the incident wave (radians). |
x_offset_backbone |
Along-body translation applied to the backbone geometry (m). |
z_offset_backbone |
Dorsoventral translation applied to the backbone geometry (m). |
theta_units |
Compatibility argument. Scatterer constructors now assume radians and ignore non-SI alternatives. |
length_units |
Compatibility argument. Scatterer constructors now assume meters and ignore non-SI alternatives. |
ID |
Optional metadata identifier. |
bbf_generate() is intended for swimbladder-less fish workflows where
the flesh and backbone should remain explicit, separately parameterized
components. The body is stored using the same segmented-body representation
used by FLS, while the backbone is stored as an explicit
cylindrical component carrying elastic material properties for use by
cylinder-based modal models.
Generates a BBF-class object.
body_shape <- arbitrary( x_body = c(0, 0.04, 0.08), zU_body = c(0.001, 0.004, 0.001), zL_body = c(-0.001, -0.004, -0.001) ) backbone_shape <- cylinder( length_body = 0.06, radius_body = 0.0008, n_segments = 40 ) bbf_generate( body_shape = body_shape, backbone_shape = backbone_shape, density_body = 1070, sound_speed_body = 1570, density_backbone = 1900, sound_speed_longitudinal_backbone = 3500, sound_speed_transversal_backbone = 1700 )body_shape <- arbitrary( x_body = c(0, 0.04, 0.08), zU_body = c(0.001, 0.004, 0.001), zL_body = c(-0.001, -0.004, -0.001) ) backbone_shape <- cylinder( length_body = 0.06, radius_body = 0.0008, n_segments = 40 ) bbf_generate( body_shape = body_shape, backbone_shape = backbone_shape, density_body = 1070, sound_speed_body = 1570, density_backbone = 1900, sound_speed_longitudinal_backbone = 3500, sound_speed_transversal_backbone = 1700 )
A packaged list of benchmark target-strength spectra for the canonical
sphere, shell-sphere, finite-cylinder, and prolate-spheroid comparison cases
used throughout the package validation workflow. The stored values follow
the benchmark definitions assembled by Jech et al. (2015) and distributed in
the echoSMs reference resources.
data(benchmark_ts)data(benchmark_ts)
An object of class list of length 2.
A list of benchmark target-strength spectra.
echoSMs benchmark resources, especially the target-definition
and Jech benchmark tables archived at
https://github.com/ices-tools-dev/echoSMs.
Jech, J.M., Horne, J.K., Chu, D., Demer, D.A., Francis, D.T.I., Gorska, N., Jones, B., Lavery, A.C., Stanton, T.K., and Reeder, D.B. (2015). Comparisons among ten models of acoustic backscattering used in aquatic ecosystem research. The Journal of the Acoustical Society of America, 138, 3742-3764. doi:10.1121/1.4937607
Jech, M., and Macaulay, G. echoSMs: Acoustic backscattering models
used in aquatic ecosystem research. GitHub repository:
https://github.com/ices-tools-dev/echoSMs
data("benchmark_ts", package = "acousticTS") str(benchmark_ts, max.level = 1)data("benchmark_ts", package = "acousticTS") str(benchmark_ts, max.level = 1)
Apply a smooth curvature transformation to an existing scatterer body or to a
list-like body component containing an rpos matrix. This is useful
when a target should keep the same broad identity while adopting a curved
centerline for model comparisons or sensitivity studies.
brake(object, radius_curvature, mode = "ratio")brake(object, radius_curvature, mode = "ratio")
object |
Dataframe or scatterer-class object |
radius_curvature |
Radius of curvature that can be parameterized either as a ratio relative to body length or actual measurement |
mode |
Either "ratio" or "measurement" |
A bent version of object, returned as the same broad object
type with updated geometry and curvature metadata.
extract(), reforge(), translate_shape(), reanchor_shape(),
inflate_shape(), smooth_shape(), resample_shape(), flip_shape(),
offset_component()
shape_obj <- cylinder( length_body = 0.05, radius_body = 0.003, n_segments = 80 ) obj <- fls_generate( shape = shape_obj, density_body = 1045, sound_speed_body = 1520 ) bent_obj <- brake(obj, radius_curvature = 5) head(extract(bent_obj, c("body", "rpos", "z"))) extract(bent_obj, c("shape_parameters", "radius_curvature_ratio")) bent_body <- brake( extract(obj, "body"), radius_curvature = 0.35, mode = "measurement" ) head(bent_body$rpos["z", ])shape_obj <- cylinder( length_body = 0.05, radius_body = 0.003, n_segments = 80 ) obj <- fls_generate( shape = shape_obj, density_body = 1045, sound_speed_body = 1520 ) bent_obj <- brake(obj, radius_curvature = 5) head(extract(bent_obj, c("body", "rpos", "z"))) extract(bent_obj, c("shape_parameters", "radius_curvature_ratio")) bent_body <- brake( extract(obj, "body"), radius_curvature = 0.35, mode = "measurement" ) head(bent_body$rpos["z", ])
Calculates the bulk modulus (K) from two of the three other elastic moduli:
Young's modulus (E), shear modulus (G), or Poisson's ratio ().
Assumes 3D material properties.
The relationships used are:
bulk(E = NULL, G = NULL, nu = NULL)bulk(E = NULL, G = NULL, nu = NULL)
E |
Young's modulus (Pa). |
G |
Shear modulus (Pa). |
nu |
Poisson's ratio (Dimensionless). |
Bulk modulus (K, Pa).
bulk(E = 3e9, G = 1.1e9)bulk(E = 3e9, G = 1.1e9)
A S4 class that provides slots to contain relevant metadata for solid sphere
objects belonging to the CAL-class scatterers. This object is created using
parameters specific to the outer shell. The default behavior of this object
is to only reference these outer elastic shell properties with few
exceptions that are model-dependent. CAL inherits from the broader
elastic-based ELA class rather than from ESS, because
calibration targets are solid elastic bodies rather than elastic shells. See
Scatterer for a more detailed description on how this S4 object is
organized.
An object of the CAL S4 class.
methods::getClass("CAL")methods::getClass("CAL")
Generate a CAL-class object.
cal_generate( material = "WC", diameter = 0.0381, sound_speed_longitudinal = NULL, sound_speed_transversal = NULL, density_sphere = NULL, theta_sphere = pi, ID = NULL, diameter_units = "m", theta_units = "radians", n_segments = 100 )cal_generate( material = "WC", diameter = 0.0381, sound_speed_longitudinal = NULL, sound_speed_transversal = NULL, density_sphere = NULL, theta_sphere = pi, ID = NULL, diameter_units = "m", theta_units = "radians", n_segments = 100 )
material |
Material type for the solid sphere. See 'Details' for built-in material options. |
diameter |
Spherical diameter (m). |
sound_speed_longitudinal |
Longitudinal sound speed (m/s). |
sound_speed_transversal |
Transversal sound speed (m/s). |
density_sphere |
Density (kg/m^3). |
theta_sphere |
Backscattering direction (Default: pi radians). |
ID |
Optional metadata ID input. |
diameter_units |
Compatibility argument. |
theta_units |
Compatibility argument. |
n_segments |
Number of segments to discretize object shape. |
There are several options for the material argument:
| Material | Argument | c1 | c2 |
|
|
| Tungsten carbide | "WC" | 6853 | 4171 | 14900 | |
| Stainless steel | "steel" | 5980 | 3297 | 7970 | |
| Brass | "brass" | 4372 | 2100 | 8360 | |
| Copper | "Cu" | 4760 | 2288.5 | 8947 | |
| Aluminum | "Al" | 6260 | 3080 | 2700 |
Generates a CAL-class object.
cal_generate(material = "WC", diameter = 38.1e-3, n_segments = 120)cal_generate(material = "WC", diameter = 38.1e-3, n_segments = 120)
Build an explicit canonical surrogate shape from an existing Shape object.
This is intended for workflows where a measured or segmented body should be
approximated deliberately by one of the package's canonical geometries before
being passed to a shape-specific model family such as SPHMS, PSMS, or
FCMS.
canonicalize_shape( shape, to = c("ProlateSpheroid", "Cylinder", "Sphere", "OblateSpheroid"), method = c("auto", "volume", "length_volume", "profile_l2"), n_segments = NULL, diagnostics = FALSE )canonicalize_shape( shape, to = c("ProlateSpheroid", "Cylinder", "Sphere", "OblateSpheroid"), method = c("auto", "volume", "length_volume", "profile_l2"), n_segments = NULL, diagnostics = FALSE )
shape |
A |
to |
Canonical target shape. One of |
method |
Canonicalization rule. |
n_segments |
Optional number of segments for the returned canonical shape. Defaults to the source shape segment count. |
diagnostics |
Logical. If |
canonicalize_shape() is intentionally explicit. It does not run
automatically inside model calls such as target_strength(..., model = "psms"), because there is no single defensible canonicalization rule for
every biological or segmented target.
When the input shape contains both an explicit width profile and upper/lower height profiles, the canonicalization step first reduces those local cross-sections to an equal-area circular radius before fitting the canonical surrogate. That keeps the reduction axisymmetric while still honoring the original local cross-sectional area more closely than a height-only radius.
The returned diagnostics report how the source and target compare in length, enclosed volume, maximum equivalent radius, and equivalent-radius profile root-mean-square error on the source x-grid. Those diagnostics are the package's recommended way to judge whether a canonical surrogate is defensible for the intended model comparison.
If diagnostics = FALSE, a canonical Shape object. If
diagnostics = TRUE, a list with elements:
shape: the fitted canonical Shape
diagnostics: a named list of source, target, and fit metrics
create_shape(), arbitrary(), sphere(), cylinder(),
prolate_spheroid(), oblate_spheroid()
bladder_like <- arbitrary( x_body = c(0, 0.01, 0.02, 0.03, 0.04), radius_body = c(0, 0.004, 0.006, 0.004, 0) ) psms_shape <- canonicalize_shape( bladder_like, to = "ProlateSpheroid" ) cyl_fit <- canonicalize_shape( bladder_like, to = "Cylinder", diagnostics = TRUE ) cyl_fit$diagnostics$fit$radius_nrmsebladder_like <- arbitrary( x_body = c(0, 0.01, 0.02, 0.03, 0.04), radius_body = c(0, 0.004, 0.006, 0.004, 0) ) psms_shape <- canonicalize_shape( bladder_like, to = "ProlateSpheroid" ) cyl_fit <- canonicalize_shape( bladder_like, to = "Cylinder", diagnostics = TRUE ) cyl_fit$diagnostics$fit$radius_nrmse
A pre-generated SBF scatterer containing all information required for target
strength modeling. The packaged object corresponds to the historical
Atlantic cod example used in the KRM literature and matches the Cod D case
archived in the echoSMs KRM shape collection.
data(cod)data(cod)
A pre-generated SBF scatterer containing all information required for target strength modeling.
Relevant and identifying metadata (list).
Container for specified model parameters
(list).
Model outputs and results (list).
List with:
rpos: Position matrix (x, yw, zU, zL; m).
sound_speed: Flesh sound speed (, m/s).
density: Flesh density (, kg/m).
theta: Orientation relative to transducer
(, radians).
List with:
rpos: Position matrix (x, yw, zU, zL; m).
sound_speed: Flesh sound speed (, m/s).
density: Flesh density
(, kg/m).
theta: Orientation relative to transducer
(, radians).
Named list with:
body: List with length (m), ncyl (int),
theta_units (str), length_units (str).
bladder: List with length (m), ncyl (int),
theta_units (str), length_units (str).
A pre-generated SBF scatterer object.
Historical KRM cod shape collection archived in echoSMs
(https://github.com/ices-tools-dev/echoSMs) and associated with the
Clay and Horne Atlantic cod example.
Clay, C.S., and Horne, J.K. (1994). Acoustic models of fish: The Atlantic cod (Gadus morhua). The Journal of the Acoustical Society of America, 96, 1661-1668. doi:10.1121/1.410245
data("cod", package = "acousticTS") coddata("cod", package = "acousticTS") cod
) of a scattering
boundary/interface.Calculates the compressibility contrast () between a scattering
interface and the surrounding medium. Compressibility is defined as:
where is density () and is sound speed
().
The compressibility contrast is then:
where is the compressibility of the medium and is that
of the target interface.
compressibility(medium, target)compressibility(medium, target)
medium |
Dataframe object containing density ( |
target |
Dataframe object containing density ( |
Compressibility contrast (), dimensionless.
seawater <- data.frame(density = 1026, sound_speed = 1480) animal <- data.frame(density = 1050, sound_speed = 1530) compressibility(seawater, animal)seawater <- data.frame(density = 1026, sound_speed = 1480) animal <- data.frame(density = 1050, sound_speed = 1530) compressibility(seawater, animal)
A wrapper function that automatically creates generalized and/or canonical shapes for TS modeling.
create_shape(shape, ...)create_shape(shape, ...)
shape |
Shape. Details for shape specification are provided under 'Details', including mandatory arguments. |
... |
Additional input arguments for subsequent shape generation functions. |
The shape argument specifies what shape for the function to generate the desired shape for TS modeling. Options currently include:
| Object shape | shape = ... | Parameters | Root function | ||
| Discrete/tapered cylinder | "cylinder" | length, radius |
cylinder(...)
|
||
| Polynomial cylinder | "polynomial_cylinder" | length, radius, polynomial |
polynomial_cylinder(...)
|
||
| Oblate spheroid | "oblate_spheroid" | length, radius |
oblate_spheroid(...)
|
||
| Prolate spheroid | "prolate_spheroid" | length, radius |
prolate_spheroid(...)
|
||
| Sphere | "sphere" | radius |
sphere(...)
|
length: the x-axis length of the shape.
radius: the radius of the shape when applicable.
length_radius_ratio: the length-to-radius ratio (L/A), which specifically refers to the radius at the mid-point of the cylinder and should be the maximum value. A typical L/A ratio in the literature is 16 for krill.
taper: the taper order (n), which parameterizes the tapering function reported by Chu et al. (1993) to create a tapered cylinder. The tapering order will converge on a prolate and oblate spheroid when L > 2a and L < 2a, respectively, and n = 2. A typical taper order in the literature is 10.
polynomial: the vector of arbitrary polynomial coefficients to generate a deformed cylinder as reported by Smith et al. (2013). Although listed as a mandatory argument for the polynomial cylinder function, it has a default setting that uses the sixth-degree polynomial coefficients reported by Smith et al. (2013).
A Shape object.
create_shape("sphere", radius_body = 0.01) create_shape( "prolate_spheroid", length_body = 0.04, radius_body = 0.004 ) create_shape( "oblate_spheroid", length_body = 0.012, radius_body = 0.01 ) create_shape( "cylinder", length_body = 0.05, radius_body = 0.003 )create_shape("sphere", radius_body = 0.01) create_shape( "prolate_spheroid", length_body = 0.04, radius_body = 0.004 ) create_shape( "oblate_spheroid", length_body = 0.012, radius_body = 0.01 ) create_shape( "cylinder", length_body = 0.05, radius_body = 0.003 )
A shared parent S4 class for composite scatterers that retain a primary body
component together with one or more additional anatomically distinct
sub-components. The CSC-class is intended to provide modular
scaffolding for multi-component biological targets, such as
swimbladder-bearing fish and swimbladder-less fish represented as flesh plus
backbone. It stores the primary body, a general component list, the shared
model output slot, and shape metadata without implying any one specific
resonant or elastic inclusion type.
An object of the CSC S4 class.
methods::getClass("CSC")methods::getClass("CSC")
Creates a cylinder.
cylinder(length_body, radius_body = NULL, length_radius_ratio = NULL, taper = NULL, radius_curvature_ratio = NULL, n_segments = 100, length_units = "m")cylinder(length_body, radius_body = NULL, length_radius_ratio = NULL, taper = NULL, radius_curvature_ratio = NULL, n_segments = 100, length_units = "m")
length_body |
Length (m). |
radius_body |
Maximum/uniform radius (m). |
length_radius_ratio |
Optional ratio input when radius is not explicitly known. |
taper |
Optional input that is the degree of taper to round ends of the cylinder. |
radius_curvature_ratio |
Optional curvature ratio metadata for rounded cylinder-end workflows. |
n_segments |
Number of segments to discretize object shape. Defaults to 1e2 segments. |
length_units |
Units (default is meters, "m"). |
Creates the position vector for a tapered or untapered cylinder.
cylinder(length_body = 0.05, radius_body = 0.003, n_segments = 80)cylinder(length_body = 0.05, radius_body = 0.003, n_segments = 80)
Convert angular measurements from radians to degrees
degrees(x)degrees(x)
x |
A real value in radians |
Angle in degrees
orientation <- pi / 2 # radians degrees(orientation) # this should return a value equal to 90 degreesorientation <- pi / 2 # radians degrees(orientation) # this should return a value equal to 90 degrees
A shared parent S4 class for elastic-based scatterers. The ELA-class
collects the slots common to solid elastic targets such as calibration
spheres (CAL) and elastic-shelled targets (ESS), without
implying a particular internal structure such as a shell or homogeneous
elastic solid. See Scatterer for a more detailed description of the
shared object organization.
An object of the ELA S4 class.
methods::getClass("ELA")methods::getClass("ELA")
Generate a ELA-class object.
ela_generate( shape, density_body = NULL, sound_speed_longitudinal_body = NULL, sound_speed_transversal_body = NULL, theta_body = pi/2, ID = NULL, length_units = "m", theta_units = "radians" )ela_generate( shape, density_body = NULL, sound_speed_longitudinal_body = NULL, sound_speed_transversal_body = NULL, theta_body = pi/2, ID = NULL, length_units = "m", theta_units = "radians" )
shape |
Pre-built |
density_body |
Optional body density (kg/m^3). |
sound_speed_longitudinal_body |
Optional longitudinal wave speed (m/s). |
sound_speed_transversal_body |
Optional transversal wave speed (m/s). |
theta_body |
Body orientation relative to the incident wave (radians). |
ID |
Optional metadata identifier. |
length_units |
Compatibility argument. Scatterer constructors now assume meters and ignore non-SI alternatives. |
theta_units |
Compatibility argument. Scatterer constructors now assume radians and ignore non-SI alternatives. |
ela_generate() builds a generic solid-elastic scatterer under the shared
ELA class. Unlike CAL, it is not restricted to spheres, so it can carry
prolate, oblate, cylindrical, or arbitrary elastic shapes together with the
body density and longitudinal/transversal wave speeds used by solid-elastic
models such as TMM.
ELA-class object.
elastic_sphere <- sphere(radius_body = 0.01, n_segments = 40) ela_generate( shape = elastic_sphere, density_body = 7800, sound_speed_longitudinal_body = 5900, sound_speed_transversal_body = 3200 )elastic_sphere <- sphere(radius_body = 0.01, n_segments = 40) ela_generate( shape = elastic_sphere, density_body = 7800, sound_speed_longitudinal_body = 5900, sound_speed_transversal_body = 3200 )
A S4 class that provides slots to contain relevant metadata for elastic
shelled scatterers/objects belonging to the ESS-class. This object can be
created using values for both an outer shell and internal tissues, if
applicable. The default behavior for this type of this object is to only
reference the outer shell with few exceptions that are model-dependent.
ESS inherits from the broader elastic-based ELA class. See
Scatterer for a more detailed description on how this S4 object is
organized.
An object of the ESS S4 class.
methods::getClass("ESS")methods::getClass("ESS")
Generate an ESS-class object
ess_generate( shape = NULL, x_body = NULL, y_body = NULL, z_body = NULL, radius_shell = NULL, shell_thickness = NULL, g_fluid = NULL, density_fluid = NULL, h_fluid = NULL, sound_speed_fluid = NULL, g_shell = NULL, density_shell = NULL, h_shell = NULL, sound_speed_shell = NULL, E = NULL, G = NULL, K = NULL, nu = NULL, theta_shell = pi/2, ID = NULL, theta_units = "radians", length_units = "m" )ess_generate( shape = NULL, x_body = NULL, y_body = NULL, z_body = NULL, radius_shell = NULL, shell_thickness = NULL, g_fluid = NULL, density_fluid = NULL, h_fluid = NULL, sound_speed_fluid = NULL, g_shell = NULL, density_shell = NULL, h_shell = NULL, sound_speed_shell = NULL, E = NULL, G = NULL, K = NULL, nu = NULL, theta_shell = pi/2, ID = NULL, theta_units = "radians", length_units = "m" )
shape |
Pre-built |
x_body |
Vector containing x-axis body (m) shape data. |
y_body |
Vector containing y-axis body (m) shape data. |
z_body |
Vector containing z-axis body (m) shape data. |
radius_shell |
Radius of shell (m). |
shell_thickness |
Optional shell thickness (m). |
g_fluid |
Optional density contrast for fluid-like body. |
density_fluid |
Optional density for fluid-like body (kg/m³). |
h_fluid |
Optional sound speed contrast for fluid-like body. |
sound_speed_fluid |
Optional sound speed for fluid-like body (m/s). |
g_shell |
Density contrast for the shell. |
density_shell |
Optional density for the shell (kg/m³). |
h_shell |
Sound speed contrast for the shell. |
sound_speed_shell |
Optional sound speed for the shell (m/s). |
E |
Young's modulus (Pa) of the shell material. |
G |
Shear modulus (Pa) of the shell material. |
K |
Bulk modulus (Pa) of the shell material. |
nu |
Poisson's ratio (Dimensionless) of the shell material. |
theta_shell |
Object orientation relative to incident sound wave. |
ID |
Optional metadata entry. |
theta_units |
Compatibility argument. Scatterer constructors now assume radians and ignore non-SI alternatives. |
length_units |
Compatibility argument. Scatterer constructors now assume meters and ignore non-SI alternatives. |
The preferred workflow is to build the shell geometry first as a Shape
object and pass it through shape, or to supply explicit shell profile
coordinates directly. Character-based shape dispatch remains available only
as a compatibility pathway and is now deprecated. Material properties for
both the shell and the inner fluid may be supplied either as contrasts or as
absolute values, but each property pair must use only one representation.
Scatterer constructors store geometry in meters and orientations in radians.
length_units and theta_units are retained as compatibility arguments, but
non-SI values are normalized to the package-standard representation.
ESS-class object
shell <- sphere(radius_body = 0.03, n_segments = 80) ess_generate( shape = shell, shell_thickness = 0.001, density_shell = 1050, sound_speed_shell = 2350, density_fluid = 1030, sound_speed_fluid = 1500, E = 3.5e9, nu = 0.34 )shell <- sphere(radius_body = 0.03, n_segments = 80) ess_generate( shape = shell, shell_thickness = 0.001, density_shell = 1050, sound_speed_shell = 2350, density_fluid = 1030, sound_speed_fluid = 1500, E = 3.5e9, nu = 0.34 )
Convenience accessor for reaching into Scatterer and Shape objects
without spelling out direct slot access repeatedly. extract() can also walk
through nested lists, matrices, and named vectors, which makes it useful for
pulling model outputs, component properties, or position-matrix fields from a
common interface. This is especially helpful after geometry manipulations
such as brake() and reforge(), where inspecting the stored body profile
is often the fastest way to confirm what changed.
extract(object, feature)extract(object, feature)
object |
Scatterer-class object. |
feature |
Feature(s) of interest (e.g. body). This can either be a
scalar string, or a vector of names. When a vector is supplied, the function
recursively accesses the Scatterer object using the 'feature' vector as a
directory. For example, |
The extracted object, slot, list element, matrix row/column, or
vector element identified by feature.
brake(), reforge(), translate_shape(), reanchor_shape(),
inflate_shape(), smooth_shape(), resample_shape(), flip_shape(),
offset_component()
obj <- fls_generate( shape = sphere(radius_body = 0.01, n_segments = 40), density_body = 1045, sound_speed_body = 1520 ) extract(obj, "body") extract(obj, c("body", "density")) extract(obj, c("shape_parameters", "shape")) bent_obj <- brake(obj, radius_curvature = 5) head(extract(bent_obj, c("body", "rpos", "z"))) extract(bent_obj, c("shape_parameters", "radius_curvature_ratio"))obj <- fls_generate( shape = sphere(radius_body = 0.01, n_segments = 40), density_body = 1045, sound_speed_body = 1520 ) extract(obj, "body") extract(obj, c("body", "density")) extract(obj, c("shape_parameters", "shape")) bent_obj <- brake(obj, radius_curvature = 5) head(extract(bent_obj, c("body", "rpos", "z"))) extract(bent_obj, c("shape_parameters", "radius_curvature_ratio"))
Reverse axial orientation (axis = "x") or mirror the geometry
dorsoventrally (axis = "z") without manually editing the position matrix.
flip_shape( object, axis = c("x", "z"), component = NULL, containment = c("warn", "error", "ignore") )flip_shape( object, axis = c("x", "z"), component = NULL, containment = c("warn", "error", "ignore") )
object |
Shape or Scatterer object. |
axis |
Flip axis. Use |
component |
Optional component name for scatterers. Defaults to the
primary geometry ( |
containment |
Containment policy used when a moved swimbladder or
backbone is checked against its body: |
The modified object, returned as the same broad object type.
translate_shape(), reanchor_shape(), inflate_shape(),
smooth_shape()
shape_obj <- arbitrary( x_body = c(0, 0.01, 0.02, 0.03), radius_body = c(0, 0.004, 0.002, 0) ) flipped_shape <- flip_shape(shape_obj, axis = "x") head(extract(flipped_shape, c("position_matrix", "zU")))shape_obj <- arbitrary( x_body = c(0, 0.01, 0.02, 0.03), radius_body = c(0, 0.004, 0.002, 0) ) flipped_shape <- flip_shape(shape_obj, axis = "x") head(extract(flipped_shape, c("position_matrix", "zU")))
A S4 class that provides slots to contain relevant metadata for scatterers similar to the surrounding fluid medium (i.e fluid-like) belonging to FLS-class scatterers. See Scatterer for a more detailed description on how this S4 object is organized.
An object of the FLS S4 class.
methods::getClass("FLS")methods::getClass("FLS")
Generate a FLS-class object.
fls_generate( shape = NULL, x_body = NULL, y_body = NULL, z_body = NULL, length_body = NULL, radius_body = NULL, radius_curvature_ratio = NULL, n_segments = 18, g_body = NULL, h_body = NULL, density_body = NULL, sound_speed_body = NULL, theta_body = pi/2, ID = NULL, length_units = "m", theta_units = "radians", ... )fls_generate( shape = NULL, x_body = NULL, y_body = NULL, z_body = NULL, length_body = NULL, radius_body = NULL, radius_curvature_ratio = NULL, n_segments = 18, g_body = NULL, h_body = NULL, density_body = NULL, sound_speed_body = NULL, theta_body = pi/2, ID = NULL, length_units = "m", theta_units = "radians", ... )
shape |
Pre-built |
x_body |
Vector containing x-axis body (m) shape data. |
y_body |
Vector containing y-axis body (m) shape data. |
z_body |
Vector containing z-axis body (m) shape data. |
length_body |
Optional input for a generic length value input. |
radius_body |
Vector containing radii (m). |
radius_curvature_ratio |
Length-to-curvature ratio (pc/L). |
n_segments |
Number of body segments. |
g_body |
Density contrast. This can either be a single value (i.e. homogenous) or a vector of values (i.e. inhomogenous). |
h_body |
Sound-speed contrast. This can either be a single value (i.e. homogenous) or a vector of values (i.e. inhomogenous). |
density_body |
Absolute density (kg/m^3) if contrasts are not supplied. |
sound_speed_body |
Absolute sound speed (m/s) if contrasts are not supplied. |
theta_body |
Orientation of the target relative to the transmit source
( |
ID |
Optional metadata entry. |
length_units |
Compatibility argument. Scatterer constructors now assume meters and ignore non-SI alternatives. |
theta_units |
Compatibility argument. Scatterer constructors now assume radians and ignore non-SI alternatives. |
... |
Additional parameters. |
The preferred workflow is to build a geometry first with sphere(),
cylinder(), prolate_spheroid(), or arbitrary(), then pass that Shape
object to fls_generate(). Material properties can be supplied either as
contrasts (g_body/h_body) or as absolute density/sound-speed values
(density_body/sound_speed_body), but not both for the same property
pair. Downstream models derive contrasts automatically when only absolute
values are supplied.
The only supported public geometry paths are now:
supply a pre-built Shape object, or
supply explicit profile coordinates directly to the constructor.
Character-based shape dispatch is retained only as a compatibility pathway
and is now deprecated. Internally, every pathway is resolved to the same
Shape-first geometry contract before the FLS object is built.
Scatterer constructors store geometry in meters and orientations in radians.
length_units and theta_units are retained as compatibility arguments, but
non-SI values are normalized to the package-standard representation.
FLS-class object
shape <- prolate_spheroid( length_body = 0.04, radius_body = 0.004, n_segments = 50 ) fls_generate( shape = shape, density_body = 1045, sound_speed_body = 1520 )shape <- prolate_spheroid( length_body = 0.04, radius_body = 0.004, n_segments = 50 ) fls_generate( shape = shape, density_body = 1045, sound_speed_body = 1520 )
A S4 class that provides slots to contain relevant metadata for gas-bearing scatterers belonging to the GAS-class. This object can include simple gas-filled bubbles to other scatterers with gas occlusions, swimbladders, and other internal features, if applicable. The default behavior for this type of object is to only reference the gaseous/fluid feature with exceptions that are model-dependent. See Scatterer for a more detailed description on how this S4 object is organized.
An object of the GAS S4 class.
methods::getClass("GAS")methods::getClass("GAS")
Generate a GAS-class object
gas_generate(shape = NULL, radius_body = NULL, h_fluid = 0.22, g_fluid = 0.0012, sound_speed_fluid = NULL, density_fluid = NULL, theta_body = pi/2, ID = NULL, radius_units = "m", theta_units = "radians", n_segments = 100, ...)gas_generate(shape = NULL, radius_body = NULL, h_fluid = 0.22, g_fluid = 0.0012, sound_speed_fluid = NULL, density_fluid = NULL, theta_body = pi/2, ID = NULL, radius_units = "m", theta_units = "radians", n_segments = 100, ...)
shape |
Pre-built |
radius_body |
Radius (m). For non-canonical shapes, this would be the maximum or mean radius at the scatterer midsection. |
h_fluid |
Sound speed contrast of fluid relative to surrounding medium (h). |
g_fluid |
Density contrast of fluid relative to surrounding density (g). |
sound_speed_fluid |
Optional fluid sound speed (m/s). |
density_fluid |
Optional fluid density (m/s). |
theta_body |
Orientation of the target relative to the incident wave (radians). |
ID |
Optional metadata identifier. |
radius_units |
Compatibility argument. |
theta_units |
Compatibility argument. Scatterer constructors now assume radians and ignore non-SI alternatives. |
n_segments |
Number of body segments. |
... |
Additional manual profile arguments or legacy canonical shape
arguments used by the compatibility geometry pathway, such as |
The preferred workflow is to supply a pre-built Shape object or explicit
profile coordinates and then describe the internal gas by either contrasts
(g_fluid, h_fluid) or absolute density/sound-speed values
(density_fluid, sound_speed_fluid). Character-based shape dispatch
remains available only as a compatibility pathway and is now deprecated.
Scatterer constructors store geometry in meters and orientations in radians.
radius_units and theta_units are retained as compatibility arguments, but
non-SI values are normalized to the package-standard representation.
GAS-class object
shape_gas <- sphere(radius_body = 0.01, n_segments = 60) gas_generate(shape = shape_gas, g_fluid = 0.0012, h_fluid = 0.22)shape_gas <- sphere(radius_body = 0.01, n_segments = 60) gas_generate(shape = shape_gas, g_fluid = 0.0012, h_fluid = 0.22)
Compute Gauss-Legendre quadrature nodes and weights on an interval
.
gauss_legendre(n, a = -1, b = 1)gauss_legendre(n, a = -1, b = 1)
n |
Number of quadrature nodes (n >= 1). |
a |
Left endpoint of the integration interval. |
b |
Right endpoint of the integration interval (b > a). |
Gauss-Legendre quadrature provides exact integration for polynomials of
degree up to using n nodes and weights chosen as the roots of the
Legendre polynomial on the canonical interval . For
a general interval the canonical nodes are shifted and rescaled
onto , and the weights are scaled by .
This wrapper performs basic argument validation and calls the C++ routine
to obtain nodes and weights with high accuracy for moderate n.
A list with components:
Quadrature abscissae in .
Quadrature weights such that
Davis, P. J., & Rabinowitz, P. (2007). Methods of Numerical Integration (2nd ed.).
rule <- gauss_legendre(n = 4, a = 0, b = 1) sum(rule$weights * rule$nodes^2)rule <- gauss_legendre(n = 4, a = 0, b = 1) sum(rule$weights * rule$nodes^2)
, and
its respective derivativesComputes the cylindrical Hankel function of the first kind
() and its derivatives through hcdk().
hc(l, n) hcdk(l, n, k)hc(l, n) hcdk(l, n, k)
l |
Numeric. The order ( |
n |
Numeric or complex. The argument ( |
k |
Non-negative integer. The order of the derivative for |
The Hankel function of the first kind is defined as:
where is the Bessel function of the first kind and
is the Bessel function of the second kind.
Supported argument types:
Since is computed from and
, the same restrictions apply:
Purely real arguments (): Fully supported.
Purely imaginary arguments (): Supported.
General complex arguments (): Not supported.
Derivatives:
First derivative:
Second derivative:
k-th derivative (DLMF 10.6.1):
A complex vector containing:
hc:
hcdk(..., k = 1):
(first derivative)
hcdk(..., k = 2):
(second derivative)
hcdk: (k-th derivative)
Abramowitz, M. and Stegun, I.A. (Eds.). (1964). Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. National Bureau of Standards, Applied Mathematics Series 55. Chapter 9.
NIST Digital Library of Mathematical Functions. https://dlmf.nist.gov/
Hankel function definition: https://dlmf.nist.gov/10.2
k-th derivative formula: Eq. 10.6.1 at https://dlmf.nist.gov/10.6
jc for Bessel functions of the first kind,
yc for Bessel functions of the second kind,
hs for spherical Hankel functions.
# Hankel function hc(0, 1) hc(1, 2.5) # Fractional order hc(0.5, 3) # Purely imaginary argument hc(1, 1i) # First derivative hcdk(1, 2, 1) # Second derivative hcdk(1, 2, 2) # k-th derivative hcdk(1, 2, 3) # Third derivative# Hankel function hc(0, 1) hc(1, 2.5) # Fractional order hc(0.5, 3) # Purely imaginary argument hc(1, 1i) # First derivative hcdk(1, 2, 1) # Second derivative hcdk(1, 2, 2) # k-th derivative hcdk(1, 2, 3) # Third derivative
, and its
respective derivativesComputes the spherical Hankel function of the first kind
() and its first-th derivative.
hs(l, n) hsdk(l, n, k)hs(l, n) hsdk(l, n, k)
l |
Numeric. The order of the spherical Hankel function. Can be integer or fractional. |
n |
Numeric. The argument ( |
k |
Non-negative integer. The order of the derivative for |
The spherical Hankel function of the first kind is defined as:
where is the spherical Bessel function of the first kind and
is the spherical Bessel function of the second kind.
It is related to the cylindrical Hankel function by:
The spherical Hankel functions are used extensively in scattering theory to represent outgoing spherical waves.
Derivative:
A complex vector containing:
hs:
hsdK: (k-th derivative)
Abramowitz, M. and Stegun, I.A. (Eds.). (1964). Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. National Bureau of Standards, Applied Mathematics Series 55. Chapter 10.
NIST Digital Library of Mathematical Functions. https://dlmf.nist.gov/
Spherical Bessel functions: https://dlmf.nist.gov/10.47
Relation to cylindrical Hankel functions: Eq. 10.47.5 at https://dlmf.nist.gov/10.47
hc for cylindrical Hankel functions,
js for spherical Bessel functions of the first kind,
ys for spherical Bessel functions of the second kind.
# Spherical Hankel function hs(0, 1) hs(1, 2.5) # Fractional order hs(0.5, 3) # Vector input hs(0, c(1, 2, 3)) # First derivative hsdk(1, 2, 1)# Spherical Hankel function hs(0, 1) hs(1, 2.5) # Fractional order hs(0.5, 3) # Vector input hs(0, c(1, 2, 3)) # First derivative hsdk(1, 2, 1)
Apply a localized scaling window to a stored profile. Values of scale > 1
inflate the selected region, while scale < 1 pinch or taper it. For
canonical Shape objects, the result is returned as an Arbitrary shape
because the edited profile is no longer guaranteed to preserve the canonical
class geometry.
inflate_shape( object, x_range = NULL, scale = 1, component = NULL, axis = c("radius", "width", "height"), profile = c("cosine", "linear", "box"), containment = c("warn", "error", "ignore") )inflate_shape( object, x_range = NULL, scale = 1, component = NULL, axis = c("radius", "width", "height"), profile = c("cosine", "linear", "box"), containment = c("warn", "error", "ignore") )
object |
Shape or Scatterer object. |
x_range |
Optional axial interval over which the local manipulation is applied. |
scale |
Positive local scale factor. |
component |
Optional component name for scatterers. Defaults to the
primary geometry ( |
axis |
Which profile dimension to scale. |
profile |
Local window profile. |
containment |
Containment policy used when a moved swimbladder or
backbone is checked against its body: |
The modified object. Shape inputs that are locally reshaped are
returned as Arbitrary shapes.
smooth_shape(), resample_shape(), flip_shape(), brake(),
reforge()
shape_obj <- cylinder( length_body = 0.05, radius_body = 0.003, n_segments = 80 ) pinched_shape <- inflate_shape( shape_obj, x_range = c(0.015, 0.035), scale = 0.7 ) max(extract(pinched_shape, c("shape_parameters", "max_radius")))shape_obj <- cylinder( length_body = 0.05, radius_body = 0.003, n_segments = 80 ) pinched_shape <- inflate_shape( shape_obj, x_range = c(0.015, 0.035), scale = 0.7 ) max(extract(pinched_shape, c("shape_parameters", "max_radius")))
, and its
respective derivativesComputes the cylindrical Bessel function of the first kind ()
and its k-th derivatives.
jc(l, n) jcdk(l, n, k)jc(l, n) jcdk(l, n, k)
l |
Numeric. The order ( |
n |
Numeric or complex. The argument ( |
k |
Non-negative integer. The order of the derivative for |
The cylindrical Bessel function of the first kind satisfies Bessel's differential equation:
Supported argument types:
Purely real arguments (, where ):
Fully supported for both positive and negative values.
Purely imaginary arguments (, where ):
Computed using the identity
for , where is the modified Bessel function
of the first kind. For negative imaginary arguments and real order,
.
General complex arguments (, where
and ): Not supported.
Special cases:
if , otherwise .
For negative real arguments with integer order :
.
For negative real arguments with non-integer order :
(complex result).
Derivatives:
First derivative:
Second derivative:
k-th derivative (DLMF 10.6.1):
A complex vector containing:
jc:
jcdk(..., k = 1): (first derivative)
jcdk(..., k = 2): (second derivative)
jcdk: (k-th derivative)
Abramowitz, M. and Stegun, I.A. (Eds.). (1964). Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. National Bureau of Standards, Applied Mathematics Series 55. Chapter 9.
NIST Digital Library of Mathematical Functions. https://dlmf.nist.gov/
Bessel's equation: https://dlmf.nist.gov/10.2
Negative argument identity (): Eq. 10.4.1 at
https://dlmf.nist.gov/10.4
Imaginary argument identity (): Eq. 10.27.6 at
https://dlmf.nist.gov/10.27
yc for Bessel functions of the second kind,
hc for Hankel functions (third kind),
js for spherical Bessel functions of the first kind.
# Real argument, integer order jc(0, 1) jc(1, 2.5) # Real argument, fractional order jc(0.5, 3) # Negative real argument (integer order gives real result) jc(2, -1.5) # Negative real argument (fractional order gives complex result) jc(0.5, -2) # Purely imaginary argument jc(1, 1i) jc(2, 3i) # First derivative jcdk(1, 2, 1) # Second derivative jcdk(1, 2, 2)# Real argument, integer order jc(0, 1) jc(1, 2.5) # Real argument, fractional order jc(0.5, 3) # Negative real argument (integer order gives real result) jc(2, -1.5) # Negative real argument (fractional order gives complex result) jc(0.5, -2) # Purely imaginary argument jc(1, 1i) jc(2, 3i) # First derivative jcdk(1, 2, 1) # Second derivative jcdk(1, 2, 2)
, and its
respective derivativesComputes the spherical Bessel function of the first kind ()
and its k-th derivative.
js(l, n) jsdk(l, n, k)js(l, n) jsdk(l, n, k)
l |
Numeric. The order of the spherical Bessel function. Can be integer or fractional. |
n |
Numeric or matrix. The argument ( |
k |
Non-negative integer. The order of the derivative for |
The spherical Bessel function of the first kind is related to the cylindrical Bessel function by:
where is the cylindrical Bessel function of the first kind.
The spherical Bessel functions satisfy the differential equation:
Special cases:
for all .
Derivatives:
First derivative:
Second derivative:
A numeric vector or matrix (matching the input structure) containing:
js:
jsdk: (k-th derivative)
Abramowitz, M. and Stegun, I.A. (Eds.). (1964). Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. National Bureau of Standards, Applied Mathematics Series 55. Chapter 10.
NIST Digital Library of Mathematical Functions. https://dlmf.nist.gov/
Spherical Bessel functions: https://dlmf.nist.gov/10.47
Relation to cylindrical Bessel functions: Eq. 10.47.3 at https://dlmf.nist.gov/10.47
jc for cylindrical Bessel functions of the first kind,
ys for spherical Bessel functions of the second kind,
hs for spherical Hankel functions.
# Spherical Bessel function js(0, 1) js(1, 2.5) # Fractional order js(0.5, 3) # Vector input js(0, c(1, 2, 3)) # Matrix input (applied column-wise) js(1, matrix(1:6, nrow = 2)) # First derivative jsdk(1, 2, 1) # Second derivative jsdk(1, 2, 2)# Spherical Bessel function js(0, 1) js(1, 2.5) # Fractional order js(0.5, 3) # Vector input js(0, c(1, 2, 3)) # Matrix input (applied column-wise) js(1, matrix(1:6, nrow = 2)) # First derivative jsdk(1, 2, 1) # Second derivative jsdk(1, 2, 2)
A dataset containing a sample krill (Euphausia superba) body shape proposed by McGehee et al. (1998).
data(krill)data(krill)
A pre-generated FLS scatterer containing all information required for target strength modeling.
Relevant and identifying metadata (list).
Container for specified model parameters
(list).
Model outputs and results (list).
A list with elements:
rpos: Position matrix (x, y, z; m).
radius: Radius of each discrete cylinder (m).
g: Body density contrast relative to medium.
h: Sound speed contrast relative to medium.
theta: Orientation angle (, radians).
A list with:
length: Body length (m).
ncyl: Number of cylinders.
theta_units: Unit of orientation.
length_units: Unit of length.
A pre-generated FLS scatterer object.
data("krill", package = "acousticTS") krilldata("krill", package = "acousticTS") krill
)Calculates Lamé's first parameter () from two of the
four other elastic moduli: bulk modulus (K), Young's modulus (E), shear
modulus (G), or Poisson's ratio (). Assumes 3D material properties.
The relationships used are:
lame(K = NULL, E = NULL, G = NULL, nu = NULL)lame(K = NULL, E = NULL, G = NULL, nu = NULL)
K |
Bulk modulus (Pa). |
E |
Young's modulus (Pa). |
G |
Shear modulus (Pa). |
nu |
Poisson's ratio (Dimensionless). |
Lamé's first parameter (, Pa).
lame(K = 2.5e9, G = 1.1e9)lame(K = 2.5e9, G = 1.1e9)
The linear function converts a value from the logarithmic (dB) domain to
the linear domain, while the db function converts a value from the linear
domain to the logarithmic (dB) domain. These are commonly used for target
strength (TS) and backscattering coefficient () conversions.
The conversions are defined as:
where is the coefficient (default 10).
linear(value, coefficient = 10) db(value, coefficient = 10)linear(value, coefficient = 10) db(value, coefficient = 10)
value |
Numeric value to convert. For |
coefficient |
Optional. Numeric coefficient (base) for the logarithm. Default is 10. |
For linear, returns the value converted to the linear domain. For db,
returns the value converted to the logarithmic (dB) domain.
sigma_bs <- linear(-40) db(sigma_bs)sigma_bs <- linear(-40) db(sigma_bs)
The Neumann factor, denoted , is a simple multiplicative
constant commonly used in spherical or spheroidal function theory. It
accounts for the symmetry of cosine terms or the duplication of even-order
contributions in integrals.
neumann(x)neumann(x)
x |
An integer iterator. |
Formally, the Neumann factor is defined as:
This factor frequently appears in the normalization of spherical Bessel functions, Legendre expansions, and spheroidal wave functions. It is not related to the "von Neumann ordinals" used in set theory.
A numeric vector of the same length as x, containing values of
, each equal to 1 or 2.
neumann(0) # should return 1 neumann(1) # should return 2 neumann(2) # should return 2 # Vectorized use: neumann(0:4)neumann(0) # should return 1 neumann(1) # should return 2 neumann(2) # should return 2 # Vectorized use: neumann(0:4)
Creates an oblate spheroid.
oblate_spheroid( length_body = NULL, radius_body = NULL, length_radius_ratio = NULL, semimajor_length = NULL, semiminor_length = NULL, n_segments = 100, length_units = "m" )oblate_spheroid( length_body = NULL, radius_body = NULL, length_radius_ratio = NULL, semimajor_length = NULL, semiminor_length = NULL, n_segments = 100, length_units = "m" )
length_body |
Body-axis length (m). |
radius_body |
Maximum equatorial radius (m). |
length_radius_ratio |
Optional ratio input when radius is not explicitly known. |
semimajor_length |
Optional alias for maximum equatorial radius (m). |
semiminor_length |
Optional alias for body-axis semi-length (m). |
n_segments |
Number of segments to discretize object shape. Defaults to 100 segments. |
length_units |
Units for body matrix (defaults to m). |
Creates the position vector for an oblate spheroid object of defined body-axis length and maximum equatorial radius.
oblate_spheroid( length_body = 0.012, radius_body = 0.01, n_segments = 60 ) oblate_spheroid( semiminor_length = 0.006, semimajor_length = 0.01 )oblate_spheroid( length_body = 0.012, radius_body = 0.01, n_segments = 60 ) oblate_spheroid( semiminor_length = 0.006, semimajor_length = 0.01 )
Translate an internal geometry-bearing component such as a swimbladder or backbone while leaving the outer body unchanged.
offset_component( object, component = c("bladder", "backbone"), x_offset = 0, z_offset = 0, containment = c("warn", "error", "ignore") )offset_component( object, component = c("bladder", "backbone"), x_offset = 0, z_offset = 0, containment = c("warn", "error", "ignore") )
object |
Scatterer object containing an internal component. |
component |
Internal component name. Currently most useful for
|
x_offset |
Along-axis translation (m). |
z_offset |
Vertical translation (m). |
containment |
Containment policy used when the shifted component is
checked against the body: |
The modified scatterer object.
translate_shape(), reanchor_shape(), reforge()
fish <- sbf_generate( x_body = c(0, 0.1), w_body = c(0.006, 0.008), zU_body = c(0.001, 0.002), zL_body = c(-0.001, -0.002), x_bladder = c(0.02, 0.08), w_bladder = c(0, 0), zU_bladder = c(0.0012, 0.0012), zL_bladder = c(-0.0012, -0.0012), density_body = 1040, density_bladder = 1.2, sound_speed_body = 1500, sound_speed_bladder = 340 ) shifted_fish <- offset_component( fish, component = "bladder", x_offset = 0.003 ) min(extract(shifted_fish, c("bladder", "rpos", "x_bladder")))fish <- sbf_generate( x_body = c(0, 0.1), w_body = c(0.006, 0.008), zU_body = c(0.001, 0.002), zL_body = c(-0.001, -0.002), x_bladder = c(0.02, 0.08), w_bladder = c(0, 0), zU_bladder = c(0.0012, 0.0012), zL_bladder = c(-0.0012, -0.0012), density_body = 1040, density_bladder = 1.2, sound_speed_body = 1500, sound_speed_bladder = 340 ) shifted_fish <- offset_component( fish, component = "bladder", x_offset = 0.003 ) min(extract(shifted_fish, c("bladder", "rpos", "x_bladder")))
S3 plotting method for Scatterer objects. Depending on type, the method
draws the target geometry, one or more stored model curves, or a stored
single-target TMM scattering slice / map when the object was computed with
retained T-matrix state.
## S3 method for class 'Scatterer' plot( x, y = NULL, type = "shape", nudge_y = 1.1, nudge_x = 1.05, aspect_ratio = "manual", x_units = "frequency", y_units = "TS", ... )## S3 method for class 'Scatterer' plot( x, y = NULL, type = "shape", nudge_y = 1.1, nudge_x = 1.05, aspect_ratio = "manual", x_units = "frequency", y_units = "TS", ... )
x |
Scatterer-class object. |
y |
Ignored (required for the base |
type |
Plot mode. Use |
nudge_y |
Multiplicative vertical padding applied to automatically derived y-axis limits. |
nudge_x |
Multiplicative horizontal padding applied to automatically derived x-axis limits. |
aspect_ratio |
Aspect-ratio control for supported shape plots. Use
|
x_units |
Horizontal-axis convention for |
y_units |
Stored response quantity for |
... |
Additional arguments passed through to the class-specific plotting
helpers. For stored |
Plotting behavior is selected from the object's class. The supported type
values therefore depend on what has been stored on the object. For example,
type = "model" requires the object to already contain model output, and
type = "scattering" currently applies only to stored TMM results.
Called for its side effect of drawing a plot; returns the input invisibly.
extract(), target_strength(), tmm_scattering(),
tmm_scattering_grid()
data("krill", package = "acousticTS") plot(krill)data("krill", package = "acousticTS") plot(krill)
Computes the Legendre polynomial of the first kind, , for
real order (integer or fractional) and real argument .
Pn(n, x)Pn(n, x)
n |
Numeric vector. Degree (order) of the Legendre polynomial. Can be integer or fractional (e.g., 0, 1, 2.5, 3.7). Can also be negative. |
x |
Numeric vector. Real argument(s) at which to evaluate the
polynomial. Valid for all real values including |
The Legendre polynomial of the first kind satisfies the differential equation:
For integer order , the function uses the recurrence relation:
For fractional order , the function uses:
For : The Ferrers function via the hypergeometric
series
For : A numerical contour integral representation
A numeric matrix of dimension length(n) by length(x), where
element [i, j] contains .
This function calls underlying code via Rcpp for
computational efficiency and to support different cases for both order and
argument that are not readily available in R.
Abramowitz, M. and Stegun, I. A. (1972). Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. Dover Publications. Chapter 8: Legendre Functions.
NIST Digital Library of Mathematical Functions. https://dlmf.nist.gov/14
Pndk for the kth derivative of the Legendre
polynomial of the first kind,
Qn for Legendre functions of the second kind.
# Single values Pn(1, 1) # Multiple orders, single argument Pn(c(1, 2, 3), 1) # Single order, multiple arguments Pn(1, c(1, 2, 3)) # Multiple orders and arguments (returns a matrix) Pn(c(1, 2, 3), c(1, 2, 3)) # Fractional orders Pn(c(0.5, 2.2, 3), c(1, 2, 3)) # Negative arguments Pn(c(0.5, 2, -3), c(1, -2.5, 3))# Single values Pn(1, 1) # Multiple orders, single argument Pn(c(1, 2, 3), 1) # Single order, multiple arguments Pn(1, c(1, 2, 3)) # Multiple orders and arguments (returns a matrix) Pn(c(1, 2, 3), c(1, 2, 3)) # Fractional orders Pn(c(0.5, 2.2, 3), c(1, 2, 3)) # Negative arguments Pn(c(0.5, 2, -3), c(1, -2.5, 3))
Computes the -th derivative of the Legendre polynomial of the first
kind, , with respect to the argument .
Pndk(n, x, k = 1L)Pndk(n, x, k = 1L)
n |
Numeric vector. Degree (order) of the Legendre polynomial. Can be integer or fractional. |
x |
Numeric vector. Real argument(s) at which to evaluate the derivative. |
k |
Integer. Order of the derivative ( |
For integer order :
The derivative is computed using the relationship with associated Legendre polynomials:
where is the associated Legendre polynomial (the Boost
C++ uses Condon-Shortley phase convention).
At the endpoints , the known closed-form expressions are used:
If for integer , the result is 0 (derivative of a
polynomial of degree taken more than times).
For fractional order :
Derivatives are computed using central finite differences:
Higher-order derivatives use the generalized finite difference stencil.
Note that accuracy may be limited for fractional orders due to the
numerical integration underlying Pn.
A numeric matrix of dimension length(n) by length(x), where
element [i, j] contains .
For fractional orders, the finite difference approximation may have reduced
accuracy (typically 4-6 significant digits) compared to integer orders.
A warning is issued for higher-order derivatives () of
fractional orders.
This function calls underlying code via Rcpp for
computational efficiency and to support different cases for both order and
argument that are not readily available in R.
Abramowitz, M. and Stegun, I. A. (1972). Handbook of Mathematical Functions. Dover Publications. Section 8.5: Associated Legendre Functions.
NIST Digital Library of Mathematical Functions. https://dlmf.nist.gov/14.10
Pn for the Legendre polynomial of the first kind.
# First derivative of P_2(x) at x = 0.5 # P_2(x) = (3x^2 - 1)/2, so P'_2(x) = 3x, P'_2(0.5) = 1.5 Pndk(2, 0.5, 1) # Second derivative of P_2(x) # P''_2(x) = 3 Pndk(2, 0.5, 2) # Multiple orders Pndk(c(1, 2, 3), 0.5, 1) # First derivative at multiple points Pndk(2, c(-0.5, 0, 0.5), 1) # Fractional order (uses finite differences) Pndk(0.5, 0.5, 1) # Derivative at endpoint # P'_n(1) = n(n+1)/2 Pndk(3, 1, 1) # Should be 3*4/2 = 6# First derivative of P_2(x) at x = 0.5 # P_2(x) = (3x^2 - 1)/2, so P'_2(x) = 3x, P'_2(0.5) = 1.5 Pndk(2, 0.5, 1) # Second derivative of P_2(x) # P''_2(x) = 3 Pndk(2, 0.5, 2) # Multiple orders Pndk(c(1, 2, 3), 0.5, 1) # First derivative at multiple points Pndk(2, c(-0.5, 0, 0.5), 1) # Fractional order (uses finite differences) Pndk(0.5, 0.5, 1) # Derivative at endpoint # P'_n(1) = n(n+1)/2 Pndk(3, 1, 1) # Should be 3*4/2 = 6
)Calculates Poisson's ratio () from two of the three other elastic
moduli: bulk modulus (K), Young's modulus (E), or shear modulus (G).
Assumes 3D material properties.
The relationships used are:
pois(K = NULL, E = NULL, G = NULL)pois(K = NULL, E = NULL, G = NULL)
K |
Bulk modulus (K, Pa). |
E |
Young's modulus (E, Pa). |
G |
Shear modulus (Pa). |
Poisson's ratio (), dimensionless.
pois(E = 3e9, G = 1.1e9)pois(E = 3e9, G = 1.1e9)
Creates a polynomial deformed cylinder
polynomial_cylinder( length_body, radius_body, n_segments = 100, polynomial, length_units = "m" )polynomial_cylinder( length_body, radius_body, n_segments = 100, polynomial, length_units = "m" )
length_body |
Length (m). |
radius_body |
Maximum/uniform radius (m). |
n_segments |
Number of segments to discretize object shape. Defaults to 1e2 segments. |
polynomial |
Polynomial coefficient vector. |
length_units |
Units (default is meters, "m"). |
Creates the position vector for a polynomial deformed cylinder.
Smith, J.N., Ressler, P.H., and Warren, J.D. 2013. A distorted wave Born approximation target strength model for Bering Sea euphausiids. ICES Journal of Marine Science, 70(1): 204-214. https://doi.org/10.1093/icesjms/fss140
# We can use the polynomial coefficients defined in Smith et al. (2013) to # define the position vector of a sub-Arctic krill. poly_vec <- c(0.83, 0.36, -2.10, -1.20, 0.63, 0.82, 0.64) # Create the position vector # This outputs a list containing "rpos" and "radius" pos <- polynomial_cylinder( length_body = 15e-3, radius_body = 2e-3, polynomial = poly_vec ) str(pos)# We can use the polynomial coefficients defined in Smith et al. (2013) to # define the position vector of a sub-Arctic krill. poly_vec <- c(0.83, 0.36, -2.10, -1.20, 0.63, 0.82, 0.64) # Create the position vector # This outputs a list containing "rpos" and "radius" pos <- polynomial_cylinder( length_body = 15e-3, radius_body = 2e-3, polynomial = poly_vec ) str(pos)
Creates a prolate spheroid.
prolate_spheroid( length_body = NULL, radius_body = NULL, length_radius_ratio = NULL, semimajor_length = NULL, semiminor_length = NULL, n_segments = 100, length_units = "m" )prolate_spheroid( length_body = NULL, radius_body = NULL, length_radius_ratio = NULL, semimajor_length = NULL, semiminor_length = NULL, n_segments = 100, length_units = "m" )
length_body |
Semi-major axis length (m). |
radius_body |
Semi-minor axis length (m). This can also be stylized as the "maximum radius" of the scattering object. |
length_radius_ratio |
Optional ratio input when radius is not explicitly known. |
semimajor_length |
Optional alias for semi-major axis length (m). |
semiminor_length |
Optional alias for semi-minor axis length (m). |
n_segments |
Number of segments to discretize object shape. Defaults to 18 segments. |
length_units |
Units for body matrix (defaults to m). |
Creates the position vector for a prolate spheroid object of defined semi-major and -minor axes.
prolate_spheroid( length_body = 0.04, radius_body = 0.004, n_segments = 60 ) prolate_spheroid( semimajor_length = 0.05, semiminor_length = 0.003 )prolate_spheroid( length_body = 0.04, radius_body = 0.004, n_segments = 60 ) prolate_spheroid( semimajor_length = 0.05, semiminor_length = 0.003 )
Computes the Legendre function of the second kind, , for
real order (integer or fractional) and real argument .
Returns complex values when .
Qn(n, x)Qn(n, x)
n |
Numeric vector. Degree (order) of the Legendre function. Can be integer or fractional (e.g., 0, 1, 2.5, 3.7). |
x |
Numeric vector. Real argument(s) at which to evaluate the function.
Valid for all real values. Note that |
The Legendre function of the second kind satisfies the same differential
equation as :
but represents the linearly independent second solution.
For (real result):
For integer order : Uses the C++ Boost library
implementation
For fractional order : Uses the Ferrers identity
For :
Returns infinity (singularity).
For (complex result):
Real part: Computed via the integral representation
Imaginary part:
A complex matrix of dimension length(n) by length(x), where
element [i, j] contains . For , the
imaginary part is zero.
This function calls underlying code via Rcpp for
computational efficiency and to support different cases for both order and
argument that are not readily available in R.
Abramowitz, M. and Stegun, I. A. (1972). Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. Dover Publications. Chapter 8: Legendre Functions.
NIST Digital Library of Mathematical Functions. https://dlmf.nist.gov/14
Qndk for the kth derivative of the Legendre
polynomial of the second kind,
Pn for Legendre functions of the first kind.
# Single values Qn(1, 0.5) # Multiple orders, single argument Qn(c(1, 2, 3), 0.5) # Single order, multiple arguments Qn(1, c(-0.5, 0, 0.5)) # Multiple orders and arguments (returns a matrix) Qn(c(1, 2, 3), c(0.25, 0.5, 0.75)) # Fractional orders Qn(c(0.5, 1.5, 2.7), c(0.5, 0.9)) # Arguments |x| > 1 return complex values Qn(c(1, 2, 3.5), c(2, 3.5)) # Singularity at x = 1 Qn(1, 1)# Single values Qn(1, 0.5) # Multiple orders, single argument Qn(c(1, 2, 3), 0.5) # Single order, multiple arguments Qn(1, c(-0.5, 0, 0.5)) # Multiple orders and arguments (returns a matrix) Qn(c(1, 2, 3), c(0.25, 0.5, 0.75)) # Fractional orders Qn(c(0.5, 1.5, 2.7), c(0.5, 0.9)) # Arguments |x| > 1 return complex values Qn(c(1, 2, 3.5), c(2, 3.5)) # Singularity at x = 1 Qn(1, 1)
Derivative of the Legendre function of the second kind
Qndk(n, x, k = 1L)Qndk(n, x, k = 1L)
n |
Numeric vector. Degree (order) of the Legendre function. |
x |
Numeric vector. Real argument(s) at which to evaluate the
derivative. Avoid |
k |
Integer. Order of the derivative ( |
A complex matrix of dimension length(n) by length(x), where
element [i, j] contains .
Derivatives are computed via finite differences with step size
. Accuracy is typically 4-6 significant digits for
first derivatives, less for higher orders.
This function calls underlying code via Rcpp for
computational efficiency and to support different cases for both order and
argument that are not readily available in R.
Abramowitz, M. and Stegun, I. A. (1972). Handbook of Mathematical Functions. Dover Publications. Chapter 8: Legendre Functions.
Qn for Legendre functions of the second kind.
# First derivative of Q_1(x) at x = 0.5 Qndk(1, 0.5, 1) # Compare with numerical derivative h <- 1e-6 (Qn(1, 0.5 + h) - Qn(1, 0.5 - h)) / (2 * h) # Second derivative Qndk(2, 0.5, 2) # Multiple orders Qndk(c(1, 2, 3), 0.5, 1) # Complex result for |x| > 1 Qndk(1, 2.0, 1)# First derivative of Q_1(x) at x = 0.5 Qndk(1, 0.5, 1) # Compare with numerical derivative h <- 1e-6 (Qn(1, 0.5 + h) - Qn(1, 0.5 - h)) / (2 * h) # Second derivative Qndk(2, 0.5, 2) # Multiple orders Qndk(c(1, 2, 3), 0.5, 1) # Complex result for |x| > 1 Qndk(1, 2.0, 1)
Convert angular measurements from degrees to radians.
radians(x)radians(x)
x |
A real value in degrees |
Angle in radians.
orientation <- 90 # degrees radians(orientation) # this should return a value equal to pi / 2 radiansorientation <- 90 # degrees radians(orientation) # this should return a value equal to pi / 2 radians
Translate a shape or scatterer component so that its nose, center, or tail lies at a specified x position.
reanchor_shape( object, anchor = c("nose", "center", "tail", "max_x", "min_x"), at = 0, component = NULL, containment = c("warn", "error", "ignore") )reanchor_shape( object, anchor = c("nose", "center", "tail", "max_x", "min_x"), at = 0, component = NULL, containment = c("warn", "error", "ignore") )
object |
Shape or Scatterer object. |
anchor |
Anchor location used to define the translation target. |
at |
Target x location (m). |
component |
Optional component name for scatterers. Defaults to the
primary geometry ( |
containment |
Containment policy used when a moved swimbladder or
backbone is checked against its body: |
The modified object, returned as the same broad object type.
translate_shape(), brake(), reforge(), extract()
shape_obj <- prolate_spheroid(length_body = 0.04, radius_body = 0.004) centered_shape <- reanchor_shape(shape_obj, anchor = "center", at = 0) range(extract(centered_shape, c("position_matrix", "x")))shape_obj <- prolate_spheroid(length_body = 0.04, radius_body = 0.004) centered_shape <- reanchor_shape(shape_obj, anchor = "center", at = 0) range(extract(centered_shape, c("position_matrix", "x")))
Generic function for rescaling or otherwise reparameterizing an existing scatterer while preserving its class semantics. The class-specific methods handle the component bookkeeping needed to keep the resulting object structurally valid after lengths, widths, heights, shell thicknesses, or related geometry descriptors are changed.
reforge(object, ...)reforge(object, ...)
object |
A scatterer object. |
... |
Additional arguments passed to specific methods. |
reforge() is the package's main post-construction geometry-adjustment
tool. It is useful when a target should be modified in place rather than
rebuilt from scratch. The available method-specific arguments depend on the
scatterer class and typically include direct scale factors and/or target
dimensions for length, width, or height.
A scatterer of the same broad class as object, rebuilt with the
requested geometric changes.
extract(), plot.Scatterer(), brake()
obj <- fls_generate( shape = sphere(radius_body = 0.01, n_segments = 40), density_body = 1045, sound_speed_body = 1520 ) bigger_obj <- reforge(obj, body_target = c(length = 0.03)) extract(bigger_obj, c("shape_parameters", "length"))obj <- fls_generate( shape = sphere(radius_body = 0.01, n_segments = 40), density_body = 1045, sound_speed_body = 1520 ) bigger_obj <- reforge(obj, body_target = c(length = 0.03)) extract(bigger_obj, c("shape_parameters", "length"))
Register a user-defined target-strength model
register_model( name, initialize, solver, slot = NULL, aliases = character(), persist = FALSE, overwrite = FALSE )register_model( name, initialize, solver, slot = NULL, aliases = character(), persist = FALSE, overwrite = FALSE )
name |
Canonical model name passed to |
initialize |
Initializer function or function reference. |
solver |
Solver function or function reference. |
slot |
Result-slot name stored on the scatterer. Defaults to the usual
upper-case model label derived from |
aliases |
Optional alternative model names. |
persist |
Logical scalar. When |
overwrite |
Logical scalar. When |
Invisibly returns the normalized registry entry.
if (interactive()) { initialize_demo <- function(object, frequency, ...) object solve_demo <- function(object) object register_model( "demo", initialize = initialize_demo, solver = solve_demo ) unregister_model("demo") }if (interactive()) { initialize_demo <- function(object, frequency, ...) object solve_demo <- function(object) object register_model( "demo", initialize = initialize_demo, solver = solve_demo ) unregister_model("demo") }
Re-discretize a shape or scatterer component along its x axis without rebuilding it from scratch.
resample_shape( object, n_segments, component = NULL, containment = c("warn", "error", "ignore") )resample_shape( object, n_segments, component = NULL, containment = c("warn", "error", "ignore") )
object |
Shape or Scatterer object. |
n_segments |
New number of intervals used to discretize the profile. |
component |
Optional component name for scatterers. Defaults to the
primary geometry ( |
containment |
Containment policy used when a moved swimbladder or
backbone is checked against its body: |
The modified object, returned as the same broad object type.
smooth_shape(), inflate_shape(), reforge(), extract()
shape_obj <- sphere(radius_body = 0.01, n_segments = 20) shape_fine <- resample_shape(shape_obj, n_segments = 80) extract(shape_fine, c("shape_parameters", "n_segments"))shape_obj <- sphere(radius_body = 0.01, n_segments = 20) shape_fine <- resample_shape(shape_obj, n_segments = 80) extract(shape_fine, c("shape_parameters", "n_segments"))
Clear user-defined model registrations
reset_model_registry(remove_persisted = FALSE)reset_model_registry(remove_persisted = FALSE)
remove_persisted |
Logical scalar. When |
Invisibly returns NULL.
if (interactive()) { reset_model_registry() }if (interactive()) { reset_model_registry() }
) of a scattering boundaryCalculate the density contrast () of a scattering boundary
rho(medium, target)rho(medium, target)
medium |
Dataframe object containing density ( |
target |
Dataframe object containing density ( |
Density contrast, defined as
.
seawater <- data.frame(density = 1026, sound_speed = 1480) animal <- data.frame(density = 1050, sound_speed = 1530) rho(seawater, animal)seawater <- data.frame(density = 1026, sound_speed = 1480) animal <- data.frame(density = 1050, sound_speed = 1530) rho(seawater, animal)
Computes the prolate spheroidal radial functions of the first
(), second (), third
(), and fourth () kinds and their first
derivatives with respect to for given order , degree
, size parameter , and radial coordinate .
This function is an R wrapper for compiled C++ code, which in turn calls the
underlying Fortran library (prolate_swf) for high-performance
numerical computation. All heavy computation is performed in compiled code
for speed and accuracy.
Rmn(m, n, c, xi, kind = 1, precision = "double")Rmn(m, n, c, xi, kind = 1, precision = "double")
m |
Non-negative integer. The order of the spheroidal function ( |
n |
Non-negative integer. The degree of the spheroidal function ( |
c |
Numeric. The scalar size parameter (also denoted |
xi |
Numeric. The radial coordinate at which to evaluate the function.
Must satisfy |
kind |
Integer. Specifies which kind of radial function to compute:
|
precision |
Character. Either
|
The prolate spheroidal radial functions are solutions to the radial part of the scalar Helmholtz equation in prolate spheroidal coordinates. They satisfy the differential equation:
where is the separation constant (eigenvalue).
Function kinds:
kind = 1: Radial function of the first kind
. Regular at the origin; analogous to spherical
Bessel functions .
kind = 2: Radial function of the second kind
. Singular at the focal points ();
analogous to spherical Neumann functions .
kind = 3: Radial function of the third kind (outgoing
Hankel-type) . Used for outgoing wave solutions.
kind = 4: Radial function of the fourth kind (incoming
Hankel-type) . Used for incoming wave solutions.
Domain restrictions:
The radial coordinate must satisfy (prolate domain).
The order must satisfy .
The degree must satisfy .
Normalization:
The functions use the Morse-Feshbach normalization by default, where the
radial functions reduce to spherical Bessel/Neumann functions as
.
Implementation:
This function is an R wrapper for a compiled C++ interface (Rmn_cpp),
which itself wraps the Fortran subroutine profcn from the
prolate_swf library developed by Arnie Lee Van Buren and Jeffrey
Boisvert. The underlying algorithm uses a combination of forward and
backward recursion with the Bouwkamp eigenvalue method for high accuracy
across wide parameter ranges. The C++ layer manages memory, precision
selection, and data conversion between R and Fortran for robust and
efficient computation.
A list containing:
valueThe function value . Real for
kind = 1 or 2; complex for kind = 3 or 4.
derivativeThe first derivative
. Real for kind = 1 or
2; complex for kind = 3 or 4.
Van Buren, A. L. and Boisvert, J. E. "Prolate Spheroidal Wave Functions." GitHub repository: https://github.com/MathieuandSpheroidalWaveFunctions/prolate_swf
Morse, P. M. and Feshbach, H. (1953). Methods of Theoretical Physics. McGraw-Hill, New York. Chapter 21.
Flammer, C. (1957). Spheroidal Wave Functions. Stanford University Press.
NIST Digital Library of Mathematical Functions. Chapter 30: Spheroidal Wave Functions. https://dlmf.nist.gov/30
Smn for prolate spheroidal angular functions.
# First kind radial function Rmn(m = 2, n = 3, c = 1, xi = 1.5, kind = 1) # Second kind radial function Rmn(m = 0, n = 2, c = 5, xi = 2.0, kind = 2) # Third kind (outgoing) radial function Rmn(m = 1, n = 1, c = 2, xi = 1.2, kind = 3) # Fourth kind (incoming) radial function Rmn(m = 1, n = 1, c = 2, xi = 1.2, kind = 4) # Double precision (default) Rmn(m = 2, n = 3, c = 1, xi = 1.5)# First kind radial function Rmn(m = 2, n = 3, c = 1, xi = 1.5, kind = 1) # Second kind radial function Rmn(m = 0, n = 2, c = 5, xi = 2.0, kind = 2) # Third kind (outgoing) radial function Rmn(m = 1, n = 1, c = 2, xi = 1.2, kind = 3) # Fourth kind (incoming) radial function Rmn(m = 1, n = 1, c = 2, xi = 1.2, kind = 4) # Double precision (default) Rmn(m = 2, n = 3, c = 1, xi = 1.5)
A pre-generated SBF scatterer containing all information required for
target strength modeling. The packaged geometry follows the sardine entry
distributed through the NOAA Fisheries KRM reference collection and
archived in the echoSMs resources. The object metadata identifies the
target as Sardinops sagax caerulea following Conti and Demer (2003).
data(sardine)data(sardine)
A named list with the following components:
Relevant and identifying metadata (list).
Specified model parameters (list).
Model outputs and results (list).
A list with:
rpos: Position matrix (x, yw, zU, zL; m).
sound_speed: Flesh sound speed (, m/s).
density: Flesh density (, kg/m).
theta: Orientation relative to transducer
(, radians).
A list with:
rpos: Position matrix (x, yw, zU, zL; m).
sound_speed: Bladder sound speed (, m/s).
density: Bladder density
(, kg/m).
theta: Orientation relative to transducer
(, radians).
A named list with:
body: A list describing the body:
length: Body length (m).
ncyl: Number of discrete cylinders.
theta_units: Units for orientation angle.
length_units: Units for length.
bladder: A list describing the swimbladder:
length: Bladder length (m).
ncyl: Number of discrete cylinders.
theta_units: Units for orientation angle.
length_units: Units for length.
A pre-generated SBF scatterer object.
NOAA Fisheries KRM model reference collection
(https://www.fisheries.noaa.gov/data-tools/krm-model) and the
archived echoSMs resource set
(https://github.com/ices-tools-dev/echoSMs).
Conti, S.G., and Demer, D.A. (2003). Wide-bandwidth acoustical characterization of anchovy and sardine from reverberation measurements in an echoic tank. ICES Journal of Marine Science, 60, 617-624. doi:10.1016/S1054-3139(03)00056-0
data("sardine", package = "acousticTS") sardinedata("sardine", package = "acousticTS") sardine
A S4 class that provides slots to contain relevant animal metadata for parameterizing models for swimbladdered fish (SBF) that are partitioned into two sets of discretized cylinders: the body and the swimbladder. Both shapes comprise independent position matrices, material properties, orientations, and other relevant shape-related data and metadata. See Scatterer for a more detailed description on how this S4 object is organized.
An object of the SBF S4 class.
methods::getClass("SBF")methods::getClass("SBF")
Generate a SBF-class object.
sbf_generate( x_body = NULL, w_body = NULL, zU_body = NULL, zL_body = NULL, x_bladder = NULL, w_bladder = NULL, zU_bladder = NULL, zL_bladder = NULL, sound_speed_body = NULL, sound_speed_bladder = NULL, g_body = NULL, h_body = NULL, g_bladder = NULL, h_bladder = NULL, density_body = NULL, density_bladder = NULL, theta_body = pi/2, theta_bladder = pi/2, theta_units = "radians", length_units = "m", ID = NULL, body_shape = NULL, bladder_shape = NULL )sbf_generate( x_body = NULL, w_body = NULL, zU_body = NULL, zL_body = NULL, x_bladder = NULL, w_bladder = NULL, zU_bladder = NULL, zL_bladder = NULL, sound_speed_body = NULL, sound_speed_bladder = NULL, g_body = NULL, h_body = NULL, g_bladder = NULL, h_bladder = NULL, density_body = NULL, density_bladder = NULL, theta_body = pi/2, theta_bladder = pi/2, theta_units = "radians", length_units = "m", ID = NULL, body_shape = NULL, bladder_shape = NULL )
x_body |
Vector containing along-body axis (m). |
w_body |
Vector containing across-body axis (m). |
zU_body |
Vector containing dorsal-body axis (m). |
zL_body |
Vector containing ventral-body axis (m). |
x_bladder |
Vector containing along-bladder axis (m). |
w_bladder |
Vector containing across-bladder axis (m). |
zU_bladder |
Vector containing dorsal-bladder axis (m). |
zL_bladder |
Vector containing ventral-bladder axis (m). |
sound_speed_body |
Flesh sound speed (c;body, m s-1). |
sound_speed_bladder |
Bladder sound speed (c, m |
g_body |
Body density contrast. |
h_body |
Body sound speed contrast. |
g_bladder |
Bladder density contrast. |
h_bladder |
Bladder sound speed contrast. |
density_body |
Flesh density (ρbody, kg m3). |
density_bladder |
Bladder density ( |
theta_body |
Angle of body relative to wavefront
( |
theta_bladder |
Angle of bladder relative to wavefront
( |
theta_units |
Compatibility argument. Scatterer constructors now assume radians and ignore non-SI alternatives. |
length_units |
Compatibility argument. Scatterer constructors now assume meters and ignore non-SI alternatives. |
ID |
Optional metadata identifier. |
body_shape |
Optional pre-built Shape for the body; overrides x_body/w_body/zU_body/zL_body if supplied. |
bladder_shape |
Optional pre-built Shape for the bladder; overrides x_bladder/w_bladder/zU_bladder/zL_bladder if supplied. |
The recommended interface is to supply pre-built Shape objects through
body_shape and bladder_shape, then specify material properties through
either contrasts (g_*, h_*) or absolute density/sound-speed values.
Legacy coordinate-vector inputs are retained for backward compatibility and
are converted internally to Shape objects before the scatterer is built.
Character-based shape dispatch is deprecated; build the component geometry
first with a Shape constructor and then pass the resulting Shape object.
Body/bladder width vectors (w_body, w_bladder) default to zeros when
missing. Resulting rpos matrices always carry the row names
x_body, w_body, zU_body, zL_body for the body and x_bladder, w_bladder,
zU_bladder, zL_bladder for the bladder.
Generates a SBF-class object.
# Manual body/bladder coordinates sbf_generate( x_body = seq(0, 0.1, length.out = 5), w_body = rep(0, 5), zU_body = seq(0.001, 0.002, length.out = 5), zL_body = -seq(0.001, 0.002, length.out = 5), x_bladder = seq(0.02, 0.09, length.out = 4), w_bladder = rep(0, 4), zU_bladder = rep(0.0015, 4), zL_bladder = rep(-0.0015, 4), sound_speed_body = 1500, sound_speed_bladder = 340, density_body = 1040, density_bladder = 1.2 ) # Using pre-built shapes body_shape <- arbitrary( x_body = c(0, 0.1), zU_body = c(0.001, 0.002), zL_body = c(-0.001, -0.002) ) bladder_shape <- arbitrary( x_bladder = c(0.02, 0.09), w_bladder = c(0, 0), zU_bladder = c(0.0015, 0.0015), zL_bladder = c(-0.0015, -0.0015) ) sbf_generate( body_shape = body_shape, bladder_shape = bladder_shape, sound_speed_body = 1500, sound_speed_bladder = 340, density_body = 1040, density_bladder = 1.2 )# Manual body/bladder coordinates sbf_generate( x_body = seq(0, 0.1, length.out = 5), w_body = rep(0, 5), zU_body = seq(0.001, 0.002, length.out = 5), zL_body = -seq(0.001, 0.002, length.out = 5), x_bladder = seq(0.02, 0.09, length.out = 4), w_bladder = rep(0, 4), zU_bladder = rep(0.0015, 4), zL_bladder = rep(-0.0015, 4), sound_speed_body = 1500, sound_speed_bladder = 340, density_body = 1040, density_bladder = 1.2 ) # Using pre-built shapes body_shape <- arbitrary( x_body = c(0, 0.1), zU_body = c(0.001, 0.002), zL_body = c(-0.001, -0.002) ) bladder_shape <- arbitrary( x_bladder = c(0.02, 0.09), w_bladder = c(0, 0), zU_bladder = c(0.0015, 0.0015), zL_bladder = c(-0.0015, -0.0015) ) sbf_generate( body_shape = body_shape, bladder_shape = bladder_shape, sound_speed_body = 1500, sound_speed_bladder = 340, density_body = 1040, density_bladder = 1.2 )
The acousticTS package uses a variety of defined S4-class objects
comprising different types of scatterers, such as fish with gas-filled
swimbladders (SBF) and fluid-like crustaceans
(FLS).
An object from the Scatterer S4 class hierarchy.
metadataList containing relevant metadata
model_parametersModel parameters necessary for predicting TS
metadata:A list comprising any identifying
information associated with the scatterer. The default metadata entry
includes ID that uses a default character value of
"UID" (i.e. ID = "UID"). This can otherwise be formatted
in any manner for book keeping purposes.
body/bladder:A list that includes information
relevant to the scatterer's position vector, material properties,
tilt/orientation, etc. For some scatterers, this may only include
body, but other targets may have an additional parameter such as
bladder. Generally, each entry includes:
rpos: the relevant position vector
(r0)
that includes axes such as x, y, z, etc., that depend
on the type of scatterer being used.
radius: in some cases this includes the radius measurements
for each cylinders depending on the type of scatterer object.
theta: the orientation of the scatterer relative to the
transmitting transducer or sound source
(θanimal)
that can be represented either by degrees or radians, although all
functions require radians.
g, h: material properties that represent the density and
sound speed contrasts (g and h, respectively) relative to the
ambient/surrounding fluid. Some targets may instead have standard
sound speed
(canimal,
m s-1)
and density
(ρanimal,
kg m3).
shape_parameters:A list that includes metadata
pertaining to the shape of the scatterer and any other features of
interest (e.g. gas-filled swimbladder). Generally, each entry includes:
overall body length, the number of discrete cylinders that make up the
shape (if applicable), and the units related to both
θanimal
(e.g. rad, °) and length
(e.g. mm, m).
model_parameters:A list that contains relevant model
parameterization once an object has been initialized for modeling
σbs. This is
typically broken up into three categories:
parameters: A list that includes information such as
frequency (Hz), acoustic wavenumber (i.e. k), etc.
medium: A data.frame including information such as
the material properties of the ambient medium.
scatterer: A list containing summarized information
used to parameterize certain scattering models.
model:A list that collects model results from one
or more models in the linear domain (i.e.
σbs).
Elastic-based scatterers (ELA)
Composite multi-component scatterers (CSC)
Backboned fish (BBF)
Calibration spheres (CAL)
Elastic-shelled scatterers (ESS)
Fluid-like scatterers (FLS)
Gas-filled scatterers (GAS)
Swimbladdered fish (SBF)
methods::getClass("Scatterer")methods::getClass("Scatterer")
Calculates the shear modulus (G) from two of the three other elastic
moduli: bulk modulus (K), Young's modulus (E), or Poisson's ratio
(). Assumes 3D material properties.
The relationships used are:
shear(K = NULL, E = NULL, nu = NULL)shear(K = NULL, E = NULL, nu = NULL)
K |
Bulk modulus (Pa). |
E |
Young's modulus (Pa). |
nu |
Poisson's ratio (Dimensionless). |
Shear modulus (G, Pa).
shear(K = 2.5e9, E = 3e9)shear(K = 2.5e9, E = 3e9)
Simulate target strength (TS) with flexible parameterization and batching
simulate_ts( object, frequency, model, n_realizations = NULL, parameters = list(), batch_by = NULL, permute = TRUE, parallel = TRUE, n_cores = .default_simulation_cores(), verbose = TRUE )simulate_ts( object, frequency, model, n_realizations = NULL, parameters = list(), batch_by = NULL, permute = TRUE, parallel = TRUE, n_cores = .default_simulation_cores(), verbose = TRUE )
object |
Scatterer-class object. |
frequency |
Frequency (Hz). |
model |
Model name. If multiple models are specified, the output will be a list of data frames, one for each model. |
n_realizations |
Optional number of repeated evaluations of each
deterministic grid cell (default |
parameters |
List containing the values, distributions, or generating functions of parameter values that inform the TS model. Defaults to an empty list, which runs a single realization of the unmodified object. |
batch_by |
Optional. Specifies which parameters in |
permute |
Logical; controls how varied parameters combine. When
|
parallel |
Logical; whether to parallelize the simulations. Default is
|
n_cores |
Optional. Number of CPU cores to use for parallelization.
Default is the smaller of 2 cores and |
verbose |
Logical; whether to print progress and status messages to the
console. Default is |
simulate_ts() is a workflow wrapper around repeated target_strength()
calls. It supports three broad parameter modes inside parameters:
scalars that are recycled across every realization,
explicit vectors that are either aligned with the full simulation grid or with one or more batched dimensions, and
generating functions that are re-evaluated for each realization, and
structured values such as named target-dimension vectors used by
reforge() (for example body_target = c(length = 0.03)).
If batch_by = "length" and parameters[["length"]] is a vector
of candidate values, then simulations are run for each length value,
repeated n_realizations times. When multiple parameters are supplied
through batch_by, the function builds the full Cartesian grid of
those parameter values and runs the requested number of realizations inside
each batch cell.
Batching is automatic and follows one consistent rule: every deterministic
multi-value parameter is a grid axis, whether or not n_realizations or
batch_by are supplied. A bare vector therefore always means "sweep
these values" rather than "align one value per realization". batch_by
remains available to document intent, but naming an axis is no longer
required for it to be swept.
To vary parameters together (paired rather than crossed) set
permute = FALSE. The varied parameters are then zipped element-wise
and must share the same number of values. For example,
parameters = list(theta_body = c(1, 2), density_body = c(1040, 1050))
yields four runs by default but two paired runs -
(1, 1040) and (2, 1050) - under permute = FALSE.
Alternatively, values that belong to one reforge() target can be
paired within a single structured parameter, for example
parameters = list(body_target = list(c(length = 0.02, radius = 0.002),
c(length = 0.03, radius = 0.003))).
Structured batch values should be wrapped in a list so that each candidate is
preserved as one unit. For example, use
parameters = list(body_target =
list(c(length = 0.02), c(length = 0.03))))
when batching across multiple explicit reforge() targets.
Convenience dimension aliases are also supported for compatible
reforge() methods. For example, length_body = 0.03 is treated
the same as body_target = c(length = 0.03) for fluid-like scatterers,
while retaining the original length_body column in the returned
simulation output.
Parameter names are interpreted in the same way they would be if supplied
directly to target_strength() or to the relevant object constructor /
reforge() path. This means simulate_ts() can be used for:
orientation perturbations,
material-property perturbations,
morphology studies that trigger shape rebuilding or reforging, and
side-by-side comparisons across one or more model families.
A data frame when a single model is requested, or a named list of data frames when multiple models are requested. Each returned data frame contains the realized parameter values together with the modeled acoustic output for each simulated run.
This function uses pbapply::pblapply() for parallelized simulation
with progress bars. The current implementation uses PSOCK clusters for
worker execution across platforms, including Windows, macOS, and Linux.
That means worker processes need access to the package namespace and any
required exported objects, and it also means startup overhead is more
noticeable for very small simulation jobs than for larger batched runs.
Including too many parameters from parameters
within batch_by may cause significant performance issues or cause
R to crash. If intensive simulations are required, consider breaking
them into more manageable chunks
shape_obj <- cylinder( length_body = 0.05, radius_body = 0.003, n_segments = 40 ) obj <- fls_generate( shape = shape_obj, density_body = 1045, sound_speed_body = 1520 ) res <- simulate_ts( object = obj, frequency = seq(38e3, 50e3, by = 6e3), model = "dwba", n_realizations = 2, parameters = list( theta_body = function() runif(1, min = 0.5 * pi, max = pi), density_body = 1045 ), parallel = FALSE, verbose = FALSE ) head(res)shape_obj <- cylinder( length_body = 0.05, radius_body = 0.003, n_segments = 40 ) obj <- fls_generate( shape = shape_obj, density_body = 1045, sound_speed_body = 1520 ) res <- simulate_ts( object = obj, frequency = seq(38e3, 50e3, by = 6e3), model = "dwba", n_realizations = 2, parameters = list( theta_body = function() runif(1, min = 0.5 * pi, max = pi), density_body = 1045 ), parallel = FALSE, verbose = FALSE ) head(res)
Computes the prolate spheroidal angular function of the first kind,
, and its first derivative with respect to
for given order , degree , size parameter ,
and angular coordinate .
This function is an R wrapper for compiled C++ code, which in turn calls the
underlying Fortran library (prolate_swf) for high-performance
numerical computation. All heavy computation is performed in compiled code
for speed and
accuracy.
Smn(m, n, c, eta, normalize = FALSE, precision = "double")Smn(m, n, c, eta, normalize = FALSE, precision = "double")
m |
Non-negative integer. The order of the spheroidal function ( |
n |
Non-negative integer. The degree of the spheroidal function ( |
c |
Numeric. The scalar size parameter. |
eta |
Numeric vector. The angular coordinate(s) at which to evaluate the
function. Must satisfy |
normalize |
Logical. If |
precision |
Character. Either
|
The prolate spheroidal angular functions are solutions to the angular part of the scalar Helmholtz equation in prolate spheroidal coordinates. They satisfy the differential equation:
where is the separation constant (eigenvalue).
Domain restrictions:
The angular coordinate must satisfy .
The order must satisfy .
The degree must satisfy .
Normalization:
When normalize = FALSE (default), the functions use the
Meixner-Schäfke normalization, which matches the normalization of the
corresponding associated Legendre functions. When normalize = TRUE,
the functions are scaled to have unity norm.
Implementation:
This function is an R wrapper for a compiled C++ interface (Smn_cpp),
which itself wraps the Fortran subroutine profcn from the
prolate_swf library developed by Arnie Lee Van Buren and Jeffrey
Boisvert. The underlying algorithm uses a combination of forward and
backward recursion with the Bouwkamp eigenvalue method for high accuracy
across wide parameter ranges. The C++ layer manages memory, precision
selection, and data conversion between R and Fortran for robust and
efficient computation.
A list containing:
valueNumeric vector of function values at each input eta.
derivativeNumeric vector of first derivatives
at each input eta.
Equally sized vectors m and n with more than one entry are
evaluated pairwise. For these paired modes, a scalar eta gives vectors
in value and derivative. Multiple eta values give
matrices with one row per mode pair and one column per angular coordinate.
Van Buren, A. L. and Boisvert, J. E. "Prolate Spheroidal Wave Functions." GitHub repository: https://github.com/MathieuandSpheroidalWaveFunctions/prolate_swf
Meixner, J. and Schäfke, F. W. (1954). Mathieusche Funktionen und Sphäroidfunktionen. Springer-Verlag, Berlin.
Flammer, C. (1957). Spheroidal Wave Functions. Stanford University Press.
NIST Digital Library of Mathematical Functions. Chapter 30: Spheroidal Wave Functions. https://dlmf.nist.gov/30
Rmn for prolate spheroidal radial functions.
# Single evaluation Smn(m = 2, n = 3, c = 1, eta = 0.5) # Multiple eta values Smn(m = 0, n = 2, c = 5, eta = c(-0.5, 0, 0.5)) # With unity normalization Smn(m = 1, n = 1, c = 2, eta = 0.3, normalize = TRUE) # Double precision (default) Smn(m = 2, n = 3, c = 1, eta = 0.5, precision = "double")# Single evaluation Smn(m = 2, n = 3, c = 1, eta = 0.5) # Multiple eta values Smn(m = 0, n = 2, c = 5, eta = c(-0.5, 0, 0.5)) # With unity normalization Smn(m = 1, n = 1, c = 2, eta = 0.3, normalize = TRUE) # Double precision (default) Smn(m = 2, n = 3, c = 1, eta = 0.5, precision = "double")
Smooth the stored geometry using a centered moving-average filter applied to
profile coordinates. This is useful for cleaning digitized outlines before
canonicalization or model runs. For canonical Shape objects, the result is
returned as an Arbitrary shape because the edited profile is no longer
guaranteed to preserve the canonical class geometry.
smooth_shape( object, span = 5, component = NULL, preserve_ends = TRUE, containment = c("warn", "error", "ignore") )smooth_shape( object, span = 5, component = NULL, preserve_ends = TRUE, containment = c("warn", "error", "ignore") )
object |
Shape or Scatterer object. |
span |
Centered moving-average span. Even values are rounded up to the next odd integer. |
component |
Optional component name for scatterers. Defaults to the
primary geometry ( |
preserve_ends |
Logical; whether to keep the first and last profile points fixed. |
containment |
Containment policy used when a moved swimbladder or
backbone is checked against its body: |
The modified object. Shape inputs that are smoothed are returned as
Arbitrary shapes.
inflate_shape(), resample_shape(), brake(), reforge()
shape_obj <- arbitrary( x_body = c(0, 0.01, 0.02, 0.03, 0.04), zU_body = c(0, 0.003, 0.006, 0.0035, 0), zL_body = c(0, -0.0025, -0.0055, -0.003, 0) ) smoothed_shape <- smooth_shape(shape_obj, span = 3) extract(smoothed_shape, c("shape_parameters", "n_segments"))shape_obj <- arbitrary( x_body = c(0, 0.01, 0.02, 0.03, 0.04), zU_body = c(0, 0.003, 0.006, 0.0035, 0), zL_body = c(0, -0.0025, -0.0055, -0.003, 0) ) smoothed_shape <- smooth_shape(shape_obj, span = 3) extract(smoothed_shape, c("shape_parameters", "n_segments"))
Creates a sphere.
sphere(radius_body, n_segments = 100, diameter_units = "m")sphere(radius_body, n_segments = 100, diameter_units = "m")
radius_body |
Object radius (m). |
n_segments |
Number of segments to discretize object shape. Defaults to 1e2 segments. |
diameter_units |
Default is "m" for meters |
Creates position vector for a spherical object of a defined radius.
sphere(radius_body = 0.01, n_segments = 50)sphere(radius_body = 0.01, n_segments = 50)
Wrapper function to model acoustic target strength
target_strength( object, frequency, model, verbose = FALSE, model_args = NULL, ... )target_strength( object, frequency, model, verbose = FALSE, model_args = NULL, ... )
object |
Scatterer-class object. |
frequency |
Frequency (Hz). |
model |
Model name. Available models currently include
|
verbose |
Prints current procedural step occurring from model initialization to calculating TS. Defaults to FALSE. |
model_args |
Optional named list of per-model argument bundles. Each
list name should match one of the requested model names
case-insensitively, and each value should be either a named list or a
named atomic vector of arguments to apply only to that model. When the
same argument is supplied both through |
... |
Additional optional model inputs/parameters. |
This is the main high-level entry point for running target-strength models in
acousticTS. The supplied scatterer object is checked, the requested
model or models are initialized, and the resulting outputs are stored back on
the same object.
The available model families span exact modal-series solutions and approximation-based solutions. Readers should consult the model-specific help topics for the physical assumptions, valid object types, boundary-condition options, and model-specific arguments used by each implementation:
DWBA for the distorted-wave Born approximation
applied to weakly scattering fluid-like bodies.
BBFM for a composite flesh-plus-backbone model that
combines a DWBA flesh term with an elastic-cylinder backbone term.
PCDWBA for the phase-compensated distorted-wave Born
approximation applied to elongated fluid-like bodies.
SDWBA for the stochastic distorted-wave Born
approximation.
FCMS for the finite cylinder modal series solution.
BCMS for the bent-cylinder modal series solution.
ECMS for the elastic-cylinder modal series solution.
HPA for the high-pass approximation family.
KRM for the Kirchhoff-Ray Mode model.
PSMS for the prolate spheroidal modal series
solution.
SPHMS for the spherical modal series solution.
ESSMS for the elastic-shelled spherical modal series
solution.
VESMS for the viscous-elastic spherical scattering
model applied to gas-filled elastic shells with an external viscous layer.
TMM for the single-target transition-matrix family.
TRCM for the two-ray cylindrical model.
SOEMS for the solid elastic calibration-sphere model,
accessed through "calibration" or "soems".
Model-specific inputs are usually passed through .... For example,
some models require a boundary argument, HPA uses a
method argument, and several models expose additional numerical
controls. When several models are requested together, shared arguments may be
supplied through ... and per-model overrides may be supplied through
model_args. This is useful when different models should share the same
seawater properties but only one of them needs an extra stochastic or
numerical control:
target_strength(
object,
frequency,
model = c("dwba", "sdwba"),
density_sw = 1026,
sound_speed_sw = 1478,
model_args = list(
sdwba = list(phase_sd_init = 0.77)
)
)
Model names are normalized internally, so case-insensitive inputs such as
"DWBA" and "dwba" resolve to the same family.
The input scatterer object with requested model parameters, model outputs, and target strength results stored in its model slots.
DWBA, BBFM, PCDWBA,
SDWBA, FCMS, BCMS,
ECMS, HPA, KRM, PSMS,
SPHMS, ESSMS, VESMS,
TMM, TRCM,
SOEMS
calibration_sphere <- cal_generate( material = "WC", diameter = 38.1e-3, n_segments = 40 ) target_strength( calibration_sphere, frequency = c(38e3, 120e3), model = "calibration" )calibration_sphere <- cal_generate( material = "WC", diameter = 38.1e-3, n_segments = 40 ) target_strength( calibration_sphere, frequency = c(38e3, 120e3), model = "calibration" )
Reuses the stored TMM blocks to average the differential scattering cross section over a user-supplied set of incident orientations. By default the receive direction is taken to be the exact monostatic direction for each supplied orientation.
tmm_average_orientation( object, theta_body = NULL, weights = NULL, phi_body = pi, theta_scatter = NULL, phi_scatter = NULL, distribution = NULL )tmm_average_orientation( object, theta_body = NULL, weights = NULL, phi_body = pi, theta_scatter = NULL, phi_scatter = NULL, distribution = NULL )
object |
Scatterer-object previously evaluated with
|
theta_body |
Numeric vector of incident polar angles (radians). |
weights |
Optional numeric vector of averaging weights. When omitted, equal weights are used. |
phi_body |
Incident azimuth angle(s) (radians). Either scalar or the
same length as |
theta_scatter |
Receive polar angle(s) (radians). Either scalar or the
same length as |
phi_scatter |
Receive azimuth angle(s) (radians). Either scalar or the
same length as |
distribution |
Optional orientation distribution created by
|
A data frame containing the frequency, the orientation-averaged differential backscattering cross section and the corresponding orientation-averaged target strength.
target <- fls_generate( shape = sphere(radius_body = 0.005, n_segments = 20), g_body = 1, h_body = 1 ) stored <- target_strength( target, frequency = 12e3, model = "tmm", boundary = "pressure_release", store_t_matrix = TRUE ) distribution <- tmm_orientation_distribution(n_theta = 5) tmm_average_orientation(stored, distribution = distribution)target <- fls_generate( shape = sphere(radius_body = 0.005, n_segments = 20), g_body = 1, h_body = 1 ) stored <- target_strength( target, frequency = 12e3, model = "tmm", boundary = "pressure_release", store_t_matrix = TRUE ) distribution <- tmm_orientation_distribution(n_theta = 5) tmm_average_orientation(stored, distribution = distribution)
Reuses the stored T-matrix blocks at one stored frequency to compute a higher-level bistatic summary, including forward- and cross-plane slices, peak-scattering direction, backscatter-lobe width, and integrated scattering over coarse angular sectors. In the current package build, this helper is available for the spherical and spheroidal stored branches. Stored cylinders intentionally stop at exact monostatic reuse until a validated retained cylinder angular operator is added.
tmm_bistatic_summary( object, frequency = NULL, theta_body = NULL, phi_body = NULL, n_theta = 91, n_phi = 181, n_psi = 181, sectors = NULL, drop_dB = 3, include_grid = FALSE )tmm_bistatic_summary( object, frequency = NULL, theta_body = NULL, phi_body = NULL, n_theta = 91, n_phi = 181, n_psi = 181, sectors = NULL, drop_dB = 3, include_grid = FALSE )
object |
Scatterer-object previously evaluated with
|
frequency |
Stored frequency (Hz) to summarize. Required when the object contains more than one stored frequency. |
theta_body |
Incident polar angle (radians). Defaults to the stored TMM incident angle. |
phi_body |
Incident azimuth angle (radians). Defaults to the stored TMM incident angle. |
n_theta |
Number of receive polar-angle samples used by the summary grid. |
n_phi |
Number of receive azimuth samples used by the summary grid. |
n_psi |
Number of forward-centered angular samples used for the local great-circle slices. |
sectors |
Optional data frame with columns |
drop_dB |
Positive dB drop used to define the backscatter-lobe width on the forward-centered slice. |
include_grid |
Logical; include the underlying scattering grid in the returned list. |
A list containing scalar summary metrics, the named slice data frames, sector integrals, and optionally the underlying scattering grid.
tmm_scattering_grid,
tmm_products
target <- fls_generate( shape = sphere(radius_body = 0.005, n_segments = 20), g_body = 1, h_body = 1 ) stored <- target_strength( target, frequency = 12e3, model = "tmm", boundary = "pressure_release", store_t_matrix = TRUE ) tmm_bistatic_summary( stored, n_theta = 5, n_phi = 9, n_psi = 9 )target <- fls_generate( shape = sphere(radius_body = 0.005, n_segments = 20), g_body = 1, h_body = 1 ) stored <- target_strength( target, frequency = 12e3, model = "tmm", boundary = "pressure_release", store_t_matrix = TRUE ) tmm_bistatic_summary( stored, n_theta = 5, n_phi = 9, n_psi = 9 )
Reuses the stored transition-matrix blocks to compute a compact set of numerical and physics-based diagnostics for one or more stored frequencies. The summary combines:
monostatic reconstruction residuals,
reciprocity residuals under incident/receive-angle exchange,
an optical-theorem residual based on forward scattering and the integrated differential cross section,
block-level conditioning indicators from the stored transition-matrix blocks,
and, for prolate/oblate targets, an equal-volume sphere-to-spheroid continuation path that checks whether the monostatic response deforms smoothly away from the exact sphere limit.
These checks are meant to help distinguish "the post-processing is self-consistent" from "the retained solve was also numerically comfortable," which is especially helpful for the newer nonspherical TMM branches. For stored cylinders, the current diagnostics are intentionally limited to exact monostatic reconstruction because a validated retained cylinder angular operator is not yet available.
tmm_diagnostics( object, frequency = NULL, theta_body = NULL, phi_body = NULL, reciprocity_pairs = NULL, n_theta = 61, n_phi = 121, continuation_steps = 6L )tmm_diagnostics( object, frequency = NULL, theta_body = NULL, phi_body = NULL, reciprocity_pairs = NULL, n_theta = 61, n_phi = 121, continuation_steps = 6L )
object |
Scatterer-object previously evaluated with
|
frequency |
Optional stored frequency or vector of stored frequencies (Hz). Defaults to all stored frequencies. |
theta_body |
Incident polar angle (radians) used for the monostatic and optical-theorem checks. Defaults to the stored TMM incident angle. |
phi_body |
Incident azimuth angle (radians) used for the monostatic and optical-theorem checks. Defaults to the stored TMM incident angle. |
reciprocity_pairs |
Optional data frame giving explicit reciprocity test
angles. Must contain |
n_theta |
Number of polar-angle grid points used by the optical-theorem integration check. |
n_phi |
Number of azimuth-angle grid points used by the optical-theorem integration check. |
continuation_steps |
Number of equal-volume aspect-ratio steps used for
the sphere-to-spheroid continuation check on prolate and oblate targets.
Set to |
A list with components:
summaryPer-frequency diagnostic summary.
block_metricsPer-frequency block-level conditioning and transpose-residual summaries.
continuationEqual-volume sphere-to-spheroid continuation
path for spheroidal targets, or NULL for other shapes.
tmm_scattering, tmm_scattering_grid,
tmm_products
target <- fls_generate( shape = sphere(radius_body = 0.005, n_segments = 20), g_body = 1, h_body = 1 ) stored <- target_strength( target, frequency = 12e3, model = "tmm", boundary = "pressure_release", store_t_matrix = TRUE ) tmm_diagnostics(stored, n_theta = 5, n_phi = 9)target <- fls_generate( shape = sphere(radius_body = 0.005, n_segments = 20), g_body = 1, h_body = 1 ) stored <- target_strength( target, frequency = 12e3, model = "tmm", boundary = "pressure_release", store_t_matrix = TRUE ) tmm_diagnostics(stored, n_theta = 5, n_phi = 9)
Creates a validated set of incident angles and normalized weights that can be
reused by tmm_average_orientation or
tmm_products. The distributions
defined here are distributions in theta_body itself rather than isotropic
solid-angle distributions.
tmm_orientation_distribution( distribution = c("uniform", "normal", "truncated_normal", "quadrature", "pdf"), theta_body = NULL, weights = NULL, pdf = NULL, phi_body = pi, mean_theta = pi/2, sd_theta = pi/12, lower = 0, upper = pi, n_theta = 91 )tmm_orientation_distribution( distribution = c("uniform", "normal", "truncated_normal", "quadrature", "pdf"), theta_body = NULL, weights = NULL, pdf = NULL, phi_body = pi, mean_theta = pi/2, sd_theta = pi/12, lower = 0, upper = pi, n_theta = 91 )
distribution |
Orientation-distribution type. One of |
theta_body |
Optional numeric vector of incident polar angles (radians).
Required for the |
weights |
Optional numeric quadrature weights paired with |
pdf |
Optional user-supplied density over |
phi_body |
Incident azimuth angle(s) (radians). Either scalar or the
same length as the resolved |
mean_theta |
Mean angle (radians) for the normal-family distributions. |
sd_theta |
Standard deviation (radians) for the normal-family distributions. |
lower |
Lower bound (radians) for the uniform and truncated-normal distributions. |
upper |
Upper bound (radians) for the uniform and truncated-normal distributions. |
n_theta |
Number of grid points for the analytic distributions. |
A data frame with normalized orientation weights and class
"TMMOrientationDistribution".
tmm_average_orientation,
tmm_products
tmm_orientation_distribution( distribution = "uniform", lower = pi / 3, upper = 2 * pi / 3, n_theta = 7 )tmm_orientation_distribution( distribution = "uniform", lower = pi / 3, upper = 2 * pi / 3, n_theta = 7 )
Provides a higher-level convenience interface for the stored-block TMM workflow. One call can return the monostatic scattering spectrum, an orientation average, and a higher-level bistatic summary without rebuilding the underlying T-matrix solve. For stored cylinders, the currently supported products are the exact monostatic scattering spectrum and the corresponding orientation-averaged monostatic outputs; cylinder bistatic summaries remain unavailable until a validated retained cylinder angular operator is added.
tmm_products( object, frequency = NULL, theta_body = NULL, phi_body = NULL, orientation = NULL, bistatic_summary = FALSE, include_grid = FALSE, n_theta = 91, n_phi = 181, n_psi = 181, sectors = NULL, drop_dB = 3 )tmm_products( object, frequency = NULL, theta_body = NULL, phi_body = NULL, orientation = NULL, bistatic_summary = FALSE, include_grid = FALSE, n_theta = 91, n_phi = 181, n_psi = 181, sectors = NULL, drop_dB = 3 )
object |
Scatterer-object previously evaluated with
|
frequency |
Stored frequency (Hz) used when |
theta_body |
Incident polar angle (radians) for the monostatic and bistatic products. Defaults to the stored TMM incident angle. |
phi_body |
Incident azimuth angle (radians) for the monostatic and bistatic products. Defaults to the stored TMM incident angle. |
orientation |
Optional orientation distribution created by
|
bistatic_summary |
Logical; include the output of
|
include_grid |
Logical; keep the 2D scattering grid inside the bistatic summary output. |
n_theta |
Number of receive polar-angle samples for the bistatic summary. |
n_phi |
Number of receive azimuth samples for the bistatic summary. |
n_psi |
Number of forward-centered angular samples used by the local summary slices. |
sectors |
Optional angular-sector table passed to
|
drop_dB |
Positive dB drop used to define the backscatter-lobe width. |
A named list containing the requested post-processed TMM products.
tmm_scattering,
tmm_average_orientation,
tmm_bistatic_summary
target <- fls_generate( shape = sphere(radius_body = 0.005, n_segments = 20), g_body = 1, h_body = 1 ) stored <- target_strength( target, frequency = 12e3, model = "tmm", boundary = "pressure_release", store_t_matrix = TRUE ) tmm_products(stored)target <- fls_generate( shape = sphere(radius_body = 0.005, n_segments = 20), g_body = 1, h_body = 1 ) stored <- target_strength( target, frequency = 12e3, model = "tmm", boundary = "pressure_release", store_t_matrix = TRUE ) tmm_products(stored)
Evaluates the far-field scattering amplitude from a previously computed
TMM object using the stored transition-matrix blocks. This allows the same
retained
modal operator to be reused for arbitrary single-target incident and
receive-angle combinations without rebuilding the boundary solve.
tmm_scattering( object, theta_body = NULL, phi_body = NULL, theta_scatter = NULL, phi_scatter = NULL )tmm_scattering( object, theta_body = NULL, phi_body = NULL, theta_scatter = NULL, phi_scatter = NULL )
object |
Scatterer-object previously evaluated with
|
theta_body |
Incident polar angle (radians). Defaults to the stored TMM incident angle. |
phi_body |
Incident azimuth angle (radians). Defaults to the stored TMM incident angle. |
theta_scatter |
Receive polar angle (radians). Defaults to the exact
monostatic direction, |
phi_scatter |
Receive azimuth angle (radians). Defaults to the exact
monostatic direction, |
A data frame with the frequency, complex scattering amplitude, the corresponding differential cross section, and its level in dB.
target_strength(), tmm_average_orientation
target <- fls_generate( shape = sphere(radius_body = 0.005, n_segments = 20), g_body = 1, h_body = 1 ) stored <- target_strength( target, frequency = 12e3, model = "tmm", boundary = "pressure_release", store_t_matrix = TRUE ) tmm_scattering(stored)target <- fls_generate( shape = sphere(radius_body = 0.005, n_segments = 20), g_body = 1, h_body = 1 ) stored <- target_strength( target, frequency = 12e3, model = "tmm", boundary = "pressure_release", store_t_matrix = TRUE ) tmm_scattering(stored)
Reuses the stored T-matrix blocks to evaluate the far-field scattering response over a two-dimensional receive-angle grid at one stored frequency. This is useful for bistatic scattering maps, heatmaps, and polar-style visualizations without rebuilding the retained modal solve. In the current package build, this helper is available for the spherical and spheroidal stored branches. Stored cylinders intentionally stop at exact monostatic reuse until a validated retained cylinder angular operator is added.
tmm_scattering_grid( object, frequency = NULL, theta_body = NULL, phi_body = NULL, theta_scatter = NULL, phi_scatter = NULL, n_theta = 91, n_phi = 181 )tmm_scattering_grid( object, frequency = NULL, theta_body = NULL, phi_body = NULL, theta_scatter = NULL, phi_scatter = NULL, n_theta = 91, n_phi = 181 )
object |
Scatterer-object previously evaluated with
|
frequency |
Stored frequency (Hz) to evaluate. Required when the object contains more than one stored frequency. |
theta_body |
Incident polar angle (radians). Defaults to the stored TMM incident angle. |
phi_body |
Incident azimuth angle (radians). Defaults to the stored TMM incident angle. |
theta_scatter |
Optional vector of receive polar angles (radians).
Defaults to an evenly spaced grid on |
phi_scatter |
Optional vector of receive azimuth angles (radians).
Defaults to an evenly spaced grid on |
n_theta |
Number of default polar-angle grid points when
|
n_phi |
Number of default azimuth grid points when |
A list containing the stored frequency, the incident angles used to build the grid, the receive-angle vectors, and matrices for the complex scattering amplitude, differential scattering cross section, and its level in dB.
tmm_scattering, tmm_average_orientation
target <- fls_generate( shape = sphere(radius_body = 0.005, n_segments = 20), g_body = 1, h_body = 1 ) stored <- target_strength( target, frequency = 12e3, model = "tmm", boundary = "pressure_release", store_t_matrix = TRUE ) tmm_scattering_grid(stored, n_theta = 5, n_phi = 9)target <- fls_generate( shape = sphere(radius_body = 0.005, n_segments = 20), g_body = 1, h_body = 1 ) stored <- target_strength( target, frequency = 12e3, model = "tmm", boundary = "pressure_release", store_t_matrix = TRUE ) tmm_scattering_grid(stored, n_theta = 5, n_phi = 9)
Shift a Shape object or one geometry-bearing component of a Scatterer
without rebuilding it from scratch. This is most useful for re-centering
profiles, aligning a stored body to a preferred axial origin, or nudging an
internal component before model comparisons.
translate_shape( object, x_offset = 0, y_offset = 0, z_offset = 0, component = NULL, containment = c("warn", "error", "ignore") )translate_shape( object, x_offset = 0, y_offset = 0, z_offset = 0, component = NULL, containment = c("warn", "error", "ignore") )
object |
Shape or Scatterer object. |
x_offset |
Along-axis translation (m). |
y_offset |
Lateral translation (m). This is ignored for profile-style geometries that do not store an explicit lateral centerline. |
z_offset |
Vertical translation (m). |
component |
Optional component name for scatterers. Defaults to the
primary geometry ( |
containment |
Containment policy used when a moved swimbladder or
backbone is checked against its body: |
The modified object, returned as the same broad object type.
reanchor_shape(), offset_component(), brake(), reforge(),
extract()
shape_obj <- cylinder( length_body = 0.05, radius_body = 0.003, n_segments = 40 ) moved_shape <- translate_shape(shape_obj, x_offset = 0.01) range(extract(moved_shape, c("position_matrix", "x")))shape_obj <- cylinder( length_body = 0.05, radius_body = 0.003, n_segments = 40 ) moved_shape <- translate_shape(shape_obj, x_offset = 0.01) range(extract(moved_shape, c("position_matrix", "x")))
Plane wave/plane interface transmission coefficient
transmission_coefficient(interface1, interface2, mode = "DWBA")transmission_coefficient(interface1, interface2, mode = "DWBA")
interface1 |
Dataframe object containing density (kg/m^3) and sound speed (m/s) values for a boundary/interface (1) |
interface2 |
Dataframe object containing density (kg/m^3) and sound speed (m/s) values for a boundary/interface (2) |
mode |
Two options: coefficient calculation for "DWBA" and "KRM" |
Pressure-amplitude transmission coefficient at normal incidence.
seawater <- data.frame(density = 1026, sound_speed = 1480) animal <- data.frame(density = 1050, sound_speed = 1530) transmission_coefficient(seawater, animal)seawater <- data.frame(density = 1026, sound_speed = 1480) animal <- data.frame(density = 1050, sound_speed = 1530) transmission_coefficient(seawater, animal)
Remove a user-defined target-strength model registration
unregister_model(name, remove_persisted = TRUE)unregister_model(name, remove_persisted = TRUE)
name |
Canonical model name or alias. |
remove_persisted |
Logical scalar. When |
Invisibly returns the removed canonical model name.
if (interactive()) { initialize_demo <- function(object, frequency, ...) object solve_demo <- function(object) object register_model( "demo", initialize = initialize_demo, solver = solve_demo ) unregister_model("demo") }if (interactive()) { initialize_demo <- function(object, frequency, ...) object solve_demo <- function(object) object register_model( "demo", initialize = initialize_demo, solver = solve_demo ) unregister_model("demo") }
Calculates the Euclidean norm across each row of a given matrix.
vecnorm( x )vecnorm( x )
x |
A matrix with numeric, real values. |
Calculates the Euclidean norm of a vector.
values <- matrix(c(1, 2, 3), ncol = 3) vecnorm(values) # should yield 3.741657values <- matrix(c(1, 2, 3), ncol = 3) vecnorm(values) # should yield 3.741657
) for a given frequency and sound
speed.Calculates the acoustic wavenumber () for a given frequency and sound
speed in water. The wavenumber is defined as:
where is the frequency (Hz) and is the sound speed
().
The wavenumber describes the spatial frequency of a sound wave and is
fundamental in acoustic calculations.
wavenumber(frequency, sound_speed)wavenumber(frequency, sound_speed)
frequency |
Frequency (f, Hz) |
sound_speed |
Sound speed (c, |
Calculates the acoustic wavenumber (k) based on the sound speed of water.
wavenumber(frequency = 38e3, sound_speed = 1500)wavenumber(frequency = 38e3, sound_speed = 1500)
, and its
respective derivativesComputes the cylindrical Bessel function of the second kind
(), also known as the Neumann function or Weber function, and
its derivatives through ycdk().
yc(l, n) ycdk(l, n, k)yc(l, n) ycdk(l, n, k)
l |
Numeric. The order ( |
n |
Numeric or complex. The argument ( |
k |
Non-negative integer. The order of the derivative for |
The cylindrical Bessel function of the second kind satisfies the same
differential equation as :
but represents the linearly independent second solution.
Supported argument types:
Purely real arguments (, where
):
Fully supported for both positive and negative values.
Purely imaginary arguments (, where
):
Computed using the identity
for ,
where and are modified Bessel functions.
Negative imaginary arguments use complex conjugation for real order.
General complex arguments (, where
and ): Not supported.
Special cases:
(singularity at the origin).
Negative real arguments use the upper lip of the principal branch
cut. For ,
.
For integer order :
.
k-th derivative (DLMF 10.6.1):
Derivative:
A complex vector containing:
yc:
ycdk(..., k = 1): (first derivative)
ycdk(..., k = 2): (second derivative)
ycdk: (k-th derivative)
Abramowitz, M. and Stegun, I.A. (Eds.). (1964). Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. National Bureau of Standards, Applied Mathematics Series 55. Chapter 9.
NIST Digital Library of Mathematical Functions. https://dlmf.nist.gov/
Bessel's equation: https://dlmf.nist.gov/10.2
Negative argument identity (): Eq. 10.4.1 at
https://dlmf.nist.gov/10.4
Imaginary argument identity (): Eq. 10.27.8 at
https://dlmf.nist.gov/10.27
jc for Bessel functions of the first kind,
hc for Hankel functions (third kind),
ys for spherical Bessel functions of the second kind.
# Real argument, integer order yc(0, 1) yc(1, 2.5) # Real argument, fractional order yc(0.5, 3) # Negative real argument yc(2, -1.5) # Purely imaginary argument yc(1, 1i) yc(2, 3i) # Singularity at origin yc(0, 0) # Returns -Inf # First derivative ycdk(1, 2, 1)# Real argument, integer order yc(0, 1) yc(1, 2.5) # Real argument, fractional order yc(0.5, 3) # Negative real argument yc(2, -1.5) # Purely imaginary argument yc(1, 1i) yc(2, 3i) # Singularity at origin yc(0, 0) # Returns -Inf # First derivative ycdk(1, 2, 1)
Calculates Young's modulus (E) from two of the three other elastic moduli:
bulk modulus (K), shear modulus (G), or Poisson's ratio ().
Assumes 3D material properties.
The relationships used are:
young(K = NULL, G = NULL, nu = NULL)young(K = NULL, G = NULL, nu = NULL)
K |
Bulk modulus (Pa). |
G |
Shear modulus (Pa). |
nu |
Poisson's ratio (Dimensionless). |
Young's modulus (E, Pa).
young(K = 2.5e9, G = 1.1e9)young(K = 2.5e9, G = 1.1e9)
, and its
respective derivativesComputes the spherical Bessel function of the second kind (),
also known as the spherical Neumann function, and its k-th derivatives.
ys(l, n) ysdk(l, n, k)ys(l, n) ysdk(l, n, k)
l |
Numeric. The order of the spherical Bessel function. Can be integer or fractional. |
n |
Numeric or matrix. The argument ( |
k |
Non-negative integer. The order of the derivative for |
The spherical Bessel function of the second kind is related to the cylindrical Bessel function by:
where is the cylindrical Bessel function of the second kind.
The spherical Bessel functions satisfy the same differential equation as
:
Special cases:
(singularity at the origin).
Derivatives:
First derivative:
Second derivative:
A numeric vector or matrix (matching the input structure) containing:
ys:
ysd: (k-th derivative)
Abramowitz, M. and Stegun, I.A. (Eds.). (1964). Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. National Bureau of Standards, Applied Mathematics Series 55. Chapter 10.
NIST Digital Library of Mathematical Functions. https://dlmf.nist.gov/
Spherical Bessel functions: https://dlmf.nist.gov/10.47
Relation to cylindrical Bessel functions: Eq. 10.47.4 at https://dlmf.nist.gov/10.47
yc for cylindrical Bessel functions of the second kind,
js for spherical Bessel functions of the first kind,
hs for spherical Hankel functions.
# Spherical Bessel function of the second kind ys(0, 1) ys(1, 2.5) # Fractional order ys(0.5, 3) # Vector input ys(0, c(1, 2, 3)) # Singularity at origin ys(0, 0) # Returns -Inf # First derivative ysdk(1, 2, 1) # Second derivative ysdk(1, 2, 2) # 3rd derivative ysdk(1, 1, 3) # 4th derivative ysdk(1, 1, 4)# Spherical Bessel function of the second kind ys(0, 1) ys(1, 2.5) # Fractional order ys(0.5, 3) # Vector input ys(0, c(1, 2, 3)) # Singularity at origin ys(0, 0) # Returns -Inf # First derivative ysdk(1, 2, 1) # Second derivative ysdk(1, 2, 2) # 3rd derivative ysdk(1, 1, 3) # 4th derivative ysdk(1, 1, 4)