Heart rate calculation from ECG data