|
fosanalysis
A framework to evaluate distributed fiber optic sensor data
|
Class for reducing strain data size while keeping the data loss small by combining several values into one value. More...
Public Member Functions | |
| __init__ (self, Aggregate aggregator, int radius=None, int start_pixel=None, int step_size=None, *args, **kwargs) | |
| Initialize the down sampler. | |
| tuple | run (self, np.array x, np.array y, np.array z, tuple radius=None, tuple start_pixel=None, tuple step_size=None) |
| This method downsamples 2D and 1D Strain data using specified parameters. | |
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 | |
| aggregator = aggregator | |
| Aggregator to use, see Aggregate. | |
| radius = radius | |
| Inradius of the window's rectangle. | |
| start_pixel = start_pixel | |
| Index of the first window's central pixel. | |
| step_size = step_size | |
| Step size how far the window moves in one step. | |
Class for reducing strain data size while keeping the data loss small by combining several values into one value.
To achieve this, windows with a specified size (see radius) are placed on the original data in a regular grid of fixed step_size and a fixed start_pixel. Each window is then aggregated to one value, see Aggregate. In contrast to Resampler, the grid is specified by array indices.
Definition at line 221 of file resizing.py.
| fosanalysis.preprocessing.resizing.Downsampler.__init__ | ( | self, | |
| Aggregate | aggregator, | ||
| int | radius = None, | ||
| int | start_pixel = None, | ||
| int | step_size = None, | ||
| * | args, | ||
| ** | kwargs ) |
Initialize the down sampler.
This method can be extended for any necessary initialization logic.
| aggregator | An instance of Aggregate used for aggregation. |
| radius | Inradius of the window's rectangle. |
If radius is an int, all axes will use this radius and the window is a square. For non-square windows, pass a tuple with a radius for each dimension of data_array. Along an axis, the window has a width of \(2r + 1\) for each element \(r\) of radius.
| start_pixel | Index of the first window's central pixel. |
If start_pixel is an int, it is used for all dimensions of data_array. To specify a custom starting element, pass a tuple with a step size for each dimension of data_array. If None, it defaults to radius, the moving window starts with a full slice.
| step_size | Step size how far the window moves in one step. |
If step_size is an int, it is used for all dimensions of data_array. If None, it defaults to \(2r + 1\) for each element \(r\) of radius, which is equivalent to a rolling window.
| *args | Additional positional arguments, will be passed to the superconstructor. |
| **kwargs | Additional keyword arguments, will be passed to the superconstructor. |
Definition at line 231 of file resizing.py.
| tuple fosanalysis.preprocessing.resizing.Downsampler.run | ( | self, | |
| np.array | x, | ||
| np.array | y, | ||
| np.array | z, | ||
| tuple | radius = None, | ||
| tuple | start_pixel = None, | ||
| tuple | step_size = None ) |
This method downsamples 2D and 1D Strain data using specified parameters.
| x | Array of x-axis values. |
| y | Array of time-axis values. |
| z | 2D array of strain data. |
| radius | Inradius of the window's rectangle. |
If radius is an int, all axes will use this radius and the window is a square. For non-square windows, pass a tuple with a radius for each dimension of data_array. Along an axis, the window has a width of \(2r + 1\) for each element \(r\) of radius.
| start_pixel | Index of the first window's central pixel. |
If start_pixel is an int, it is used for all dimensions of data_array. To specify a custom starting element, pass a tuple with a step size for each dimension of data_array. If None, it defaults to radius, the moving window starts with a full slice.
| step_size | Step size how far the window moves in one step. |
If step_size is an int, it is used for all dimensions of data_array. If None, it defaults to \(2r + 1\) for each element \(r\) of radius, which is equivalent to a rolling window.
(target_x_points, target_time_points, new_z). | target_x_points | The x-axis values after downsampling. |
| target_time_points | The time-axis values after downsampling. |
| new_z | Array of downsampled strain data. |
Reimplemented from fosanalysis.preprocessing.base.Base.
Definition at line 270 of file resizing.py.
| fosanalysis.preprocessing.resizing.Downsampler.aggregator = aggregator |
Aggregator to use, see Aggregate.
Definition at line 249 of file resizing.py.
| fosanalysis.preprocessing.resizing.Downsampler.radius = radius |
Inradius of the window's rectangle.
If radius is an int, all axes will use this radius and the window is a square. For non-square windows, pass a tuple with a radius for each dimension of data_array. Along an axis, the window has a width of \(2r + 1\) for each element \(r\) of radius.
Definition at line 257 of file resizing.py.
| fosanalysis.preprocessing.resizing.Downsampler.start_pixel = start_pixel |
Index of the first window's central pixel.
If start_pixel is an int, it is used for all dimensions of data_array. To specify a custom starting element, pass a tuple with a step size for each dimension of data_array. If None, it defaults to radius, the moving window starts with a full slice.
Definition at line 264 of file resizing.py.
| fosanalysis.preprocessing.resizing.Downsampler.step_size = step_size |
Step size how far the window moves in one step.
If step_size is an int, it is used for all dimensions of data_array. If None, it defaults to \(2r + 1\) for each element \(r\) of radius, which is equivalent to a rolling window.
Definition at line 269 of file resizing.py.