Gas station without pumps

2022 November 17

Holter monitor results

I got back the results from wearing the Holter monitor for 14 days today, and they were not what I expected.  I was expecting to see frequent PVCs, particularly when I was resting or sleeping. Instead the report had almost no PVCs but frequent PACs (premature atrial contractions) with runs of supraventricular tachycardia (runs of more than 3 PACs without normal beats in between).  “Isolated SVEs [supraventricular ectopy] were frequent (10.3%, 114645).” “2161 Supraventricular Tachycardia runs occurred, the run with the fastest interval lasting 6 beats with a max rate of 176 bpm, the longest lasting 26.7 secs with an avg rate of 133 bpm.”

Asymptomatic PACs (like asymptomatic PVCs) do not generally call for any treatment, but “many idiopathic PACs are relatively benign in the short term, although they can be associated with an increased risk of cardiac and all-cause mortality if they occur frequently.” [] Most of the medical treatments seem to be focussed on lowering heart rate or blood pressure, neither of which seem appropriate for me (I have normal blood pressure and a low heart rate). The followup recommended for frequent PACs is an echo cardiogram, which I have now scheduled for mid-January (the soonest date that the clinic had available).

My sinus heart rate was about what I expected with “a min HR of 36 bpm, max HR of 160 bpm, and avg HR of 55 bpm”, though the 36 bpm minimum was a little lower than the 40bpm I expected—my sinus rate drops a little lower when I sleep than I expected. The recording of the 36bpm period does not look like my normal sinus rhythm—it looks like a series of ectopic beats with really tiny QRS complexes to me, but it did occur when I was asleep (in the middle of a period of very low heart rate). On another day, there was a recording of 37 bpm which showed normal QRS complexes, so my sinus rate does indeed drop that low.

The max of 160 bpm occurred when I was exercising fairly hard—pushing myself a bit on bicycling uphill to campus.  It is probably not my real maximum heart rate (I was not doing an all-out effort).  I looked up estimates of maximum heart rate and found three formulas: (220 – age), (207 – 0.7 age), and (211 – 0.64 age).  The first is very common, but clearly wrong for me, the second is adjusted for people over 40 years old and pretty accurately matches the observed maximum on the Holter monitor, and the third is adjusted for active people and may slightly overestimate my max heart rate.  If I ever need to take a stress ECG or stress echocardiogram, I’ll argue for them using the second formula rather than the first in estimating my max heart rate, so that the stress level is appropriately set.

One thing I wanted to know that is not reported in the short summary report from the Holter monitor is whether there was any correlation between the sinus rhythm and the ectopic beats—in particular, I wanted to know whether the ectopic beats occurred primarily when my sinus rhythm was very low.  If that is the case, then a pacemaker set to maintain a minimum sinus rhythm might be a possible treatment, should treatment ever be needed.  I downloaded the full report, which shows when the SVT runs occurred, and they seem to be primarily when I’m awake and active, which is the opposite of what I expected based on my observations of PVCs earlier in the year.

I wasn’t sure how one distinguishes a PAC from a PVC on a one-lead Holter monitor, so I watched a video ( from “Catalyst University”, which showed the difference between PVCs and PACs on a one-lead ECG. The crucial differences are whether the P-wave (from atrial depolarization) is observed and whether the resulting QRS complex is more or less normal or much longer duration that usual.  If the P-wave is observed and the QRS spike is normal duration and shape (though usually lower amplitude), then you have a premature atrial contraction.  If there is no P-wave and the QRS complex is much longer than usual, you have a PVC.  By these criteria, the observations I made earlier (see PVC again, for example) were clearly PVCs, and the examples of SVT runs shown in the report were indeed PACs. My most recent home ECG recordings have not shown me PVCs, but if I now have PACs instead, my inability to find PVCs may represent a change in what my heart is doing, rather than a failure in my rather crude code for detecting them.

I looked for genetic causes of PACs, but have not found much. Deletion of the STK11 gene is the only thing I’ve found so far, and there is no hint of that in my genome—I do have a SNP in an intron of a gene whose protein that interacts with it: STK11IP, as well as some SNPs in the intergenic region upstream of STK11.  None of these SNPs seem likely to be a major cause of problems.

2022 November 4

Holter monitor

Filed under: Uncategorized — gasstationwithoutpumps @ 11:38
Tags: , , , ,

For the past 10 days, I’ve been wearing a Holter monitor made by Zio, in order to determine the real frequency of my premature ventricular complexes (PVCs).

I’ve checked the PVCs myself with my own home-made ECG starting about a year ago, but my ECG can only be used when I’m awake and generally sitting in one place, so it does not catch the full range of my heart activity. Because the amplifier board had to be connected to PteroDAQ running on a breadboard connected to a laptop, the ECG setup is not very portable, and I had to sit still to avoid disturbing the circuitry. I couldn’t even use the laptop to browse the web or read email while recording, since changing my contact with the laptop changed the bias voltage on my body, which the amplifier took a second or two to recover from.  So I only recorded about 5–10 minutes at a time.

Some of my recordings got a lot of PVCs, and some got almost none. I did notice that raising my heart rate through exercise seemed to abolish the PVCs. So I think that my PVCs are “slow-rate-dependent” PVCs—that is, that I only get the extra ventricular contractions when my sinoatrial node does not start frequent enough contractions.  Because my heart rate is most likely lowest when I’m sleeping, the ECGs that I did myself probably missed most of the PVCs.

I mentioned my curiosity about what my real PVC burden was at my annual checkup, so my doctor ordered a 14-day recording with a Holter monitor.

Holter monitors have gotten quite small. This Zio monitor has electrodes about 9cm apart and just sticks onto the chest.

Here is a closeup of the Zio Holter monitor.

The adhesive that holds the Zio on sticks well to dry skin (though it makes my skin itch a bit), but one day this week I got a bit sweaty cycling up to campus in my rain suit, and the monitor started to slide around. It seems to be firmly in place again after my skin dried, but I think it is slightly lower than its original placement.

I have to mail the Zio back to the manufacturer for them to unload the recorded data and send a report to the cardiology department.  I’m hoping that the cardiologist will provide me with the information I’m interested (things like what my minimum heart rate is when I’m sleeping, what the PVC burden is when I’m sleeping and overall, whether my PVCs are indeed slow-rate-dependent, whether there is a minimum heart rate for me above which very few PVCs are seen, … ).

Right now the PVCs are completely asymptomatic, which just means that I can’t tell when I have them without using an ECG. For asymptomatic PVCs, all the treatments are worse than the PVCs, so nothing needs to be done now, but if anything changes, I’ll want to know.  The treatments I’m aware of include ablation of the cells that trigger the premature complex, beta blockers to lower heart rate (not appropriate for slow-rate-dependent PVCs), and electrical pacemakers to start extra heartbeats at the sinoatrial node when the pacemaker cells fail to do so on their own.  I believe that my father had a pacemaker just for that purpose, and I suspect I may be getting one in a decade or so.

2022 April 16

ECG: 2-electrode vs. 3-electrode

Filed under: Circuits course — gasstationwithoutpumps @ 12:23
Tags: , , , ,

In Lower PVC frequency, I said “I did not do direct comparisons of the 2-electrode and 3-electrode configurations—I’ll have to try that sometime soon.” So I did that earlier this week, recording resting ECGs first with a 3-electrode configuration (with the bias electrode on my sternum, halfway between the LA and RA electrodes) and then with a 2-electrode configuration (with the bias wire clipped to the RA electrode).  The 60 Hz noise was slightly higher with the 2-electrode configuration, but after filtering and signal averaging the two recordings were almost identical:


The waveforms after signal averaging were remarkably similar. The PVC burden was also similar (20.1% for the 3-electrode recording and 20.5% for the 2-electrode recording).


The pulse rate from looking at time between spikes worked well for the resting recordings, but the autocorrelation method failed completely, so I did not plot it. The rapid fluctuation in heart rate within a narrow range is real, not an artifact of the algorithm—the heart beats are not perfectly periodic, and the PVCs may be making them even less periodic. The 2-electrode recording probably started a little after 400 seconds—PteroDAQ only time stamps when the file was saved, not what the t=0s time was. I should probably fix PteroDAQ to change that, recording both.


I tried recording a session on the exercise bike also. The PVCs are mainly during resting at the beginning of the session and at the end of a recovery at the end of the session—the PVC burden was only 1.4%.


For the exercise recording, the noise really disrupted the spike-based pulse detection, but did not interfere as much with the autocorrelation-based pulse detection. My peak pulse rate was about 151.5 bpm, by the autocorrelation measure. I’m not sure whether the sudden changes in pulse rate at 100s (when I started pedaling) and around 556s (about 130s into the recovery time) are real or not—the noise in the recording makes it a little difficult to determine the “correct” pulse rate.

The noise during exercise was not 60Hz noise and seemed to vary with whether I was inhaling or exhaling, so I think that it was probably caused by EMG signals from the pectoral muscles or perhaps the diaphragm. The spike detector was clearly missing a lot of the spikes, but making it more sensitive would probably result in false triggering on the EMG noise. I’m wondering whether putting the electrodes on my back, over the scapulae, would reduce the EMG noise, but placing those electrodes and clipping to them would be difficult without an assistant.

The autocorrelation-based pulse detection seems more reliable when exercising, as my pulse is more periodic and has few PVCs, and the autocorrelation method is less susceptible to aperiodic noise.  The spike-based pulse detection seems more reliable when resting, when the pulse is not as periodic and PVCs disrupt the pattern.

I’m also wondering whether a more strenuous exercise session would raise my pulse rate, or whether I’m getting close to my maximum heart rate.  The standard formula for maximum heart rate by age suggests that this may be close to my maximum, but the exercise does not seem all that strenuous, and a couple of years ago I could routinely push to 170 bpm (though perhaps on a device that was an unreliable reporter—it was built into a treadmill at the gym).  So sometime in the next few weeks I’ll try using a higher power output and seeing where my heartbeat tops out.  I’ll probably need to increase the cadence, rather than the resistance, as I’ve been using about 70rpm and 28Nm to get about 205W.  Raising that to 80rpm or even 90rpm is probably easier than increasing the torque.

2022 March 29

Better heartbeat detection

Filed under: Circuits course — gasstationwithoutpumps @ 14:37
Tags: , , , , ,

In Lower PVC frequency, I promised “I’ll report on the algorithms when I get something a little better than I have now.”

I’ve played with three algorithms this week:

  • Doing spike detection, then measuring the time for 2n periods by looking at the time between the spikes n before andafter the current spike.  This gives a fine resolution both in time and frequency, and provides smoothing because adjacent measurements overlap by 2(n-1) periods. It is, however, very susceptible to errors due to miscalling the spikes.  Missed spikes result in too low a frequency, and extraneous spikes result in too high a frequency. I could increase n to reduce the effect of miscounts, but at some loss of time resolution when pulse rate changed.
  • Taking FFT of a block of samples (say 4096, which is about 17 seconds at 240 Hz) and looking for a high energy frequency.  Temporal resolution is poor (even with 50% overlapping blocks we get one measurement every 8.5s) and frequency resolution also poor (bins are about 3.5 bpm wide). I tried improving the frequency resolution by looking at the phase change for the peak between adjacent windows, but that didn’t solve the main problem, which was that choosing the right peak in the spectrum was often difficult.  The simple algorithms I tried for choosing the peak often failed. I eventually gave up on this technique.
  • Taking the autocorrelation of a block of samples (using rfft and irfft) and looking for a peak. The time for that peak is the period, which can be inverted to get the frequency.  This method provides the same coarse time resolution as the FFT method (same size blocks), but has much better frequency resolution, as even the fastest reasonable pulse rate (240bpm or 4Hz) has 60 samples at a sampling rate of 240Hz. I tried accentuating peaks “of the right width” in the autocorrelation by doing some filtering of the autocorrelation, and I tried looking for harmonic errors (where 150bpm might result in a larger peak in the autocorrelation at 75bpm, 50bpm, or 37.5bpm). Even with all the tweaks I could think of, I still had a number of way-off estimates, though median filtering removed most of the anomalies.  Of course, median-of-5 filter makes the time resolution even worse, as median could have come from any of 5 windows (with 50% overlap, that means a time range of 12288 samples or 51.2 seconds!).

I did most of my algorithm testing on one data set (the exercise set from 23 March 2022), and the algorithm is almost certainly overtrained on that data.


Here are both algorithms applied to the two data sets from 23 March. On the exercise set, the autocorrelation method did an excellent job (except right at the end of the run), but the 12-period measure clearly shows missing and extra peaks. On the resting set, the 12-period measurements were very good, but the autocorrelation ones failed at one point, even with median-of-five filtering. The autocorrelation measurements were also consistently somewhat low.


To try to figure out why the autocorrelation estimates of the pulse rate were low, I tried superimposing the filtered ECG signal on the plot. The PVCs are visible as large downward spikes. Having one or more PVCs in the window seems to make the autocorrelation estimates somewhat too low. I still have no explanation for why the autocorrelation measure fails so badly around 50 seconds.

Although the autocorrelation measure makes a nice smooth plot on the exercise data set, I sacrificed a lot of temporal resolution to get that. I think that I would do better to make a more robust spike detector to improve the period-based measurements.

2022 March 24

Lower PVC frequency

Filed under: Circuits course — gasstationwithoutpumps @ 09:58
Tags: , , ,

In PVC: Premature Ventricular Contraction, PVC and pulse, PVC again, and No PVC while exercising I posted some ECG recordings of my heart to show the premature ventricular complexes. Yesterday I tried recording the ECGs again, this time using only 2 electrodes using Lead I (LA–RA) and connecting the bias wire to right-arm electrode.  When I’ve tried that in the past it has not worked well, but with the new amplifier I got reasonably good recording, with only a bit more noise than I usually get with a 3-electrode configuration.  I did not do direct comparisons of the 2-electrode and 3-electrode configurations—I’ll have to try that sometime soon.

The interesting result is that my PVCs seem to be much less frequent now.  In a fairly long (454-second) recording, I had 355 normal spikes and 13 PVCs—a PVC burden of only 3.5%, with a pulse rate of 48.5 bpm.


The resting pulses looked pretty much like other recordings I made (averaged over all the pulses.

I also made a recording while on the bicycle ergometer: 100s just sitting, 400s pedaling moderately hard, and 500s recovering.  There were very few PVCs in that recording also (only 13 detected, for a PVC burden of 0.9%).  The averaging of waveforms across the entire recording did not produce a very useful result, as the heart rate varied from around 45bpm to around 154bpm.  I probably should modify the software to produce averages over just a dozen or so beats, to get the noise reduction without the confounding effect of variation in rate.

My attempt to produce a bpm vs time graph was not very successful—the signal was noisy enough that the spike detection algorithm was occasionally missing a spike or picking up an extra one, so that the method I was using of just inverting the time for n periods resulted in a very noisy graph at the higher heart rates.  I spent most of yesterday looking at two other ways of determining the period—one using the peak in an FFT and phase changes at that peak between overlapping windows and one using peaks in autocorrelation.  None of the three techniques worked well enough to produce a smooth graph, so I’ll probably work on them some more to try to come up with a more robust pulse finder.

I’ll report on the algorithms when I get something a little better than I have now.

Next Page »

%d bloggers like this: