deepmr.rss

Contents

deepmr.rss#

deepmr.rss(input, axis=None, keepdim=False)[source]#

Perform root sum-of-squares combination of a signal.

Parameters:
  • input (np.ndarray | torch.Tensor) – Input signal (real- or complex-valued).

  • axis (int, optional) – Combination axis. If None, combine along all dimensions, reducing to a scalar. The default is None.

  • keepdim (bool, optional) – If True, maintain the combined axis as a singleton dimension. The default is False (squeeze the combination axis).

Returns:

output – Real-valued output combined signal.

Return type:

np.ndarray | torch.Tensor

Examples

>>> import torch
>>> import deepmr

Generate an example signal:

>>> signal = torch.ones(10, 4, 4)

We can compute the rss of all signal elements as:

>>> output = deepmr.rss(signal)
>>> output
tensor(12.6491)

We can compute rss along the first axis only (i.e., coil combination) as:

>>> output = deepmr.rss(signal, axis=0)
>>> output.shape
torch.Tensor([4, 4])

The axis can be explicitly maintained instead of squeezed as

>>> output = deepmr.rss(signal, axis=0, keepdim=True)
>>> output.shape
torch.Size([1, 4, 4])