From 27b90f56896c9fc78b05a83ca14844ea2637aa0b Mon Sep 17 00:00:00 2001 From: Deepanshi Date: Thu, 11 Jul 2024 11:31:48 -0400 Subject: [PATCH] ecg gen: ecg ticks params in config file --- codes/ecg-image-generator/config.yaml | 2 ++ codes/ecg-image-generator/ecg_plot.py | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/codes/ecg-image-generator/config.yaml b/codes/ecg-image-generator/config.yaml index 987bcf8..f1396da 100644 --- a/codes/ecg-image-generator/config.yaml +++ b/codes/ecg-image-generator/config.yaml @@ -2,3 +2,5 @@ paper_len: 10.0 abs_lead_step: 10 format_4_by_3: [["I", "II", "III"], ["aVR", "aVL", "aVF", "AVR", "AVL", "AVF"], ["V1", "V2", "V3"], ["V4", "V5", "V6"]] leadNames_12: ["III", 'aVF', 'V3', 'V6', 'II', 'aVL', 'V2', 'V5', 'I', 'aVR', 'V1', 'V4'] +tickLength: 8 +tickSize_step: 0.002 diff --git a/codes/ecg-image-generator/ecg_plot.py b/codes/ecg-image-generator/ecg_plot.py index 28fb3c8..2053e75 100644 --- a/codes/ecg-image-generator/ecg_plot.py +++ b/codes/ecg-image-generator/ecg_plot.py @@ -225,6 +225,8 @@ def ecg_plot( leads_ds = [] leadNames_12 = configs['leadNames_12'] + tickLength = configs['tickLength'] + tickSize_step = configs['tickSize_step'] for i in np.arange(len(lead_index)): current_lead_ds = dict() @@ -360,9 +362,9 @@ def ecg_plot( leads_ds.append(current_lead_ds) if columns > 1 and (i+1)%columns != 0: - sep_x = [len(ecg[leadName])*step + x_offset + dc_offset + x_gap] * round(8*y_grid_dots) + sep_x = [len(ecg[leadName])*step + x_offset + dc_offset + x_gap] * round(tickLength*y_grid_dots) sep_x = np.array(sep_x) - sep_y = np.linspace(y_offset - 4*y_grid_dots*0.002, y_offset + 4*y_grid_dots*0.002, len(sep_x)) + sep_y = np.linspace(y_offset - tickLength/2*y_grid_dots*tickSize_step, y_offset + tickSize_step*y_grid_dots*tickLength/2, len(sep_x)) ax.plot(sep_x, sep_y, linewidth=line_width * 3, color=color_line) #Plotting longest lead for 12 seconds