80 lines
2.6 KiB
Python
80 lines
2.6 KiB
Python
import sys
|
|
from importlib import reload
|
|
sys.path.append('/home/danila/Danila/work/MVN/Soft/PID/python/')
|
|
import asotr
|
|
reload(asotr)
|
|
import pandas as pd
|
|
from datetime import datetime, timedelta
|
|
|
|
fname = '/home/danila/Danila/work/MVN/Soft/PID/data/flight/cmd_asotr/all_flight_cmd_asotr.csv'
|
|
fname_cmd_temp = './data/flight_cmd_temp.csv'
|
|
|
|
## get flight commands file (generated by mvn_log_viewer)
|
|
## Translate to human-readeble format and take temperatures from flight commands file
|
|
cmd_list, temperature_list = asotr.get_cmd_data(fname)
|
|
with open('./data/cmd_human.csv', 'w') as file:
|
|
for elem in cmd_list:
|
|
file.write(f'{elem}\n')
|
|
|
|
## temperatures from flight commands file save to file
|
|
with open(fname_cmd_temp, 'w') as file:
|
|
file.write(f'timestamp_sec;timestamp;asotr_kit;ch1;ch2;ch3;ch4;ch5;ch6\r\n')
|
|
for elem in temperature_list:
|
|
file.write(f'{elem}\n')
|
|
|
|
## insert temperatures from flight commands file to main asotr temperatures data files
|
|
df_asotr_ = asotr.insert_temp_data_from_flight_cmd(fname_cmd_temp)
|
|
|
|
|
|
## form timestamp file where minimum of temperatures were registered
|
|
end_date = ''
|
|
for i, data in enumerate(df_asotr_):
|
|
end_date = data['timestamp'].iloc[len(data) - 1][0:18]
|
|
data.to_csv(f'./data/asotr0{i+1}_data_T.csv', index=False, sep=';',
|
|
encoding='utf-8-sig', decimal='.')
|
|
|
|
path_data = '/home/danila/Danila/work/MVN/Soft/asotr_csv/data/'
|
|
timeformat = '%d.%m.%Y %H:%M:%S'
|
|
prev_days = 14
|
|
|
|
delta_date = datetime.strptime(end_date, timeformat) - timedelta(days=prev_days)
|
|
start_date = delta_date.strftime(timeformat)
|
|
|
|
for kit in range(1,3):
|
|
asotr_kit = f'0{kit}'
|
|
print(asotr_kit)
|
|
|
|
_, data_dict = asotr.get_data(path_data, asotr_kit, start_date, end_date, 'minutes')
|
|
|
|
min_temp_ch = []
|
|
for channel in range(1,7):
|
|
ch = f'ch{channel}'
|
|
data1 = data_dict['temp'][ch]
|
|
time1 = data_dict['time_temp']
|
|
|
|
periods_t, periods, _ = asotr.find_periods(time1, data1, shift_flag=False, peaks='min')
|
|
|
|
min_temp_period = []
|
|
for elem in periods_t:
|
|
min_temp_period.append(elem.iloc[0].strftime('%d.%m.%Y %H:%M:%S.%f')[:-3])
|
|
|
|
min_temp_ch.append(min_temp_period)
|
|
|
|
df = pd.DataFrame(min_temp_ch).transpose()
|
|
df.to_csv(f'./data/asotr{asotr_kit}_min_T.csv', header=False, index=False, sep=';',
|
|
encoding='utf-8-sig', decimal='.')
|
|
df1 = pd.read_csv(f'./data/asotr{asotr_kit}_min_T.csv', sep=';',
|
|
names=['ch1','ch2','ch3','ch4','ch5','ch6'])
|
|
df1.to_csv(f'./data/asotr{asotr_kit}_min_T.csv', index=False, sep=';',
|
|
encoding='utf-8-sig', decimal='.')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|