feat: добавил фильтрацию сигналов
This commit is contained in:
parent
0fd36bf550
commit
342b2e45a3
@ -3,12 +3,14 @@
|
||||
"source": "/home/smart/PN/TWC/trace/Weld Point",
|
||||
"buffer": "/home/andrei/PycharmProjects/traceDelivery/buffer",
|
||||
"destination": "/home/andrei/Desktop/bla",
|
||||
"apply_filter": false
|
||||
"apply_filter": true,
|
||||
"sigma_filter": 3
|
||||
},
|
||||
{
|
||||
"source": "/home/smart/PN/TWC/trace/test1",
|
||||
"buffer": "/home/andrei/PycharmProjects/traceDelivery/buffer",
|
||||
"destination": "/home/andrei/Desktop/bla",
|
||||
"apply_filter": false
|
||||
"apply_filter": false,
|
||||
"sigma_filter": 3
|
||||
}
|
||||
]
|
@ -1,13 +1,22 @@
|
||||
bcrypt==4.2.0
|
||||
cffi==1.17.1
|
||||
contourpy==1.3.1
|
||||
cryptography==43.0.3
|
||||
cycler==0.12.1
|
||||
fonttools==4.54.1
|
||||
kiwisolver==1.4.7
|
||||
loguru==0.7.2
|
||||
matplotlib==3.9.2
|
||||
numpy==2.1.3
|
||||
packaging==24.2
|
||||
pandas==2.2.3
|
||||
paramiko==3.5.0
|
||||
pillow==11.0.0
|
||||
pycparser==2.22
|
||||
PyNaCl==1.5.0
|
||||
pyparsing==3.2.0
|
||||
python-dateutil==2.9.0.post0
|
||||
pytz==2024.2
|
||||
scipy==1.14.1
|
||||
six==1.16.0
|
||||
tzdata==2024.2
|
||||
|
@ -6,3 +6,4 @@ class SubscriptionObject(NamedTuple):
|
||||
buffer: str
|
||||
destination: str
|
||||
apply_filter: bool
|
||||
sigma_filter: int
|
||||
|
@ -1,7 +1,12 @@
|
||||
import pandas as pd
|
||||
from scipy.ndimage import gaussian_filter1d
|
||||
|
||||
def filter_signal(signal_name: str):
|
||||
...
|
||||
|
||||
def filter_signal(dataframe: pd.DataFrame, sigma: int, *signal_names: str) -> pd.DataFrame:
|
||||
for name in signal_names:
|
||||
smoothed_signal = gaussian_filter1d(dataframe[name], sigma)
|
||||
dataframe[name] = smoothed_signal
|
||||
return dataframe
|
||||
|
||||
def move_signal(signal_name: str):
|
||||
...
|
||||
|
@ -1,9 +1,11 @@
|
||||
from os import path
|
||||
from os import path, remove
|
||||
import shutil
|
||||
|
||||
import pandas as pd
|
||||
|
||||
from tuning.abstraction import AbstractTuner
|
||||
from subscription.subscription_object import SubscriptionObject
|
||||
import tuning.tools
|
||||
import tuning.tools as tools
|
||||
|
||||
|
||||
class Tuner(AbstractTuner):
|
||||
@ -11,11 +13,18 @@ class Tuner(AbstractTuner):
|
||||
def accept(self, subscriber) -> None:
|
||||
subscriber.tuner = self
|
||||
|
||||
@staticmethod
|
||||
def _tune(filepath: str, sigma: int):
|
||||
df = pd.read_csv(filepath)
|
||||
df_filtered = tools.filter_signal(df, sigma, "Electrode Force, N ME", "Electrode Force, N FE")
|
||||
remove(filepath)
|
||||
df_filtered.to_csv(filepath)
|
||||
|
||||
def notify(self, obj: SubscriptionObject, filename: str):
|
||||
local_path = path.join(obj.buffer, filename)
|
||||
destination_path = path.join(obj.destination, filename)
|
||||
|
||||
if obj.apply_filter:
|
||||
...
|
||||
else:
|
||||
shutil.move(src=local_path, dst=destination_path)
|
||||
self._tune(local_path, obj.sigma_filter)
|
||||
|
||||
shutil.move(src=local_path, dst=destination_path)
|
||||
|
Loading…
Reference in New Issue
Block a user