|
fosanalysis
A framework to evaluate distributed fiber optic sensor data
|
Change the dimension of an array using aggregate functions (such as mean, median, min or max). More...
Public Member Functions | |
| __init__ (self, str or callable method, module=np, str timespace="1d_space", *args, **kwargs) | |
| Construct an instance of the class. | |
| np.array | reduce (self, np.array data, int axis, *args, **kwargs) |
| Reduce the given array using the kernel funcition. | |
| np.array | run (self, np.array x, np.array y, np.array z, str timespace=None, bool make_copy=True, *args, **kwargs) |
| Reduce a 2D array to a 1D array using aggregate functions. | |
| setup (self, str or callable method, module=np) | |
| Set the kernel method for data processing, which can be either a string representing function name in a given namespace module or a custom callable function. | |
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 | |
| kernel = method if callable(method) else getattr(module, method) | |
| Callable function used to aggregate the data. | |
| method = method | |
Could be either a callable (function object) or a string representing a function name in the namespace of module. | |
| module = module | |
A Python module or namespace in which method is looked up when method is not a callable. | |
| timespace = timespace | |
| Setting, how to compact the 2d array. | |
Change the dimension of an array using aggregate functions (such as mean, median, min or max).
It can be used to reduce 2D to 1D strain data.
Definition at line 34 of file resizing.py.
| fosanalysis.preprocessing.resizing.Aggregate.__init__ | ( | self, | |
| str or callable | method, | ||
| module = np, | |||
| str | timespace = "1d_space", | ||
| * | args, | ||
| ** | kwargs ) |
Construct an instance of the class.
| method | A string or callable representing the method. |
| module | The module (default is numpy). |
| timespace | Setting, how to compact the 2d array. For more, see timespace. |
| *args | Additional positional arguments, will be passed to the superconstructor. |
| **kwargs | Additional keyword arguments, will be passed to the superconstructor. |
Definition at line 40 of file resizing.py.
| np.array fosanalysis.preprocessing.resizing.Aggregate.reduce | ( | self, | |
| np.array | data, | ||
| int | axis, | ||
| * | args, | ||
| ** | kwargs ) |
Reduce the given array using the kernel funcition.
| data | Array of data with functional data according to data. |
| axis | Axis in which the data should be consolidated. This is in accordance with the numpy axis definitions. |
| *args | Additional positional arguments, passed to kernel. |
| **kwargs | Additional keyword arguments, passed to kernel. |
Definition at line 136 of file resizing.py.
| np.array fosanalysis.preprocessing.resizing.Aggregate.run | ( | self, | |
| np.array | x, | ||
| np.array | y, | ||
| np.array | z, | ||
| str | timespace = None, | ||
| bool | make_copy = True, | ||
| * | args, | ||
| ** | kwargs ) |
Reduce a 2D array to a 1D array using aggregate functions.
The aggregate function is implemented in reduce(). The array of the crushed axis is set to np.array(None).
| x | Array of measuring point positions. |
| y | Array of time stamps. |
| z | Array of strain data in accordance to x and y. |
| timespace | Setting, how to compact the 2d array. For more, see 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. |
| **kwargs | Additional keyword arguments to customize the behaviour. |
(x, y, z). They correspond to the input variables of the same name. The resulting shape of the return values depending on timespace is as follows:"timespace" | x | y | z |
|---|---|---|---|
"1d_space" | x | np.array(None) | 1d array, same size as x |
"1d_time" | np.array(None) | y | 1d array, same size as y |
"2d" | np.array(None) | np.array(None) | np.array(float) |
Reimplemented from fosanalysis.preprocessing.base.Base.
Definition at line 90 of file resizing.py.
| fosanalysis.preprocessing.resizing.Aggregate.setup | ( | self, | |
| str or callable | method, | ||
| module = np ) |
Set the kernel method for data processing, which can be either a string representing function name in a given namespace module or a custom callable function.
If "method" is a string, retrieve the corresponding function from the specified module. If "method" is a custom callable function, directly set it as the processing method.
| method | Could be either a callable (function object) or a string representing a function name in the namespace of module. |
| module | A Python module or namespace in which method is looked up when method is not a callable. |
Defaults to Numpy (np).
Definition at line 69 of file resizing.py.
| fosanalysis.preprocessing.resizing.Aggregate.kernel = method if callable(method) else getattr(module, method) |
Callable function used to aggregate the data.
Use setup to set it.
Definition at line 89 of file resizing.py.
| fosanalysis.preprocessing.resizing.Aggregate.method = method |
Could be either a callable (function object) or a string representing a function name in the namespace of module.
Definition at line 83 of file resizing.py.
| fosanalysis.preprocessing.resizing.Aggregate.module = module |
A Python module or namespace in which method is looked up when method is not a callable.
Defaults to Numpy (np).
Definition at line 86 of file resizing.py.
| fosanalysis.preprocessing.resizing.Aggregate.timespace = timespace |
Setting, how to compact the 2d array.
Available options:
"1d_space": (default): Reduce the temporal component and keep the spatial component by aggregating several readings into a single reading. Results in a 1D array of the same size as x."1d_time": Reduce the spatial component and keep the temporal component by aggregating several time series into a single time series. Results in a 1D array of the same size as y."2d": Compact data into a single value. Both spatial and temporal component are reduced. Results in a 0D array with a single element. Definition at line 67 of file resizing.py.