Arcsinh#

class deeptrack.elementwise.Arcsinh(feature: Feature | None = None, **kwargs: Any)#

Bases: ElementwiseFeature

Apply the inverse hyperbolic sine function elementwise.

This feature applies xp.arcsinh to each element in a NumPy array or a PyTorch tensor. It supports both direct input and pipeline composition.

Parameters#

feature: Feature | None, optional

The input feature to which the hyperbolic arcsine function will be applied. If None, the function is applied directly to the input array or tensor.

Examples#

>>> import deeptrack as dt
>>> from deeptrack.elementwise import Arcsinh

Use with NumPy directly:

>>> import numpy as np
>>>
>>> result = Arcsinh()(np.array([-1.0, 0.0, 1.0]))
>>> result
array([-0.88137359,  0.        ,  0.88137359])

Use with PyTorch directly:

>>> import torch
>>>
>>> result = Arcsinh()(torch.tensor([-1.0, 0.0, 1.0]))
>>> result
tensor([-0.8814,  0.0000,  0.8814])

Use in a pipeline with a NumPy value:

>>> value = dt.Value(value=np.array([-1.0, 0.0, 1.0]))
>>> pipeline = value >> Arcsinh()
>>> result = pipeline()
>>> result
array([-0.88137359,  0.        ,  0.88137359])

Use in a pipeline with a PyTorch value:

>>> value = dt.Value(value=torch.tensor([-1.0, 0.0, 1.0]))
>>> pipeline = value >> Arcsinh()
>>> result = pipeline()
>>> result
tensor([-0.8814,  0.0000,  0.8814])

These are equivalent to:

>>> pipeline = Arcsinh(value)