Skip to content

Commit

Permalink
ecg gen: ecg ticks params in config file
Browse files Browse the repository at this point in the history
  • Loading branch information
deepanshi-s committed Jul 11, 2024
1 parent c7409bc commit 27b90f5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions codes/ecg-image-generator/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 4 additions & 2 deletions codes/ecg-image-generator/ecg_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 27b90f5

Please sign in to comment.