processing.fourier
Functions¶
| Name | Description |
|---|---|
| fft | Perform an N-dimensional Fast Fourier Transform (FFT). |
| fftc | Perform a centered N-dimensional FFT. |
| fftshift | Apply fftshift by rolling data and coordinates along the given dimension(s). |
| ifft | Perform an N-dimensional Inverse Fast Fourier Transform (IFFT). |
| ifftc | Perform a centered N-dimensional IFFT. |
| ifftshift | Apply ifftshift by rolling data and coordinates along the given dimension(s). |
fft¶
processing.fourier.fft(da, dim=DIMS.time, out_dim=None)Perform an N-dimensional Fast Fourier Transform (FFT).
Applies an ortho-normalized, unshifted FFT. Metadata and unaffected dimensions are strictly preserved.
Parameters¶
| Name | Type | Description | Default |
|---|---|---|---|
| da | xr.DataArray | The input time-domain DataArray. | required |
| dim | str or list of str | The dimension(s) to transform. Defaults to DIMS.time. | DIMS.time |
| out_dim | str or list of str | The resulting dimension name(s). Must match the length of dim. If None, the original dimension names are retained. | None |
Returns¶
| Name | Type | Description |
|---|---|---|
| xr.DataArray | The frequency-domain DataArray with updated reciprocal coordinates. |
fftc¶
processing.fourier.fftc(da, dim=DIMS.time, out_dim=None)Perform a centered N-dimensional FFT.
This executes an ifftshift -> fft -> fftshift pipeline, which is the
standard in MRI/MRS processing to ensure the 0 Hz frequency remains at
the center of the spectral axis.
Parameters¶
| Name | Type | Description | Default |
|---|---|---|---|
| da | xr.DataArray | The input time-domain DataArray. | required |
| dim | str or list of str | The dimension(s) to transform. Defaults to DIMS.time. | DIMS.time |
| out_dim | str or list of str | The resulting dimension name(s). If None, keeps the original names. | None |
Returns¶
| Name | Type | Description |
|---|---|---|
| xr.DataArray | The centered, frequency-domain DataArray. |
fftshift¶
processing.fourier.fftshift(da, dim)Apply fftshift by rolling data and coordinates along the given dimension(s).
This shifts the zero-frequency component to the center of the spectrum.
Parameters¶
| Name | Type | Description | Default |
|---|---|---|---|
| da | xr.DataArray | The input xarray DataArray. | required |
| dim | str or list of str | The dimension(s) along which to apply the shift. | required |
Returns¶
| Name | Type | Description |
|---|---|---|
| xr.DataArray | A new DataArray with the data and coordinates rolled. |
ifft¶
processing.fourier.ifft(da, dim=DIMS.frequency, out_dim=None)Perform an N-dimensional Inverse Fast Fourier Transform (IFFT).
Applies an ortho-normalized, unshifted IFFT. Metadata and unaffected dimensions are strictly preserved.
Parameters¶
| Name | Type | Description | Default |
|---|---|---|---|
| da | xr.DataArray | The input frequency-domain DataArray. | required |
| dim | str or list of str | The dimension(s) to transform. Defaults to DIMS.frequency. | DIMS.frequency |
| out_dim | str or list of str | The resulting dimension name(s). Must match the length of dim. If None, the original dimension names are retained. | None |
Returns¶
| Name | Type | Description |
|---|---|---|
| xr.DataArray | The time-domain DataArray with updated reciprocal coordinates. |
ifftc¶
processing.fourier.ifftc(da, dim=DIMS.frequency, out_dim=None)Perform a centered N-dimensional IFFT.
This executes an ifftshift -> ifft -> fftshift pipeline, which correctly
inverts a centered frequency-domain spectrum back to the time domain.
Parameters¶
| Name | Type | Description | Default |
|---|---|---|---|
| da | xr.DataArray | The input centered frequency-domain DataArray. | required |
| dim | str or list of str | The dimension(s) to transform. Defaults to DIMS.frequency. | DIMS.frequency |
| out_dim | str or list of str | The resulting dimension name(s). If None, keeps the original names. | None |
Returns¶
| Name | Type | Description |
|---|---|---|
| xr.DataArray | The centered, time-domain DataArray. |
ifftshift¶
processing.fourier.ifftshift(da, dim)Apply ifftshift by rolling data and coordinates along the given dimension(s).
This is the exact inverse of fftshift, moving the zero-frequency component
from the center back to the original position.
Parameters¶
| Name | Type | Description | Default |
|---|---|---|---|
| da | xr.DataArray | The input xarray DataArray. | required |
| dim | str or list of str | The dimension(s) along which to apply the inverse shift. | required |
Returns¶
| Name | Type | Description |
|---|---|---|
| xr.DataArray | A new DataArray with the data and coordinates rolled. |