1. modify asotr_csv parser: ASOTR csv files are being supplemented if new data appears. 2. Fix bug in MUP command data parser - now all commands in MUP are decoded.

This commit is contained in:
Danila Gamkov
2025-10-16 11:23:56 +03:00
parent d91039ca21
commit 4968d17d5f
12 changed files with 569 additions and 108 deletions

View File

@@ -14,7 +14,7 @@ ox_date_format = '%d.%m.%Y'
path_itog_brd_data = '../data/brd_data/'
pict_name = '../plots/' + 'MVN_wheel'
font = 16
font = 18
class PathFileNotFound(Exception):
@@ -112,48 +112,62 @@ if __name__ == "__main__":
wheel_df = wheel_df.iloc[1::2]
wheel_df['TIME_period'] = wheel_df['TIME'].diff()
# print(wheel_df)
median_tdiff = wheel_df['TIME_period'].median()
# print(median_tdiff)
median_one = wheel_df['TIME_period'].median()
## discard outliers of the measured wheel period
wheel_df = wheel_df[
(wheel_df['TIME_period'] > median_tdiff - border_clr_wheel) &
(wheel_df['TIME_period'] < median_tdiff + border_clr_wheel)]
wheel_df_clear = wheel_df[
(wheel_df['TIME_period'] > median_one - border_clr_wheel) &
(wheel_df['TIME_period'] < median_one + border_clr_wheel)]
median = wheel_df['TIME_period'].median()
wheel_df_clear1 = wheel_df[
(wheel_df['TIME_period'] > median_one - 0.3) &
(wheel_df['TIME_period'] < median_one + 0.3)]
std = wheel_df_clear['TIME_period'].std(ddof=1)
print(median_one)
print(std)
rows, cols = wheel_df.shape
median = pd.Series([median] * rows)
rows, cols = wheel_df_clear.shape
median = pd.Series([median_one] * rows)
date_format = dates.DateFormatter(ox_date_format)
datetime_format = dates.DateFormatter(ox_dtime_format)
fig, axes = plt.subplots(3, 1, figsize=(18, 20), dpi=300, height_ratios=[1, 1, 1])
fig, axes = plt.subplots(2, 1, figsize=(20, 15), dpi=300, height_ratios=[1, 1])
axes[0].plot(wheel_df['timestamp'], wheel_df['TIME_period'], '.',
markersize=5)
axes[0].plot(wheel_df['timestamp'], median)
axes[0].plot(wheel_df_clear['timestamp'],
wheel_df_clear['TIME_period'], '.', markersize=5)
axes[0].plot(wheel_df_clear['timestamp'], median)
axes[0].set_title("")
axes[0].set_xlabel("Время (ДД.MM.ГГГГ)", fontsize=font)
axes[0].set_ylabel("Полупериод, сек", fontsize=font)
axes[0].set_xlabel("Date", fontsize=font)
axes[0].set_ylabel("Period, sec", fontsize=font)
axes[0].grid(True)
axes[0].xaxis.set_major_formatter(date_format)
axes[0].tick_params(axis="both", width=1, labelsize=font)
axes[1].plot(wheel_df['timestamp'][0:400], wheel_df['TIME_period'][0:400], '.', markersize=10)
axes[1].set_title("")
axes[1].set_xlabel("Время (ЧЧ:ММ)", fontsize=font)
axes[1].set_ylabel("Полупериод, сек", fontsize=font)
axes[1].grid(True)
axes[1].xaxis.set_major_formatter(datetime_format)
axes[1].tick_params(axis="both", width=1, labelsize=font)
# axes[1].plot(wheel_df_clear['timestamp'][0:400],
# wheel_df_clear['TIME_period'][0:400], '.', markersize=10)
# axes[1].set_title("")
# axes[1].set_xlabel("Время (ЧЧ:ММ)", fontsize=font)
# axes[1].set_ylabel("Период, сек", fontsize=font)
# axes[1].grid(True)
# axes[1].xaxis.set_major_formatter(datetime_format)
# axes[1].tick_params(axis="both", width=1, labelsize=font)
sns.histplot(wheel_df['TIME_period'], kde=False, bins=300, ax=axes[2], color='red')
axes[2].set_title("")
axes[2].set_xlabel("Полупериод, сек", fontsize=font)
axes[2].set_ylabel("Частота встречаемости", fontsize=font)
axes[2].grid(True)
axes[2].tick_params(axis="both", width=1, labelsize=font)
sns.histplot(wheel_df_clear1['TIME_period'], kde=False, bins=300, ax=axes[1], color='red')
# sns.kdeplot(wheel_df_clear1['TIME_period'], fill=True, ax=axes[2], color='red')
# axes[2].axvline(median_one, color='red', linestyle='--', label='Медианное')
axes[1].axvline(median_one - 3*std, color='blue', linestyle='--', label='3σ')
axes[1].axvline(median_one + 3*std, color='blue', linestyle='--')
axes[1].set_title("")
axes[1].set_xlabel("Period, sec", fontsize=font)
axes[1].set_ylabel("Number of measurements", fontsize=font)
axes[1].grid(True)
axes[1].legend(fontsize=font)
axes[1].tick_params(axis="both", width=1, labelsize=font)
fig.savefig(pict_name)