|
fosanalysis
A framework to evaluate distributed fiber optic sensor data
|
Replace dropouts (NaNs) with values interpolated by the given method.
More...
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. | |
Replace dropouts (NaNs) with values interpolated by the given method.
The following steps are carried out:
NaN values are removed using NaNFilter. Hence, an extra dropout removal before is not beneficial.x and z.x.This is a wrapper for fosanalysis.utils.interpolation.scipy_interpolate1d().
| fosanalysis.preprocessing.repair.ScipyInterpolation1D.__init__ | ( | self, | |
| str | method = "Akima1DInterpolator", | ||
| dict | method_kwargs = None, | ||
| * | args, | ||
| ** | kwargs ) |
Construct an ScipyInterpolation1D object.
| 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" | method_kwargs | This dictionary contains optional keyword arguments for method. |
| *args | Additional positional arguments, will be passed to the superconstructor. |
| **kwargs | Additional keyword arguments will be passed to the superconstructor. |
Definition at line 100 of file repair.py.
|
protected |
Replace dropouts (NaNs) with values interpolated by the given method.
| x | Array of measuring point positions in accordance to z. |
| z | Array of strain data in accordance to x. |
| 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" | method_kwargs | This dictionary contains optional keyword arguments for method. |
| *args | Additional positional arguments, ignored. |
| **kwargs | Additional keyword arguments, ignored. |
(x, z) of np.arrays of the same shape. Reimplemented from fosanalysis.preprocessing.base.Task.
Definition at line 156 of file repair.py.
|
protected |
ScipyInterpolation1D has no true 2D operation mode.
Set timespace to "1d_space"!
Reimplemented from fosanalysis.preprocessing.base.Task.
| 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:
NaN values are removed using NaNFilter. Hence, an extra dropout removal before is not beneficial.x and z.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:
x as the coordinate data, if it matches the shape of z.y as the coordinate data, if it matches the shape of z.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. | x | Array of measuring point positions. |
| y | Array of time stamps. |
| z | Array of strain data in accordance to x and y. |
| timespace | Indicator, which approach is used for operations on a 2d array. For more, see timespace. Defaults to timespace. |
| make_copy | Switch, whether a deepcopy of the passed data should be done. Defaults to True. |
| *args | Additional positional arguments to customize the behaviour. Will be passed to the chosen method to call. |
| **kwargs | Additional keyword arguments to customize the behaviour. Will be passed to the chosen method to call. |
(x, y, z). They correspond to the input variables of the same name. Each of those might be changed. | 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" | method_kwargs | This dictionary contains optional keyword arguments for method. |
Reimplemented from fosanalysis.preprocessing.base.Task.
Definition at line 135 of file repair.py.
| 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" | fosanalysis.preprocessing.repair.ScipyInterpolation1D.method_kwargs = method_kwargs if method_kwargs is not None else {} |
| fosanalysis.preprocessing.repair.ScipyInterpolation1D.nanfilter = NaNFilter() |