Arccosh#

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

Bases: ElementwiseFeature

Apply the inverse hyperbolic cosine function elementwise.

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

The input must be greater than or equal to 1. Values below this will return NaN or raise errors depending on the backend.

Parameters#

feature: Feature | None, optional

The input feature to which the hyperbolic arccosine 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 Arccosh

Use with NumPy directly:

>>> import numpy as np
>>>
>>> result = Arccosh()(np.array([1.0, 2.0, 3.0]))
>>> result
array([0.        , 1.3169579 , 1.76274717])

Use with PyTorch directly:

>>> import torch
>>>
>>> result = Arccosh()(torch.tensor([1.0, 2.0, 3.0]))
>>> result
tensor([0.0000, 1.3170, 1.7627])

Use in a pipeline with a NumPy value:

>>> value = dt.Value(value=np.array([1.0, 2.0, 3.0]))
>>> pipeline = value >> Arccosh()
>>> result = pipeline()
>>> result
array([0.        , 1.3169579 , 1.76274717])

Use in a pipeline with a PyTorch value:

>>> value = dt.Value(value=torch.tensor([1.0, 2.0, 3.0]))
>>> pipeline = value >> Arccosh()
>>> result = pipeline()
>>> result
tensor([0.0000, 1.3170, 1.7627])

These are equivalent to:

>>> pipeline = Arccosh(value)