plot_flight_borders: add flags for flexibility. tm_wheel_parser.py: plot data distribution

This commit is contained in:
Danila Gamkov
2025-08-07 14:13:43 +03:00
parent cf3c9290b0
commit d91039ca21
12 changed files with 820 additions and 202 deletions

View File

@@ -8,17 +8,17 @@ import asotr
reload(asotr)
import pandas as pd
def plot_asotr_borders(path_with_data, ch, asotr_kit, begin, end, font=14, cmd=0, show_flag=True):
def plot_asotr_borders(path_with_data, ch, asotr_kit, begin, end, font=12, cmd=0,
show_flag=False, plot_windows=2, width_=1, time_format='%d.%m.%Y'):
print_width = 20
print_height = 12
width = 1
plot_windows = 2
channels = list(map(int, ch))
pict_name = (f'../plots/reports/ASOTR{asotr_kit}_flight_T_P_{asotr.convert_to_str(channels)}_{begin[0:5].replace(".", "")}_{end[0:5].replace(".", "")}.png')
plot_task = {"temp": 1, "temp_set": 1, "pow": 1}
ox_dtime_format = "%d.%m.%Y"
# ox_dtime_format = "%d.%m.%Y"
ox_dtime_format = time_format
legend = [
"канал 1 (БРД1)",
@@ -29,10 +29,10 @@ def plot_asotr_borders(path_with_data, ch, asotr_kit, begin, end, font=14, cmd=0
"канал 6 (плита МУП МВН)",
]
legend_set = list(map(lambda x: x + " уставка", legend))
width = [1, 1, 1, 1, 1, 1]
width = [width_, width_, width_, width_, width_, width_]
width_set = [3, 3, 3, 3, 3, 3]
marker = ["-", "--", "-.", "-", "-", "--"]
marker = ["-", "-", "-.", "-", "-", "--"]
width_arr = [1, 0.5, 0.2, 0.1, 1, 1]
# get from files and prepare data
@@ -44,7 +44,7 @@ def plot_asotr_borders(path_with_data, ch, asotr_kit, begin, end, font=14, cmd=0
return
if plot_windows == 1:
fig, ax = plt.subplots(figsize=(print_width, print_height), dpi=200)
fig, ax = plt.subplots(figsize=(print_width, print_height), dpi=300)
if plot_task["temp"] == 1:
for i in range(len(channels)):
@@ -72,7 +72,7 @@ def plot_asotr_borders(path_with_data, ch, asotr_kit, begin, end, font=14, cmd=0
elif plot_windows == 2:
fig = plt.figure(figsize=(print_width, print_height), dpi=200)
fig = plt.figure(figsize=(print_width, print_height), dpi=300)
ax1 = fig.add_subplot(2, 1, 1)
ax2 = fig.add_subplot(2, 1, 2, sharex=ax1)
@@ -173,10 +173,20 @@ if __name__ == '__main__':
argparser.add_argument('-f', '--font', required=False,
help='type font size (from 1 to 30)')
argparser.add_argument('-d', '--cmd', required=False,
help='type display commands flag (0/1)')
help='type display commands flag (0 or 1)')
argparser.add_argument('-p', '--plot', required=False,
help='display data in plot flag (0/1)')
help='display data in plot flag (0 or 1)')
argparser.add_argument('-w', '--plotwindows', required=False,
help='plot counts in window (1 or 2)')
argparser.add_argument('-l', '--linewidth', required=False,
help='line width in plot (1, 2, ...)')
argparser.add_argument('-t', '--timeformat', required=False,
help='specify the time format, for example: %d.%m.%Y')
args = argparser.parse_args()
plot_asotr_borders(args.source, args.channel, args.asotr, args.begin, args.end,
args.font, args.cmd, show_flag=args.plot)
# plot_asotr_borders(args.source, args.channel, args.asotr, args.begin, args.end,
# args.font, args.cmd, show_flag=args.plot, plot_windows=int(args.plotwindows),
# width_=int(args.linewidth), time_format = args.timeformat)
plot_asotr_borders(args.source, args.channel, args.asotr, args.begin, args.end)