|
fosanalysis
A framework to evaluate distributed fiber optic sensor data
|
The geometric threshold method (GTM) identifies SRAs by comparing the strain increments to a threshold. More...
Public Member Functions | |
| __init__ (self, float delta_max=400.0, int forward_comparison_range=1, float tolerance=0.0, bool to_left=False, bool activate_reverse_sweep=True, *args, **kwargs) | |
| Construct a GTM object. | |
Public Member Functions inherited from fosanalysis.preprocessing.masking.AnomalyMasker | |
| np.array | run (self, np.array x, np.array y, np.array z, bool make_copy=True, str timespace=None, bool identify_only=False, *args, **kwargs) |
Mask strain reading anomalies with NaNs. | |
Public Member Functions inherited from fosanalysis.utils.base.Task | |
| __init__ (self, *args, **kwargs) | |
Public Member Functions inherited from fosanalysis.utils.base.Base | |
| __init__ (self, *args, **kwargs) | |
| Construct the object and warn about unused/unknown arguments. | |
Public Attributes | |
| activate_reverse_sweep = activate_reverse_sweep | |
| Switch to activate the reverse sweep. | |
| delta_max = delta_max | |
| Maximum plausible absolute strain increment \(\Delta_{\mathrm{max}}\) in [µm/m]. | |
| forward_comparison_range = forward_comparison_range | |
| Number of neighbors to consider in the forward neighbor comparison. | |
| to_left = to_left | |
| Switch for the direction of operation. | |
| tolerance = tolerance | |
| Tolerance ratio for the forward comparison to reaccept a candidate. | |
Protected Member Functions | |
| bool | _compare_forward (self, np.array z, int index, bool to_left) |
| Evaluate, if the candidate keeps its SRA flag by comparing it to its succeeding neighbors. | |
| np.array | _run_1d (self, np.array x, np.array z, np.array SRA_array, int start_index=None, int end_index=None, bool to_left=None, bool reverse_state=False, *args, **kwargs) |
| Flag SRAs between the start and the end index (inclusive). | |
| tuple | _run_2d (self, np.array x, np.array y, np.array z, np.array SRA_array, *args, **kwargs) |
| GTM has no true 2D operation mode. | |
Protected Member Functions inherited from fosanalysis.preprocessing.masking.AnomalyMasker | |
| tuple | _map_2d (self, np.array x, np.array y, np.array z, np.array SRA_array, str timespace=None, *args, **kwargs) |
| Estimate, which entries are strain reading anomalies, in 2D. | |
The geometric threshold method (GTM) identifies SRAs by comparing the strain increments to a threshold.
The implementation is improved upon the algorithm presentend in [1]. Each entry is compared to the most recent entry accepted as plausible. If the strain increment \(\Delta_{\mathrm{max}}\) is exceeded, the entry of the current index will be converted to a dropout by setting it to NaN. Dropouts creating a geometrical distance greater than \(\Delta_{\mathrm{max}}\), would result in contigous dropout fields of extended length. To avoid those dopout field, the current entry is additionally compared to its next finite neighbors. The neighbor comparison uses a variable for the range, which allows the user to set amount of neighbors to be compared. Additional fine tuning can be performed by setting a percentage tolerance, which allows a fraction of total neighbor comparisons to exceed \(\Delta_{\mathrm{max}}\).
Definition at line 102 of file masking.py.
| fosanalysis.preprocessing.masking.GTM.__init__ | ( | self, | |
| float | delta_max = 400.0, | ||
| int | forward_comparison_range = 1, | ||
| float | tolerance = 0.0, | ||
| bool | to_left = False, | ||
| bool | activate_reverse_sweep = True, | ||
| * | args, | ||
| ** | kwargs ) |
Construct a GTM object.
| delta_max | Maximum plausible absolute strain increment \(\Delta_{\mathrm{max}}\) in [µm/m]. For more, see delta_max. |
| forward_comparison_range | Number of neighbors to consider in the forward neighbor comparison. For more, see forward_comparison_range. |
| tolerance | Tolerance ratio for the forward comparison to reaccept a candidate. For more, see tolerance. |
| to_left | Switch for the direction of operation. For more, see to_left. |
| activate_reverse_sweep | Switch to activate the reverse sweep. For more, see activate_reverse_sweep. |
| *args | Additional positional arguments, will be passed to the superconstructor. |
| **kwargs | Additional keyword arguments, will be passed to the superconstructor. |
Definition at line 117 of file masking.py.
|
protected |
Evaluate, if the candidate keeps its SRA flag by comparing it to its succeeding neighbors.
The candidate keeps its flag, if
\[ r_{\mathrm{tol}} \cdot n_{\mathrm{tot}} < n_{\mathrm{ex}} \]
with the tolerance ratio \(r_{\mathrm{tol}}\), the number of considered succeeding neighbors \(n_{\mathrm{tot}}\), which is the minimum of forward_comparison_range and the remaining elements to the end of the the z array, and the number of considered neighbors \(n_{\mathrm{ex}}\), whose absolute difference to the candidate exceeds delta_max.
| z | Array of strain data. |
| to_left | Switch for the direction of operation. For more, see to_left. |
| index | Current index of the flagged entry. |
Definition at line 174 of file masking.py.
|
protected |
Flag SRAs between the start and the end index (inclusive).
| x | Array of measuring point positions in accordance to z. |
| z | Array of strain data in accordance to x. |
| SRA_array | Array of boolean values indicating SRAs by True and a valid entries by False. |
| start_index | Starting index of the method to filter the array. The starting index is assumed not to be an anomalous reading. |
| end_index | Last index to check in this sweep. |
| to_left | Switch for the direction of operation. For more, see to_left. |
| reverse_state | Switch indicating if the sweep method is currently reverse sweeping to set direction. Default value is False. Setting this switch to True supresses recursion. |
| *args | Additional positional arguments, ignored. |
| **kwargs | Additional keyword arguments, ignored. |
Reimplemented from fosanalysis.preprocessing.masking.AnomalyMasker.
Definition at line 214 of file masking.py.
|
protected |
GTM has no true 2D operation mode.
Set timespace to "1d_space"!
Reimplemented from fosanalysis.preprocessing.masking.AnomalyMasker.
Definition at line 277 of file masking.py.
| fosanalysis.preprocessing.masking.GTM.activate_reverse_sweep = activate_reverse_sweep |
Switch to activate the reverse sweep.
Defaults to True A reverse sweep is trigged, whenever a candidate is accepted and the index difference to the previously accepted one is <1.
Definition at line 173 of file masking.py.
| fosanalysis.preprocessing.masking.GTM.delta_max = delta_max |
Maximum plausible absolute strain increment \(\Delta_{\mathrm{max}}\) in [µm/m].
Defaults to 400.0 µm/m.
Definition at line 140 of file masking.py.
| fosanalysis.preprocessing.masking.GTM.forward_comparison_range = forward_comparison_range |
Number of neighbors to consider in the forward neighbor comparison.
Defaults to 1. Whenever an entry is flagged by exceeding delta_max to the most recently trusted entry, a forward neighbor comparison is triggered. Setting this to 0 (zero) deactivates the neighbor comparison. The default parameter combination is equivalent to comparing the candidate to both its direct neighbors:
| Parameter | Value |
|---|---|
| forward_comparison_range | 1 |
| tolerance | 0.0 |
Definition at line 151 of file masking.py.
| fosanalysis.preprocessing.masking.GTM.to_left = to_left |
Switch for the direction of operation.
Defaults to False (from left to right).
Definition at line 168 of file masking.py.
| fosanalysis.preprocessing.masking.GTM.tolerance = tolerance |
Tolerance ratio for the forward comparison to reaccept a candidate.
Defaults to 0.0. Whenever an entry is flagged by exceeding delta_max to the most recently trusted entry, a forward neighbor comparison is triggered. Then, the number of neighbors exceeding delta_max to the candidate is counted. The ratio of this number dividedy by forward_comparison_range is compared to the tolerance ratio. Setting this to 0.0 rejects the point when at least a single neighbor violates delta_max. Setting this to 1.0 would reaccept every point, rendering the whole procedure useless. The default parameter combination is equivalent to comparing the candidate to both its direct neighbors:
| Parameter | Value |
|---|---|
| forward_comparison_range | 1 |
| tolerance | 0.0 |
Definition at line 165 of file masking.py.