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

Replace dropouts (NaNs) with values interpolated by the given method. More...

Inheritance diagram for fosanalysis.preprocessing.repair.ScipyInterpolation1D:

Public Member Functions

 __init__ (self, str method="Akima1DInterpolator", dict method_kwargs=None, *args, **kwargs)
 Construct an ScipyInterpolation1D object.
 
tuple run (self, np.array x, np.array y, np.array z, str timespace=None, bool make_copy=True, str method=None, dict method_kwargs=None, *args, **kwargs)
 Replace dropouts (NaNs) with values interpolated by the given method.
 
- Public Member Functions inherited from fosanalysis.preprocessing.base.Task
 __init__ (self, str timespace="1d_space", *args, **kwargs)
 Construct an instance of the class.
 
- Public Member Functions inherited from fosanalysis.preprocessing.base.Base
 __init__ (self, *args, **kwargs)
 Construct an instance of the class.
 
- 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

 method = method
 Name of the interpolation function to use.
 
 method_kwargs = method_kwargs if method_kwargs is not None else {}
 This dictionary contains optional keyword arguments for method.
 
 nanfilter = NaNFilter()
 NaNFilter object used to temporarily remove NaNs.
 
- Public Attributes inherited from fosanalysis.preprocessing.base.Task
 timespace = timespace
 Indicator, which approach is used for operations on a 2d array.
 

Protected Member Functions

tuple _run_1d (self, np.array x, np.array z, str method=None, dict method_kwargs=None, *args, **kwargs)
 Replace dropouts (NaNs) with values interpolated by the given method.
 
tuple _run_2d (self, np.array x, np.array y, np.array z, np.array SRA_array, *args, **kwargs)
 ScipyInterpolation1D has no true 2D operation mode.
 
- Protected Member Functions inherited from fosanalysis.preprocessing.base.Task
tuple _map_2d (self, np.array x, np.array y, np.array z, str timespace=None, *args, **kwargs)
 Apply the 1D operation along either the space or time timespace.
 

Detailed Description

Replace dropouts (NaNs) with values interpolated by the given method.

The following steps are carried out:

  1. The NaN values are removed using NaNFilter. Hence, an extra dropout removal before is not beneficial.
  2. An interpolation function is calulated based on the dropout-free x and z.
  3. The interpolation function is evaluated on the original x.

This is a wrapper for fosanalysis.utils.interpolation.scipy_interpolate1d().

Definition at line 89 of file repair.py.

Constructor & Destructor Documentation

◆ __init__()

fosanalysis.preprocessing.repair.ScipyInterpolation1D.__init__ ( self,
str method = "Akima1DInterpolator",
dict method_kwargs = None,
* args,
** kwargs )

Construct an ScipyInterpolation1D object.

Parameters
methodName of the interpolation function to use.

Defaults to "Akima1DInterpolator". The interpolation function expects two parameters (x and y) and returns a callable. The returned callable should expect only a single parameter (the x_new). According to scipy.interpolate, the following options are available (consult the scipy documentation for details):

  • "interp1d" (legacy)
  • "BarycentricInterpolator"
  • "KroghInterpolator"
  • "PchipInterpolator"
  • "Akima1DInterpolator"
  • "CubicSpline"
  • "make_interp_spline"
  • "make_smoothing_spline"
  • "UnivariateSpline"
  • "InterpolatedUnivariateSpline"
    Parameters
    method_kwargsThis dictionary contains optional keyword arguments for method.
    These are passed to the interpolation function at runtime. It can be used to change the behaviour of that function.
    Parameters
    *argsAdditional positional arguments, will be passed to the superconstructor.
    **kwargsAdditional keyword arguments will be passed to the superconstructor.

Definition at line 100 of file repair.py.

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

Member Function Documentation

◆ _run_1d()

tuple fosanalysis.preprocessing.repair.ScipyInterpolation1D._run_1d ( self,
np.array x,
np.array z,
str method = None,
dict method_kwargs = None,
* args,
** kwargs )
protected

Replace dropouts (NaNs) with values interpolated by the given method.

Parameters
xArray of measuring point positions in accordance to z.
zArray of strain data in accordance to x.
methodName of the interpolation function to use.

Defaults to "Akima1DInterpolator". The interpolation function expects two parameters (x and y) and returns a callable. The returned callable should expect only a single parameter (the x_new). According to scipy.interpolate, the following options are available (consult the scipy documentation for details):

  • "interp1d" (legacy)
  • "BarycentricInterpolator"
  • "KroghInterpolator"
  • "PchipInterpolator"
  • "Akima1DInterpolator"
  • "CubicSpline"
  • "make_interp_spline"
  • "make_smoothing_spline"
  • "UnivariateSpline"
  • "InterpolatedUnivariateSpline"
    Parameters
    method_kwargsThis dictionary contains optional keyword arguments for method.
    These are passed to the interpolation function at runtime. It can be used to change the behaviour of that function.
    Parameters
    *argsAdditional positional arguments, ignored.
    **kwargsAdditional keyword arguments, ignored.
    Returns
    Returns a tuple of like (x, z) of np.arrays of the same shape.

Reimplemented from fosanalysis.preprocessing.base.Task.

Definition at line 156 of file repair.py.

Here is the call graph for this function:

◆ _run_2d()

tuple fosanalysis.preprocessing.repair.ScipyInterpolation1D._run_2d ( self,
np.array x,
np.array y,
np.array z,
np.array SRA_array,
* args,
** kwargs )
protected

ScipyInterpolation1D has no true 2D operation mode.

Set timespace to "1d_space"!

Reimplemented from fosanalysis.preprocessing.base.Task.

Definition at line 183 of file repair.py.

◆ run()

tuple fosanalysis.preprocessing.repair.ScipyInterpolation1D.run ( self,
np.array x,
np.array y,
np.array z,
str timespace = None,
bool make_copy = True,
str method = None,
dict method_kwargs = None,
* args,
** kwargs )

Replace dropouts (NaNs) with values interpolated by the given method.

The following steps are carried out:

  1. The NaN values are removed using NaNFilter. Hence, an extra dropout removal before is not beneficial.
  2. An interpolation function is calulated based on the dropout-free x and z.
  3. The interpolation function is evaluated on the original x.

This is a wrapper for fosanalysis.utils.interpolation.scipy_interpolate1d(). The actual operations are reimplemented in _run_1d() and _run_2d(). This method decides based on the argument, how is operated over the data. If z is a 1D array, the array to pass to _run_1d() is determined:

  1. Use x as the coordinate data, if it matches the shape of z.
  2. Use y as the coordinate data, if it matches the shape of z.
  3. Generate an array with indices of the shape of z.

If z is a 2D array, three option are available, based on timespace: Available options:

  • "2D": Use the native 2D implementation.
  • "1d_space": Use the native 1D implementation, in the space domain. This is repeated for each time stamp in the measurement campaign. An iteration step processes a complete reading of sensor length.
  • "1d_time": Use the native 1D implementation, in the time domain. This is repeated for each gage location along the sensor. An iteration step processes a time series for a sensor position.
Parameters
xArray of measuring point positions.
yArray of time stamps.
zArray of strain data in accordance to x and y.
timespaceIndicator, which approach is used for operations on a 2d array. For more, see timespace. Defaults to timespace.
make_copySwitch, whether a deepcopy of the passed data should be done. Defaults to True.
*argsAdditional positional arguments to customize the behaviour. Will be passed to the chosen method to call.
**kwargsAdditional keyword arguments to customize the behaviour. Will be passed to the chosen method to call.
Returns
Returns a tuple like (x, y, z). They correspond to the input variables of the same name. Each of those might be changed.
Parameters
methodName of the interpolation function to use.

Defaults to "Akima1DInterpolator". The interpolation function expects two parameters (x and y) and returns a callable. The returned callable should expect only a single parameter (the x_new). According to scipy.interpolate, the following options are available (consult the scipy documentation for details):

  • "interp1d" (legacy)
  • "BarycentricInterpolator"
  • "KroghInterpolator"
  • "PchipInterpolator"
  • "Akima1DInterpolator"
  • "CubicSpline"
  • "make_interp_spline"
  • "make_smoothing_spline"
  • "UnivariateSpline"
  • "InterpolatedUnivariateSpline"
    Parameters
    method_kwargsThis dictionary contains optional keyword arguments for method.
    These are passed to the interpolation function at runtime. It can be used to change the behaviour of that function.

Reimplemented from fosanalysis.preprocessing.base.Task.

Definition at line 135 of file repair.py.

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

Member Data Documentation

◆ method

fosanalysis.preprocessing.repair.ScipyInterpolation1D.method = method

Name of the interpolation function to use.

Defaults to "Akima1DInterpolator". The interpolation function expects two parameters (x and y) and returns a callable. The returned callable should expect only a single parameter (the x_new). According to scipy.interpolate, the following options are available (consult the scipy documentation for details):

  • "interp1d" (legacy)
  • "BarycentricInterpolator"
  • "KroghInterpolator"
  • "PchipInterpolator"
  • "Akima1DInterpolator"
  • "CubicSpline"
  • "make_interp_spline"
  • "make_smoothing_spline"
  • "UnivariateSpline"
  • "InterpolatedUnivariateSpline"

Definition at line 130 of file repair.py.

◆ method_kwargs

fosanalysis.preprocessing.repair.ScipyInterpolation1D.method_kwargs = method_kwargs if method_kwargs is not None else {}

This dictionary contains optional keyword arguments for method.

These are passed to the interpolation function at runtime. It can be used to change the behaviour of that function.

Definition at line 134 of file repair.py.

◆ nanfilter

fosanalysis.preprocessing.repair.ScipyInterpolation1D.nanfilter = NaNFilter()

NaNFilter object used to temporarily remove NaNs.

Definition at line 113 of file repair.py.


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