fosanalysis
A framework to evaluate distributed fiber optic sensor data
Loading...
Searching...
No Matches
__init__.py
Go to the documentation of this file.
2r"""
3Contains modules for data preprocessing, like:
4- filtering: dealing with noise, e.g. smoothing
5- masking: identification of strain reading anomalies (SRAs),
6- repair: dealing with `NaN`s,
7- resizing: changing the shape of the data arrays.
8
9\author Bertram Richter
10\date 2023
11"""
12
13from abc import abstractmethod
14import copy
15
16import numpy as np
17
18from fosanalysis import utils
19
20from . import base
21from . import filtering
22from . import masking
23from . import repair
24from . import resizing
25
27 r"""
28 Container for several preprocessing task, that are carried out in sequential order.
29 """
30 def __init__(self,
31 tasklist: list,
32 *args, **kwargs):
33 r"""
34 Constructs a Preprocessing object.
35 \param tasklist \copybrief tasklist For more, see \ref tasklist.
36 \param *args Additional positional arguments, will be passed to the superconstructor.
37 \param **kwargs Additional keyword arguments, will be passed to the superconstructor.
38 """
39 super().__init__(*args, **kwargs)
40
43 self.tasklist = tasklist
44 def run(self,
45 x: np.array,
46 y: np.array,
47 z: np.array,
48 make_copy: bool = True,
49 *args, **kwargs) -> np.array:
50 r"""
51 The data is passed sequentially through all preprocessing task objects in \ref tasklist, in that specific order.
52 The output of a previous preprocessing task is used as the input to the next one.
53 \param x Array of measuring point positions.
54 \param y Array of time stamps.
55 \param z Array of strain data in accordance to `x` and `y`.
56 \param make_copy Switch, whether a deepcopy of the passed data should be done.
57 Defaults to `True`.
58 \param *args Additional positional arguments, to customize the behaviour.
59 Will be passed to the `run()` method of all taks objects in \ref tasklist.
60 \param **kwargs Additional keyword arguments to customize the behaviour.
61 Will be passed to the `run()` method of all task objects in \ref tasklist.
62 """
63 x, y, z = super().run(x, y, z, make_copy=make_copy, *args, **kwargs)
64 for task in self.tasklist:
65 x, y, z = task.run(x, y, z, make_copy=False, *args, **kwargs)
66 return x, y, z
Container for several preprocessing task, that are carried out in sequential order.
Definition __init__.py:26
tasklist
List of preprocessing.base.Base sub-class objects.
Definition __init__.py:43
np.array run(self, np.array x, np.array y, np.array z, bool make_copy=True, *args, **kwargs)
The data is passed sequentially through all preprocessing task objects in tasklist,...
Definition __init__.py:49
__init__(self, list tasklist, *args, **kwargs)
Constructs a Preprocessing object.
Definition __init__.py:32
Abstract base class for preprocessing classes.
Definition base.py:16
This intermediate class indicates, that a sub-class is implementing a workflow.
Definition base.py:38