utils.data_loaders
utils.data_loaders
Functions¶
| Name | Description |
|---|
| load_mat_file | Load a .mat file and return its contents as a dictionary. |
| load_raw_fids | Load raw FIDs for a series, reading from a cached HDF5 file when available. |
load_mat_file¶
utils.data_loaders.load_mat_file(file_path)
Load a .mat file and return its contents as a dictionary.
Transparently falls back from scipy.io.loadmat (plain v5/v7 files) to
mat73 (v7.3, HDF5-based files) when the former can’t read the file.
Parameters¶
| Name | Type | Description | Default |
|---|
| file_path | Path or str | Path to the .mat file. | required |
Returns¶
| Name | Type | Description |
|---|
| dict | Contents of the .mat file. |
Raises¶
| Name | Type | Description |
|---|
| FileNotFoundError | If file_path does not exist or is not a file. |
| ValueError | If file_path does not have a .mat extension. |
| RuntimeError | If the file can’t be loaded by either scipy or mat73. |
load_raw_fids¶
utils.data_loaders.load_raw_fids(
DATA_FOLDER,
series_id,
load_most_recent=True,
force_override=False,
)
Load raw FIDs for a series, reading from a cached HDF5 file when available.
Parameters¶
| Name | Type | Description | Default |
|---|
| DATA_FOLDER | Path or str | Path to the exam’s data folder. | required |
| series_id | int | Series number to load raw FIDs for. | required |
| load_most_recent | bool | If True, return the most recently created cached *_raw_fids.h5 file instead of re-reading the scan archive. | True |
| force_override | bool | If True, delete and regenerate an existing output HDF5 file rather than returning its cached contents. | False |
Returns¶
| Name | Type | Description |
|---|
| tuple[np.ndarray, Path] | The complex raw FIDs array and the path to the HDF5 file it was loaded from (or written to). |