zea.data.legacy_file¶
Functions
|
Warn and auto-convert focus distances stored in wavelengths to metres. |
|
Convert a dictionary with sortable keys to a sorted list of values. |
|
Infer n_tx from n_frames and n_ax. |
|
Format a legacy |
|
Format probe parameters for legacy file. |
|
Format scan parameters for legacy file. |
- zea.data.legacy_file.check_focus_distances(scan_parameters)[source]¶
Warn and auto-convert focus distances stored in wavelengths to metres.
Some older files store
focus_distancesin wavelengths rather than metres. This helper detects the pattern (values ≥ 1 and â‰inf) and converts them usingsound_speed / center_frequency.- Parameters:
scan_parameters (
dict) – Raw scan parameter dict loaded from HDF5.- Returns:
The same dict, with
focus_distancesconverted when needed.- Return type:
dict
- zea.data.legacy_file.dict_to_sorted_list(dictionary)[source]¶
Convert a dictionary with sortable keys to a sorted list of values.
Note
This function operates on the top level of the dictionary only. If the dictionary contains nested dictionaries, those will not be sorted.
Example
>>> from zea.data.legacy_file import dict_to_sorted_list >>> input_dict = {"number_000": 5, "number_001": 1, "number_002": 23} >>> dict_to_sorted_list(input_dict) [5, 1, 23]
- Parameters:
dictionary (
dict) – The dictionary to convert. The keys must be sortable.- Returns:
The sorted list of values.
- Return type:
list
- zea.data.legacy_file.legacy_data(data)[source]¶
Format a legacy
datadict forDataSpec.In old files spatial maps (
image,image_sc,envelope_data, …) were stored as plain arrays of shape(n_frames, z, x)rather than groups withvalues+coordinates. Wrap each such array as{"values": array}soDataSpecaccepts it. The plain-array fieldsraw_dataandaligned_dataare left untouched.- Return type:
dict