diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/argaze/utils/tobii_segment_data_plot_export.py (renamed from src/argaze/utils/tobii_segment_gaze_plot_export.py) | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/argaze/utils/tobii_segment_gaze_plot_export.py b/src/argaze/utils/tobii_segment_data_plot_export.py index d28bafb..69f88e3 100644 --- a/src/argaze/utils/tobii_segment_gaze_plot_export.py +++ b/src/argaze/utils/tobii_segment_data_plot_export.py @@ -41,14 +41,27 @@ def main(): destination_path = args.segment_path - data_plots_filepath = f'{destination_path}/plots.svg' + # Export into a dedicated time range folder + if args.time_range[1] != None: + timerange_path = f'[{int(args.time_range[0])}s - {int(args.time_range[1])}s]' + else: + timerange_path = f'[all]' + + destination_path = f'{destination_path}/{timerange_path}' + + if not os.path.exists(destination_path): + + os.makedirs(destination_path) + print(f'{destination_path} folder created') + + data_plots_filepath = f'{destination_path}/data_plot.svg' # Load a tobii segment tobii_segment = TobiiEntities.TobiiSegment(args.segment_path, int(args.time_range[0] * 1e6), int(args.time_range[1] * 1e6) if args.time_range[1] != None else None) # Load a tobii segment video tobii_segment_video = tobii_segment.load_video() - print(f'Video properties:\n\tduration: {tobii_segment_video.get_duration() / 1e6} s\n\twidth: {tobii_segment_video.get_width()} px\n\theight: {tobii_segment_video.get_height()} px') + print(f'Video properties:\n\tduration: {tobii_segment_video.duration / 1e6} s\n\twidth: {tobii_segment_video.width} px\n\theight: {tobii_segment_video.height} px') # Load a tobii segment data tobii_segment_data = tobii_segment.load_data() @@ -58,7 +71,7 @@ def main(): print(f'\t{name}: {len(tobii_segment_data[name])} data') # Edit figure - figure_width = min( 4 * tobii_segment_video.get_duration() / 1e6, 56) # maximal width to display: 56 inches at 144 dpi < 2^16 pixels + figure_width = min( 4 * tobii_segment_video.duration / 1e6, 56) # maximal width to display: 56 inches at 144 dpi < 2^16 pixels data_sample = 8064 # 56 inches * 144 dpi = 8064 data can be displayed at max figure = mpyplot.figure(figsize=(figure_width, 35), dpi=144) |