Io
rionid.io
handle_prerionidnpz_data(filename)
Handles legacy PreRionID NPZ files using 'x' and 'y' keys.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Path to the .npz file. |
required |
Returns:
| Type | Description |
|---|---|
tuple
|
(frequency_array, amplitude_array) |
Source code in src/rionid/io.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | |
handle_read_tdsm_bin(path)
Wrapper for reading TDSM binary files and averaging the amplitude.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to the binary file set. |
required |
Returns:
| Type | Description |
|---|---|
tuple
|
(frequency_array, averaged_amplitude_array) |
Source code in src/rionid/io.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
handle_spectrumnpz_data(filename, frequency_key='arr_0', amplitude_key='arr_1', **kwargs)
Handles simple 1D Spectrum NPZ files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Path to the .npz file. |
required |
frequency_key
|
str
|
Key for frequency array. Default 'arr_0'. |
'arr_0'
|
amplitude_key
|
str
|
Key for amplitude array. Default 'arr_1'. |
'arr_1'
|
Returns:
| Type | Description |
|---|---|
tuple
|
(frequency_array, amplitude_array) |
Source code in src/rionid/io.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
handle_tiqnpz_data(filename, frequency_key='arr_0', amplitude_key='arr_2', time_key='arr_1', **kwargs)
Handles standard IQTools NPZ files (Time-Frequency-Amplitude).
This function averages the amplitude over time.
Note: It skips the first 5 time slices (amp[5:,:]) to avoid startup artifacts/shifts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Path to the .npz file. |
required |
frequency_key
|
str
|
Key for frequency array. Default 'arr_0'. |
'arr_0'
|
amplitude_key
|
str
|
Key for amplitude matrix. Default 'arr_2'. |
'arr_2'
|
time_key
|
str
|
Key for time array. Default 'arr_1'. |
'arr_1'
|
Returns:
| Type | Description |
|---|---|
tuple
|
(frequency_array, averaged_amplitude_array) |
Source code in src/rionid/io.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
read_psdata(filename, dbm=False)
Reads generic CSV/TXT spectrum files.
Assumes a pipe-delimited format ('|').
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Path to the file. |
required |
dbm
|
bool
|
If True, reads the 3rd column (index 2). If False, reads the 2nd column (index 1). Default is False. |
False
|
Returns:
| Type | Description |
|---|---|
tuple
|
(frequency_array, amplitude_array) |
Source code in src/rionid/io.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
read_tdsm_bin(path)
Reads custom binary TDSM files (.bin_fre, .bin_time, .bin_amp).
This function expects three files to exist with the same base name but different extensions. It uses memory mapping for the amplitude file to handle large datasets efficiently. It also performs an FFT shift operation (swapping halves) on the frequency and amplitude arrays.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
The file path (extension is ignored, base name is used). |
required |
Returns:
| Type | Description |
|---|---|
tuple
|
(frequency_array, time_array, amplitude_matrix) |
Raises:
| Type | Description |
|---|---|
Exception
|
If files cannot be read or dimensions are inconsistent. |
Source code in src/rionid/io.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
write_arrays_to_ods(file_name, sheet_name, names, *arrays)
Writes data arrays to an OpenDocument Spreadsheet (.ods).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_name
|
str
|
Output filename. |
required |
sheet_name
|
str
|
Name of the sheet to create. |
required |
names
|
list of str
|
List of column headers. |
required |
*arrays
|
list of array-like
|
Variable number of arrays to write as columns. |
()
|
Source code in src/rionid/io.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | |