Пример #1
0
def atan_func(x: torch.Tensor) -> torch.Tensor:
    r"""arctan object function.

    .. code-block:: python

        return x.atan().div(math.pi).add(0.5)

    Args:
        x (torch.Tensor): The tensor ranging from
            :math:`[-\infty], +\infty]`.
    Returns:
        torch.Tensor: The tensor ranging in ``[0, 1]``
    """
    return x.atan().div(math.pi).add(0.5)
Пример #2
0
def ts2s(ts: Tensor, smax: Tensor) -> Tensor:
    r"""Convert ts ≔ tan(s/s_max⋅π/2) to slew rate

    Usage:
        ``s = ts2s(ts, smax)``
    Inputs:
        - ``ts``: `(N, xyz, nT)`, tan(s/smax*π/2), (-∞, ∞)
        - ``smax``: `(N, xyz)`, max \|slew rate\|, Gauss/cm/Sec.
    Outputs:
        - ``s``: `(N, xyz, nT)`, slew rate, Gauss/cm/Sec.

    See Also:
        :func:`~mrphy.utils.s2ts`
    """
    return ts.atan() / π * 2 * smax[..., None]
Пример #3
0
def atan_func(x: torch.Tensor) -> torch.Tensor:
    return x.atan().div(math.pi).add(0.5)