fosanalysis
A framework to evaluate distributed fiber optic sensor data
Loading...
Searching...
No Matches
fosanalysis.preprocessing.masking.GTM Class Reference

The geometric threshold method (GTM) identifies SRAs by comparing the strain increments to a threshold. More...

Inheritance diagram for fosanalysis.preprocessing.masking.GTM:

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ __init__()

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.

Parameters
delta_maxMaximum plausible absolute strain increment \(\Delta_{\mathrm{max}}\) in [µm/m]. For more, see delta_max.
forward_comparison_rangeNumber of neighbors to consider in the forward neighbor comparison. For more, see forward_comparison_range.
toleranceTolerance ratio for the forward comparison to reaccept a candidate. For more, see tolerance.
to_leftSwitch for the direction of operation. For more, see to_left.
activate_reverse_sweepSwitch to activate the reverse sweep. For more, see activate_reverse_sweep.
*argsAdditional positional arguments, will be passed to the superconstructor.
**kwargsAdditional keyword arguments, will be passed to the superconstructor.

Definition at line 117 of file masking.py.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ _compare_forward()

bool fosanalysis.preprocessing.masking.GTM._compare_forward ( self,
np.array z,
int index,
bool to_left )
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.

Parameters
zArray of strain data.
to_leftSwitch for the direction of operation. For more, see to_left.
indexCurrent index of the flagged entry.
Returns
Returns, whether the candidate keeps ist SRA flag.

Definition at line 174 of file masking.py.

Here is the caller graph for this function:

◆ _run_1d()

np.array fosanalysis.preprocessing.masking.GTM._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 )
protected

Flag SRAs between the start and the end index (inclusive).

Parameters
xArray of measuring point positions in accordance to z.
zArray of strain data in accordance to x.
SRA_arrayArray of boolean values indicating SRAs by True and a valid entries by False.
start_indexStarting index of the method to filter the array. The starting index is assumed not to be an anomalous reading.
end_indexLast index to check in this sweep.
to_leftSwitch for the direction of operation. For more, see to_left.
reverse_stateSwitch indicating if the sweep method is currently reverse sweeping to set direction. Default value is False. Setting this switch to True supresses recursion.
*argsAdditional positional arguments, ignored.
**kwargsAdditional keyword arguments, ignored.

Reimplemented from fosanalysis.preprocessing.masking.AnomalyMasker.

Definition at line 214 of file masking.py.

Here is the call graph for this function:

◆ _run_2d()

tuple fosanalysis.preprocessing.masking.GTM._run_2d ( self,
np.array x,
np.array y,
np.array z,
np.array SRA_array,
* args,
** kwargs )
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.

Member Data Documentation

◆ activate_reverse_sweep

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.

◆ delta_max

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.

◆ forward_comparison_range

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.

◆ to_left

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.

◆ tolerance

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.


The documentation for this class was generated from the following file: