Arcsin#

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

Bases: ElementwiseFeature

Apply the arcsine function elementwise.

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

The input must be in the domain [-1, 1]. Values outside this range will produce NaNs or raise runtime warnings or errors, depending on the backend.

Parameters#

feature: Feature | None, optional

The input feature to which the 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 Arcsin

Use with NumPy directly:

>>> import numpy as np
>>>
>>> result = Arcsin()(np.array([0.0, 0.5, 1.0]))
>>> result
array([0.        , 0.52359878, 1.57079633])

Use with PyTorch directly:

>>> import torch
>>>
>>> result = Arcsin()(torch.tensor([0.0, 0.5, 1.0]))
>>> result
tensor([0.0000, 0.5236, 1.5708])

Use in a pipeline with a NumPy value:

>>> value = dt.Value(value=np.array([0.0, 0.5, 1.0]))
>>> pipeline = value >> Arcsin()
>>> result = pipeline()
>>> result
array([0.        , 0.52359878, 1.57079633])

Use in a pipeline with a PyTorch value:

>>> value = dt.Value(value=torch.tensor([0.0, 0.5, 1.0]))
>>> pipeline = value >> Arcsin()
>>> result = pipeline()
>>> result
tensor([0.0000, 0.5236, 1.5708])

These are equivalent to:

>>> pipeline = Arcsin(value)