Gas station without pumps

2022 July 15

Fifty-seventh weight progress report

Filed under: Uncategorized — gasstationwithoutpumps @ 18:24
Tags: , , , , , , ,

This post is yet another weight progress report, continuing the previous one, part of a long series since I started in January 2015.

I have now been at a normal weight (BMI below 25) for a full year, and my weight has dropped slightly over that year.

Even though I’ve been gradually increasing the upper end of my target range, I’m still quite a bit heavier than the top of that range, hovering just below being overweight. I’d like to get my weight down to the middle of my target range (so around 159 lbs, 13.5 lbs less than I now weigh).

For June and the first half of July 2022, my bike riding averaged only 1 mile/day—a very small amount, as I’ve not even been doing the once-a-week commute to campus. I’ve only gotten on my bike for a few shopping runs (groceries, cases of La Croix water, cat litter, … ).  I’ve averaged about 7.1k steps per day, though—so some of my bicycling has been replaced by walking.  That walking has been mostly in the weekly “secret walk”  with my wife, supplemented with walks with a friend at UCSC who is trying to increase exercise.  I have not been taking photos on all the walks, so many of them have no corresponding blog post.  I’ve also been walking downtown for the farmer’s market and to Food Bin for local grocery shopping, so some of my bicycle utility trips have also been replaced by walking. (Mowing the lawn, which I need to do about every 2 weeks, also gets my step count up.)

2022 June 1

Fifty-sixth weight progress report

This post is yet another weight progress report, continuing the previous one, part of a long series since I started in January 2015.

year-weight-2022-Jun-01

My weight peaked about a year ago, but I managed to get it down out of the “overweight” range fairly quickly. It has been almost constant since then, but I’m hoping that the last month represents a new downward trend.

weight-2022-Jun-01

The longer-term picture shows that the year of staying home because of pandemic restrictions was not good for my weight control. I’m back to a fairly constant weight, but I’d still like to lose at least 10 pounds and preferably 15.

 

For Feb–May 2022, my bike riding averaged 2.26 miles/day—a big improvement over January, but still way down from the days when I bike commuted every day. I rode up to campus at least once a week during Spring quarter (often twice), and I’ve been trying to do more frequent grocery shopping by bike.  Previously I would take my trailer and load up, but now I only do that when my wife needs more cases of La Croix water.  A lot of our grocery shopping is a short walk to the Food Bin, but I’m trying to remember to shop at New Leaf on Tuesdays and Thursdays (senior discount days), to use the gift card we buy to support Alternative Family Education (5% of purchase amount goes to AFE).

I’ve averaged about 5.9k steps/day, mainly from the weekly “secret walk”  with my wife. February and March were particularly low (around 150k steps each month), but in May I got in over 240k steps, second only to last October, when I had about 250k steps.

I didn’t have to give the “project watch” back to Project Baseline yet, as there is one more year of the study.  I thought that there were 4 annual visits, but there are 4 years, so 5 visits (fencepost error on my part!).  Some of the visits were a bit delayed and stripped down because of COVID protocols, but there should be a more complete one next April, to finish things off. I had to delay the Project Baseline onsite visit a bit this time, because I gave blood on Feb 22, and Project Baseline wanted at least a 6-week delay (probably because of the number of vials of blood they take each time for various tests (including undetermined future tests). 

Project Baseline did a fairly full suite of routine blood and urine tests again this April, and everything came back reassuringly (but boringly) normal.

I gave blood again in May, and probably will continue giving blood about 5 times a year.  I used to give blood frequently when I was grad student, but got out of the habit at UCSC, because the blood drives were always at inconvenient locations or times (and the appointments always take a couple hours longer than scheduled, because they are always way behind schedule).  Despite my taking a daily 81mg aspirin, my blood still clots fairly quickly, which sometimes causes problems with getting a full unit (they had to stick a small needle in my other arm this time to get enough blood for testing, as the main needle was completely clogged by the time they got a full unit out).

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:

resting-2022-Apr-13

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).

bpm-resting-2022-Apr-13

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.

exercise-2022-Apr-13

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%.

bpm-exercise-2022-Apr-13

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.

bpm-2022-Mar-23

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.

bpm-resting-2022-Mar-23

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.

Lead-I-2022-Mar-23

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: