import dascore as dc
patch = dc.get_example_patch()
# integrate along time axis, preserve patch shape with indefinite integral
time_integrated = patch.integrate(dim="time", definite=False)
# integrate along distance axis, collapse distance coordinate
dist_integrated = patch.integrate(dim="distance", definite=True)
# integrate along all dimensions.
all_integrated = patch.integrate(dim=None, definite=False)integrate
integrate(
self ,
dim: collections.abc.Sequence[collections.abc.Sequence[str], str, None] ,
definite: bool = False,
)-> ‘Self’
Integrate along a specified dimension using composite trapezoidal rule.
Parameters
| Parameter | Description |
|---|---|
| patch | Patch object for integration. |
| dim |
The dimension(s) along which to integrate. If None, integrate along all dimensions. |
| definite |
If True, consider the integration to be defined from the minimum to the maximum value along specified dimension(s). In essence, this collapses the integrated dimensions to a length of 1. If define is False, the shape of the patch is preserved and a “cumulative” type integration in performed. |
The number of dimensions will always remain the same regardless of definite value. To remove dimensions with length 1, use Patch.squeeze.
Integer and boolean data are converted to float64 before integration. Floating-point and complex data are used without an explicit dtype cast.
The output data_type is mapped through the pairs an integral is known to relate, which are those of differentiate read backwards: along time strain_rate becomes strain and acceleration becomes velocity; along distance strain becomes displacement. An integral the pairs cannot name all the way through clears data_type rather than leaving a stale one on it.
A dimension with missing samples (holes in its step) raises; use split_gaps or fill_gaps first.