asotr_flight/step_response.py

68 lines
2.2 KiB
Python

import pandas as pd
import matplotlib.pyplot as plt
import sys
from importlib import reload
sys.path.append('/home/danila/Danila/work/MVN/Soft/PID/python/')
import asotr
reload(asotr)
import matplotlib.pyplot as plt
from matplotlib import dates
import pandas as pd
from datetime import datetime
asotr_kit = 1
# fname = f'../python_cyclo/data/asotr0{asotr_kit}_data_T.csv'
fname = f'../python_cyclo/data/asotr0{asotr_kit}_data_T.csv'
dateparse = lambda x: datetime.strptime(x, "%d.%m.%Y %H:%M:%S.%f")
data = pd.read_csv(fname, sep=';', parse_dates=['timestamp'], date_parser=dateparse)
# date = '20.03.2025'
# period = '1 мин'
# time_begin_orig = date + ' 17:10:11'
# time_begin1 = date + ' 18:10:17'
# time_begin2 = date + ' 19:10:23'
# step_begin = time_begin2
# duration = 3600
# accuracy = 'seconds'
# name_fig = 'step_response_KDI_20242003.png'
# date = '21.03.2025'
# period = '1 мин'
# time_begin_orig = date + ' 14:00:11'
# time_begin1 = date + ' 15:00:16'
# time_begin2 = date + ' 16:00:16'
# step_begin = time_begin2
# duration = 3600
# accuracy = 'seconds'
# name_fig = 'step_response_KDI_20242103.png'
# date = '24.03.2025'
# period = '1 сек'
# time_begin_orig = date + ' 19:45:11'
# time_begin1 = date + ' 20:45:13'
# time_begin2 = date + ' 21:45:17'
# step_begin = time_begin2
# duration = 3600
# accuracy = 'seconds'
# name_fig = 'step_response_KDI_20242403.png'
interp = {'method': 'polynomial', 'order': 2}
thermocycle_info = {'date': '01.04.2025',
'time_begin': ['01.04.2025 16:27:00', '01.04.2025 18:00:00'],
'duration_sec': 92*60, 'type': 'step'}
cut_step_resp = {'time_step_begin': '01.04.2025 18:53:21', 'step_duration': 25*60}
data_info = {'data': data, 'device': 'KDI', 'channel': 'ch1', 'period': '1 мин',
'find_accuracy': 'seconds'}
name = f'{thermocycle_info["type"]}_response_{data_info["device"]}_{thermocycle_info["date"].replace(".","")}'
plot_info = {'title': 'Реакция на ступенчатое воздействие',
'ox_dtime_format': "%H:%M:%S", 'legend_pos': ['upper left', 'lower left'],
'name_fig': f'{name}.png', 'font': 10}
asotr.plot_step_response_in_thermocycle(data_info, thermocycle_info, interp,
cut_step_resp, plot_info)