Triggering criteria
get_constant_thresholds(sensor_array, sensor_type, threshold_hysteresis_dict, threshold_category='correct', verbose=False)
Determine the threshold level to use for the constant threshold trigger method.
Parameters
sensor_array : np.ndarray
The time signal to determine the threshold level for.
sensor_type : str
The type of sensor.
threshold_hysteresis_dict : dict[str, float]
The dictionary of threshold levels for each category. The keys must be in the format
"
Returns
Tuple[float, float] The threshold voltage level and hysteresis voltage level.
Raises
ValueError If threshold_category is not one of the following: "low", "correct", "high". ValueError If threshold_category_array contains values outside the range of 0 to 100.
Notes:
This function is modified/developed by Justin Smith using existing bladesight code (see References).
Example Usage:
tacho_threshold_hysteresis_category_dict = { 'tacho OPR threshold correct': 60, 'tacho OPR hysteresis correct': 10, 'tacho MPR threshold correct': 60, 'tacho MPR hysteresis correct': 55, } sensor_type = "Tacho OPR" OPR_signal = np.array([0, 0, 0, 0.2, 0.4, 0.6, 0.8, 1, 1, 1, 0.7, 0.3, 0, 0, 0]) threshold_OPR, hysteresis_OPR = get_constant_thresholds(OPR_signal, sensor_type = sensor_type, threshold_hysteresis_dict = tacho_threshold_hysteresis_category_dict)
(0.6, 0.06)
References
This function is adapted from determine_threshold_level in Chapter 2 of the bladesight tutorial (https://docs.bladesight.com/tutorials/intro_to_btt/ch2/#problem-1-automatic-range-detection). [1] D. H. Diamond, “Introduction to Blade Tip Timing,” Bladesight Learn. Accessed: Feb. 12, 2024. [Online]. Available: docs.bladesight.com
Source code in bladesight/btt/triggering_criteria.py
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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
|
threshold_crossing_hysteresis_falling(arr_t, arr_s, threshold, hysteresis_height, n_est=None)
This function implements the constant threshold triggering method with hysteresis on the falling edge. The hysteresis height is specified in the same units as the signal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
arr_t
|
ndarray
|
The time values of the signal. |
required |
arr_s
|
ndarray
|
The signal to determine the threshold level for. |
required |
threshold
|
float
|
The threshold level to use for the constant threshold triggering method. |
required |
hysteresis_height
|
float
|
The height of the hysteresis. It has the same units as the signal. |
required |
n_est
|
Optional[float]
|
The estimated number of ToAs in this signal. Defaults to None. This number is used to pre-allocate the array containing the ToAs. If this number is not provided, the array will be pre-allocated as the same dimension as arr_t and arr_s. You should specify this value for large signals. |
None
|
Source code in bladesight/btt/triggering_criteria.py
threshold_crossing_hysteresis_rising(arr_t, arr_s, threshold, hysteresis_height, n_est=None)
A sequential threshold crossing algorithm that interpolates the ToA between the two samples where the signal crosses the threshold.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
arr_t
|
ndarray
|
The array containing the time values. |
required |
arr_s
|
ndarray
|
The array containing the signal voltage values corresponding to the time values. |
required |
threshold
|
float
|
The threshold value. |
required |
hysteresis_height
|
float
|
The height of the hysteresis, in the same units as the signal. |
required |
n_est
|
float
|
The estimated number of ToAs in this signal. Defaults to None. This number is used to pre-allocate the array containing the ToAs. If this number is not provided, the array will be pre-allocated as the same dimension as arr_t and arr_s. |
None
|
Returns:
Type | Description |
---|---|
ndarray
|
np.ndarray: An array containing the ToAs. |
Source code in bladesight/btt/triggering_criteria.py
threshold_crossing_interp(arr_t, arr_s, threshold, n_est=None, trigger_on_rising_edge=True)
A sequential threshold crossing algorithm that interpolates the ToA between the two samples where the signal crosses the threshold.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
arr_t
|
ndarray
|
The array containing the time values. |
required |
arr_s
|
ndarray
|
The array containing the signal voltage values corresponding to the time values. |
required |
threshold
|
float
|
The threshold value. |
required |
n_est
|
float
|
The estimated number of ToAs in this signal. Defaults to None. This number is used to pre-allocate the array containing the ToAs. If this number is not provided, the array will be pre-allocated as the same dimension as arr_t and arr_s. |
None
|
trigger_on_rising_edge
|
bool
|
Whether to trigger ToAs on the rising or falling edge. Defaults to True. If True, the ToA is triggered on the rising edge. |
True
|
Returns:
Type | Description |
---|---|
ndarray
|
np.ndarray: An array containing the ToAs. |
Source code in bladesight/btt/triggering_criteria.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 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 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
|