function of dascore.transform.strain source

    patch: Patch ,
    step_multiple: int = 2,
    gauge_multiple: None | int[None, int] = None,
    order: int = 2,
)-> ‘PatchType’

Convert velocity DAS data to strain rate using central differences.

When order=2 and step_multiple=2 the derivative for non-edge values is estimated by:

\[ \hat{f}(x) = \frac{f(x + (n/2)dx) - f(x - (n/2)dx)}{n dx} \]

Where \(dx\) is the distance step and \(n\) is the step_multiple. Values for edges are estimate with the appropriate forward/backward stencils so that the shape of the output data match the input data. The equation becomes more complicated for higher order stencils.


Parameter Description
patch A patch object containing DAS data. Note: attrs[‘data_type’] should be
step_multiple The multiples of spatial sampling for the central averaging stencil.
Must be even as odd values result in a staggered grid.
gauge_multiple Deprecated name for step_multiple. Use that instead.
order The order for the finite difference 1st derivative stencil (accuracy).
It must be a multiple of 2


from contextlib import suppress
import dascore as dc
from dascore.exceptions import MissingOptionalDependencyError
patch = dc.get_example_patch("deformation_rate_event_1")

# Example 1
# Estimate the strain rate with a gauge length twice the distance step.
patch_strain = patch.velocity_to_strain_rate(step_multiple=2)

# Example 2
# Estimate the strain rate with a 10th order filter. This will raise
# an exception if the package findiff is not installed.
with suppress(MissingOptionalDependencyError):
    patch_strain = patch.velocity_to_strain_rate(order=10)

# Example 3
# Estimate strain rate with a 4th order filter and gauge length 4 times
# the distance step.
with suppress(MissingOptionalDependencyError):
    patch_strain = patch.velocity_to_strain_rate(step_multiple=4, order=4)

This is primarily used with Terra15 data and simply uses patch.differentiate under the hood to calculate spatial derivatives.

The output gauge length is equal to the step_multiple multuplied by the spacing along the distance coordinate, although the concept of gauge_length is more complex with higher oder filters. See Yang, Shragge, and Jin (2022) for more info.

See the velocity_to_strain_rate note for more details on step_multiple and order effects.

The edgeless version of this function removes potential edge effects and supports even and odd step_multiple values.


Yang, Jihyun, Jeffrey Shragge, and Ge Jin. 2022. “Filtering Strategies for Deformation-Rate Distributed Acoustic Sensing.” Sensors 22 (22): 8777.