Skip to content

ValueError: x and y must have same first dimension #6

Description

@OliverFaust

Dear Experts,

Plotting a specific ECG trace produces the following error:
`ValueError: x and y must have same first dimension, but have shapes (511,) and (510,)'

Here is a minimal example to reproduce the error:

import ecg_plot
ecgTrace = [-0.735, -0.754, -0.762, -0.759, -0.771, -0.781, -0.784, -0.786,
       -0.791, -0.791, -0.796, -0.786, -0.769, -0.769, -0.774, -0.774,
       -0.791, -0.828, -0.845, -0.815, -0.796, -0.813, -0.82 , -0.818,
       -0.835, -0.84 , -0.825, -0.818, -0.833, -0.83 , -0.808, -0.801,
       -0.791, -0.771, -0.769, -0.784, -0.811, -0.823, -0.82 , -0.833,
       -0.83 , -0.823, -0.847, -0.862, -0.869, -0.867, -0.815, -0.767,
       -0.781, -0.864, -1.023, -1.113, -1.003, -0.867, -0.847, -0.847,
       -0.828, -0.837, -0.84 , -0.813, -0.806, -0.815, -0.815, -0.818,
       -0.808, -0.781, -0.786, -0.813, -0.806, -0.779, -0.784, -0.808,
       -0.798, -0.757, -0.752, -0.767, -0.732, -0.698, -0.696, -0.669,
       -0.645, -0.647, -0.657, -0.674, -0.698, -0.728, -0.779, -0.815,
       -0.818, -0.845, -0.874, -0.835, -0.818, -0.862, -0.869, -0.854,
       -0.852, -0.813, -0.796, -0.825, -0.82 , -0.801, -0.815, -0.823,
       -0.811, -0.813, -0.815, -0.806, -0.803, -0.82 , -0.828, -0.82 ,
       -0.811, -0.811, -0.82 , -0.82 , -0.808, -0.808, -0.801, -0.791,
       -0.796, -0.798, -0.786, -0.776, -0.774, -0.779, -0.803, -0.84 ,
       -0.842, -0.847, -0.869, -0.837, -0.801, -0.823, -0.833, -0.813,
       -0.813, -0.801, -0.754, -0.669, -0.664, -0.857, -1.069, -1.055,
       -0.891, -0.803, -0.82 , -0.837, -0.825, -0.815, -0.815, -0.808,
       -0.818, -0.818, -0.803, -0.798, -0.791, -0.781, -0.779, -0.776,
       -0.776, -0.764, -0.747, -0.757, -0.759, -0.73 , -0.703, -0.671,
       -0.63 , -0.615, -0.601, -0.579, -0.579, -0.581, -0.591, -0.642,
       -0.667, -0.671, -0.725, -0.757, -0.73 , -0.73 , -0.747, -0.737,
       -0.723, -0.725, -0.735, -0.725, -0.698, -0.696, -0.72 , -0.725,
       -0.715, -0.718, -0.715, -0.71 , -0.725, -0.735, -0.725, -0.725,
       -0.732, -0.728, -0.73 , -0.74 , -0.735, -0.73 , -0.73 , -0.73 ,
       -0.728, -0.72 , -0.72 , -0.723, -0.701, -0.669, -0.652, -0.645,
       -0.642, -0.649, -0.671, -0.686, -0.703, -0.74 , -0.747, -0.71 ,
       -0.72 , -0.745, -0.713, -0.684, -0.696, -0.703, -0.679, -0.613,
       -0.554, -0.615, -0.828, -0.989, -0.916, -0.762, -0.728, -0.737,
       -0.72 , -0.715, -0.696, -0.664, -0.669, -0.691, -0.686, -0.664,
       -0.647, -0.662, -0.684, -0.664, -0.64 , -0.662, -0.664, -0.623,
       -0.625, -0.635, -0.601, -0.579, -0.569, -0.542, -0.508, -0.471,
       -0.464, -0.486, -0.481, -0.471, -0.498, -0.549, -0.596, -0.618,
       -0.618, -0.61 , -0.608, -0.615, -0.618, -0.625, -0.627, -0.61 ,
       -0.598, -0.605, -0.598, -0.581, -0.586, -0.591, -0.586, -0.598,
       -0.598, -0.576, -0.588, -0.608, -0.591, -0.576, -0.559, -0.542,
       -0.562, -0.571, -0.552, -0.544, -0.559, -0.564, -0.562, -0.547,
       -0.542, -0.547, -0.535, -0.52 , -0.508, -0.503, -0.535, -0.569,
       -0.557, -0.562, -0.593, -0.576, -0.535, -0.537, -0.547, -0.549,
       -0.557, -0.518, -0.43 , -0.396, -0.471, -0.618, -0.728, -0.703,
       -0.598, -0.542, -0.525, -0.52 , -0.525, -0.518, -0.498, -0.488,
       -0.498, -0.5  , -0.481, -0.464, -0.471, -0.481, -0.471, -0.449,
       -0.461, -0.466, -0.425, -0.405, -0.425, -0.403, -0.356, -0.332,
       -0.303, -0.295, -0.305, -0.269, -0.234, -0.264, -0.298, -0.313,
       -0.33 , -0.364, -0.396, -0.398, -0.393, -0.413, -0.425, -0.432,
       -0.437, -0.425, -0.405, -0.393, -0.393, -0.41 , -0.4  , -0.374,
       -0.371, -0.371, -0.364, -0.371, -0.371, -0.361, -0.352, -0.356,
       -0.371, -0.383, -0.398, -0.408, -0.388, -0.376, -0.403, -0.413,
       -0.374, -0.349, -0.344, -0.327, -0.337, -0.374, -0.359, -0.315,
       -0.298, -0.298, -0.31 , -0.342, -0.364, -0.376, -0.386, -0.374,
       -0.376, -0.393, -0.359, -0.313, -0.313, -0.303, -0.249, -0.19 ,
       -0.186, -0.327, -0.552, -0.581, -0.396, -0.278, -0.308, -0.327,
       -0.308, -0.303, -0.315, -0.322, -0.32 , -0.308, -0.288, -0.278,
       -0.298, -0.293, -0.254, -0.254, -0.256, -0.225, -0.225, -0.244,
       -0.229, -0.212, -0.19 , -0.154, -0.132, -0.117, -0.095, -0.081,
       -0.061, -0.061, -0.107, -0.146, -0.156, -0.188, -0.229, -0.244,
       -0.244, -0.225, -0.222, -0.242, -0.225, -0.205, -0.227, -0.237,
       -0.222, -0.21 , -0.203, -0.205, -0.195, -0.173, -0.195, -0.227,
       -0.195, -0.171, -0.195, -0.212, -0.193, -0.171, -0.176, -0.183,
       -0.166, -0.181, -0.208, -0.193, -0.19 , -0.198, -0.164, -0.149,
       -0.156, -0.134, -0.132, -0.151, -0.127, -0.115, -0.159, -0.19 ,
       -0.193, -0.198, -0.178, -0.161, -0.178, -0.188, -0.183, -0.203,
       -0.198, -0.146, -0.076, -0.01 , -0.076, -0.315]

ecg_plot.plot_1(ecgTrace, sample_rate=100, title = 'ECG', ecg_amp=1)
ecg_plot.show()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions