vendor.bruker
Functions¶
| Name | Description |
|---|---|
| build_fid | Construct a strict xmris FID DataArray from an N-dimensional numpy array. |
| remove_digital_filter | Remove the hardware digital filter group delay from Bruker FID data. |
| reshape_bruker_raw | Reshape a flat Bruker rawdata.job0 array into a squeezed N-dimensional numpy array. |
build_fid¶
vendor.bruker.build_fid(data, dims, pv_params)Construct a strict xmris FID DataArray from an N-dimensional numpy array.
Expected Bruker Parameters in pv_params:¶
PVM_SpecSWH (float): Spectral width in Hz. Used to calculate dwell time.
PVM_RepetitionTime (float): TR in ms. Used to calculate the repetitions coordinate.
PVM_FrqRef (float): Reference Larmor frequency in MHz. (Required for to_ppm)
PVM_FrqWorkPpm (float): Carrier chemical shift in ppm. (Required for to_ppm)
groupDelay (float): Bruker specific FID delay. In
ACQ_RxFilterInfo.
Parameters¶
| Name | Type | Description | Default |
|---|---|---|---|
| data | np.ndarray | The squeezed, N-dimensional complex data array. | required |
| dims | list[str] | The dimension names matching the data axes. Must contain DIMS.time. | required |
| pv_params | dict | The parsed Bruker parameter dictionary. | required |
Returns¶
| Name | Type | Description |
|---|---|---|
| xr.DataArray | A fully compliant DataArray ready for the xmris processing pipeline. |
remove_digital_filter¶
vendor.bruker.remove_digital_filter(
da,
group_delay,
dim='time',
keep_length=True,
)Remove the hardware digital filter group delay from Bruker FID data.
Bruker consoles use a cascade of digital FIR filters during analog-to-digital conversion. Because these filters calculate a moving average, they require time to “wake up”, introducing a causality delay at the start of the Free Induction Decay (FID). This manifests as a time-shift, effectively prepending the actual signal with a specific number of filter transient points (often appearing as a flatline or wavy noise).
If left uncorrected, this time shift causes a massive, rolling first-order phase error in the frequency-domain spectrum.
This function realigns the signal to t=0 by:
Truncating the integer portion of the delay.
Applying a first-order phase correction to exactly compensate for the remaining fractional sub-point delay.
Parameters¶
| Name | Type | Description | Default |
|---|---|---|---|
| da | xr.DataArray | Input free induction decay (FID) data in the time domain. | required |
| group_delay | float | The exact delay value to remove. This should be read directly from the Bruker ACQ_RxFilterInfo parameter array (index 0: ‘groupDelay’)]. Typical values: - ~76.0 for standard high-resolution Spectroscopy. - ~0.0 to 16.0 for Fast Imaging or ZTE (where hardware pre-compensation or short filters are used). | required |
| dim | str | The time dimension along which to apply the correction, by default “time”. | 'time' |
| keep_length | bool | If True, appends pure zeros to the end of the FID to replace the truncated startup points. This ensures the returned DataArray maintains the exact same length as the input (critical for FFT radix sizes), avoiding the confusion of traditional spectral “zero-filling”. By default True. | True |
Returns¶
| Name | Type | Description |
|---|---|---|
| xr.DataArray | The corrected FID data with the filter transient stripped, phase aligned, and lineage metadata preserved. |
reshape_bruker_raw¶
vendor.bruker.reshape_bruker_raw(raw_data_1d, pv_params)Reshape a flat Bruker rawdata.job0 array into a squeezed N-dimensional numpy array.
Bruker stores multi-dimensional data sequentially. This function parses the method parameters to determine the shape, filters out empty dimensions, and reshapes the data to match xmris conventions.
Expected Bruker Parameters in pv_params:¶
PVM_SpecMatrix (int): Number of points in the FID.
PVM_EncNReceivers (int): Number of receive channels (Default: 1).
PVM_NAverages (int): Number of averages (Default: 1).
PVM_NRepetitions (int): Number of repetitions (Default: 1).
Spatial encoding is currently unsupported, we assume:¶
n_slices = 1 # number of slices / slabs n_ph1 = 1 # phase encoding direction A n_ph2 = 1 # phase encoding direction B
Parameters¶
| Name | Type | Description | Default |
|---|---|---|---|
| raw_data_1d | np.ndarray | The flat, 1D complex numpy array loaded directly from the binary file. | required |
| pv_params | dict | The parsed Bruker parameter dictionary. | required |
Returns¶
| Name | Type | Description |
|---|---|---|
| reshaped_data | np.ndarray | The N-dimensional numpy array. |
| valid_dims | list[str] | A list of dimension names matching the axes of reshaped_data. |