Skip to content

Commit

Permalink
docs formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ckolbPTB committed Jan 22, 2025
1 parent 06a7d91 commit 32317f9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 24 deletions.
4 changes: 2 additions & 2 deletions src/mrpro/operators/FastFourierOp.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def forward(self, x: torch.Tensor) -> tuple[torch.Tensor,]:
Returns
-------
FFT of x
FFT of `x`
"""
y = torch.fft.fftshift(
torch.fft.fftn(torch.fft.ifftshift(*self._pad_op(x), dim=self._dim), dim=self._dim, norm='ortho'),
Expand All @@ -140,7 +140,7 @@ def adjoint(self, y: torch.Tensor) -> tuple[torch.Tensor,]:
Returns
-------
IFFT of y
IFFT of `y`
"""
# FFT
return self._pad_op.adjoint(
Expand Down
2 changes: 1 addition & 1 deletion src/mrpro/operators/FourierOp.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class FourierGramOp(LinearOperator):
"""Gram operator for the Fourier operator.
Implements the adjoint of the forward operator of the Fourier operator, i.e. the gram operator
`F.H@F.
`F.H@F`.
Uses a convolution, implemented as multiplication in Fourier space, to calculate the gram operator
for the toeplitz NUFFT operator.
Expand Down
43 changes: 22 additions & 21 deletions src/mrpro/operators/NonUniformFastFourierOp.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ def __init__(
direction
direction along which non-uniform FFT is applied
recon_matrix
Dimension of the reconstructed image. If this is SpatialDimension only values of directions will be used.
Otherwise, it should be a Sequence of the same length as direction.
Dimension of the reconstructed image. If this is `~mrpro.data.SpatialDimension` only values of directions
will be used. Otherwise, it should be a `Sequence` of the same length as direction.
encoding_matrix
Dimension of the encoded k-space. If this is SpatialDimension only values of directions will be used.
Otherwise, it should be a Sequence of the same length as direction.
Dimension of the encoded k-space. If this is `~mrpro.data.SpatialDimension` only values of directions will
be used. Otherwise, it should be a `Sequence` of the same length as direction.
traj
the k-space trajectories where the frequencies are sampled
The k-space trajectories where the frequencies are sampled.
nufft_oversampling
oversampling used for interpolation in non-uniform FFTs
Oversampling used for interpolation in non-uniform FFTs.
nufft_numpoints
number of neighbors for interpolation in non-uniform FFTs
Number of neighbors for interpolation in non-uniform FFTs.
nufft_kbwidth
size of the Kaiser-Bessel kernel interpolation in non-uniform FFTs
Size of the Kaiser-Bessel kernel interpolation in non-uniform FFTs.
"""
super().__init__()

Expand Down Expand Up @@ -178,7 +178,7 @@ def _separate_joint_dimensions(
Returns
-------
((sep dims along zyx), (permute for zyx), (sep dims along 210), (permute for 210))
`((sep dims along zyx), (permute for zyx), (sep dims along 210), (permute for 210))`
"""
# We did most in _init_ and here we only have to check the other dimensions.
Expand All @@ -205,11 +205,11 @@ def forward(self, x: torch.Tensor) -> tuple[torch.Tensor,]:
Parameters
----------
x
coil image data with shape: (... coils z y x)
coil image data with shape `(... coils z y x)`
Returns
-------
coil k-space data with shape: (... coils k2 k1 k0)
coil k-space data with shape `(... coils k2 k1 k0)`
"""
if len(self._nufft_directions):
# We rearrange x into (sep_dims, joint_dims, nufft_directions)
Expand All @@ -236,11 +236,11 @@ def adjoint(self, x: torch.Tensor) -> tuple[torch.Tensor,]:
Parameters
----------
x
coil k-space data with shape: (... coils k2 k1 k0)
coil k-space data with shape `(... coils k2 k1 k0)`
Returns
-------
coil image data with shape: (... coils z y x)
coil image data with shape `(... coils z y x)`
"""
if len(self._nufft_directions):
# We rearrange x into (sep_dims, joint_dims, nufft_directions)
Expand Down Expand Up @@ -291,7 +291,8 @@ def gram_nufft_kernel(weight: torch.Tensor, trajectory: torch.Tensor, recon_shap
Returns
-------
kernel
real valued convolution kernel for the NUFFT gram operator, already in Fourier space
Real valued convolution kernel for :class:`mrpro.operator.NonUniformFastFourierOpGramOp`, already in Fourier
space.
"""
rank = trajectory.shape[-2]
# Instead of doing one adjoint nufft with double the recon size in all dimensions,
Expand Down Expand Up @@ -328,16 +329,16 @@ def gram_nufft_kernel(weight: torch.Tensor, trajectory: torch.Tensor, recon_shap


class NonUniformFastFourierOpGramOp(LinearOperator):
"""Gram operator for the non-uniform Fast Fourier operator.
"""Gram operator for py:class:`NonUniformFastFourierOp`.
Implements the adjoint of the forward operator of the non-uniform Fast Fourier operator, i.e. the gram operator
`NUFFT.H@NUFFT.
`NUFFT.H@NUFFT`.
Uses a convolution, implemented as multiplication in Fourier space, to calculate the gram operator
for the toeplitz NUFFT operator.
for the Toeplitz NUFFT operator.
This should not be used directly, but rather through the `gram` method of a
:class:`mrpro.operator.NonUniformFastFourierOp` object.
py:class:`NonUniformFastFourierOp` object.
"""

_kernel: torch.Tensor | None
Expand All @@ -348,7 +349,7 @@ def __init__(self, nufft_op: NonUniformFastFourierOp) -> None:
Parameters
----------
nufft_op
the non-uniform Fast Fourier operator to calculate the gram operator for
The py:class:`NonUniformFastFourierOp` to calculate the gram operator for.
"""
super().__init__()
Expand Down Expand Up @@ -389,7 +390,7 @@ def forward(self, x: torch.Tensor) -> tuple[torch.Tensor,]:
Parameters
----------
x
input tensor, shape (..., coils, z, y, x)
input tensor, shape `(..., coils, z, y, x)`
"""
if self.nufft_gram is not None:
(x,) = self.nufft_gram(x)
Expand All @@ -402,7 +403,7 @@ def adjoint(self, x: torch.Tensor) -> tuple[torch.Tensor,]:
Parameters
----------
x
input tensor, shape (..., coils, k2, k1, k0)
input tensor, shape `(..., coils, k2, k1, k0)`
"""
return self.forward(x)

Expand Down

0 comments on commit 32317f9

Please sign in to comment.