Skip to content

Commit ed09593

Browse files
author
Max Czapanskiy
committed
Draft v3
1 parent ad4e6ec commit ed09593

File tree

12 files changed

+54
-22
lines changed

12 files changed

+54
-22
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
.DS_Store
66
analysis/*/*_cache/*
77
analysis/*/*_files/*
8+
analysis/supplementary-materials/movieS1-CATS-placement-fullres.mov

analysis/figures/brady-relax-1.png

-214 KB
Binary file not shown.

analysis/figures/bw-bcg-1.png

90.9 KB
Loading

analysis/figures/bw-profile-1.png

-255 KB
Binary file not shown.

analysis/figures/oo-bcg-ecg-1.png

-9.96 KB
Loading

analysis/figures/psd-plot-1.png

-170 KB
Binary file not shown.
80.9 KB
Binary file not shown.

analysis/paper/paper.Rmd

Lines changed: 47 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ Here we present a method for generating a BCG from bio-logger accelerometry. We
7171

7272
**Killer whale**
7373

74-
A 3807 kg (**needs confirmation**) killer whale in managed care at the SeaWorld, San Diego, CA marine facilities was double-tagged with Customized Animal Tracking Solutions IMU (CATS, www.cats.is) and electrocardiogram (ECG) tags on August 16, 2021 as part of clinical animal cardiac evaluations under the SeaWorld display permit. The CATS tag recorded acceleration at 400 Hz, magnetometer and gyroscope at 50 Hz, pressure at 10 Hz, and video at 30 fps. All sensors were rotated from the tag's frame of reference to that of the whale using MATLAB (MathWorks, Inc., v2020b) tools for processing CATS data [@cadeToolsIntegratingInertial2021]. This rotation aligned the tag's x-, y-, and z- axes with the cranio-caudal, lateral, and dorso-ventral axes of the whale, respectively. The ECG tag hardware and data processing followed the methods in [@bickettHeartRatesHeart2019]. Briefly, we attached the tag on the mid-lateral left chest posterior to the pectoral fin and recorded ECG at 100 Hz. Individual heart beats were identified from visually verified R-waves using a customized peak detection program (K. Ponganis; Origin 2017, OriginLab Co., Northampton, MA). ECG and IMU were recorded during a spontaneous breath hold while the whale rested at the surface.
74+
A 3807 kg (**needs confirmation**) killer whale in managed care at the SeaWorld, San Diego, CA marine facilities was double-tagged with Customized Animal Tracking Solutions IMU (CATS, www.cats.is) and electrocardiogram (ECG) tags on August 16, 2021 as part of clinical animal cardiac evaluations under the SeaWorld display permit. We attached the CATS tag on the mid-lateral left chest posterior to the pectoral fin (Movie S1). The CATS tag recorded acceleration at 400 Hz, magnetometer and gyroscope at 50 Hz, pressure at 10 Hz, and video at 30 fps. All sensors were rotated from the tag's frame of reference to that of the whale using MATLAB (MathWorks, Inc., v2020b) tools for processing CATS data [@cadeToolsIntegratingInertial2021]. This rotation aligned the tag's x-, y-, and z- axes with the cranio-caudal, lateral, and dorso-ventral axes of the whale, respectively. The ECG tag hardware and data processing followed the methods in [@bickettHeartRatesHeart2019]. Briefly, the tag was attached approximately midline on the ventral chest just caudal (posterior) to the axilla and we recorded the ECG at 100 Hz. Individual heart beats were identified from visually verified R-waves using a customized peak detection program (K. Ponganis; Origin 2017, OriginLab Co., Northampton, MA). ECG and IMU were recorded during a spontaneous breath hold while the whale rested at the surface.
7575

7676
**Blue whale**
7777

78-
A 24.5 m blue whale was tagged with a CATS IMU tag on September 5, 2018 in Monterey Bay, CA under permits MBNMS-MULTI-2017-007, NMFS 21678, and Stanford University IACUC 30123 (previously published in [@goughScalingSwimmingPerformance2019]). Tag configuration and data processing followed the same procedure as the killer whale, with one addition. The 400 Hz acceleration data was used for ballistocardiography (see section **Signal processing**), but we also downsampled the multi-sensor data to 10 Hz for movement analysis using the MATLAB CATS tools.
78+
A 24.5 m blue whale was tagged with a CATS IMU tag on September 5, 2018 in Monterey Bay, CA under permits MBNMS-MULTI-2017-007, NMFS 21678, and Stanford University IACUC 30123 (previously published in [@goughScalingSwimmingPerformance2019]). The tag slid behind the left pectoral flipper, similar to the placement of the CATS tag on the killer whale. Tag configuration and data processing followed the same procedure as the killer whale. The 400 Hz acceleration data was used for ballistocardiography (see section **Signal processing**). We downsampled the multi-sensor data to 10 Hz for movement analysis using the MATLAB CATS tools.
7979

8080
## Signal processing
8181

@@ -156,7 +156,7 @@ bpm_lm <- lm(bcg_bpm ~ ecg_bpm, ecg_bpm)
156156
bpm_stderr <- sqrt(diag(vcov(bpm_lm)))
157157
```
158158

159-
The ECG and BCG yielded nearly identical heart rate estimations (Fig. \@ref(fig:oo-bcg-ecg)). We collected 14 s of simultaneous ECG and BCG data during a motionless, submerged breath hold. BCG-derived instantaneous heart rates were within `r sprintf("%0.1f%% \u00B1 %0.1f%%", mean_bpm_diff * 100, sd_bpm_diff * 100)` of the ECG-derived rates (mean ± standard deviation). Ordinary least squares regression of BCG heartrates on ECG heartrates yielded a slope of `r sprintf("%0.2f \u00B1 %0.2f", coef(bpm_lm)[2], bpm_stderr[2])` and intercept of `r sprintf("%0.2f \u00B1 %0.2f", coef(bpm_lm)[1], bpm_stderr[1])` (mean ± standard error), which were not significantly different from the hypothesized 1 and 0, respectively.
159+
The ECG and BCG yielded nearly identical heart rate estimations (Fig. \@ref(fig:oo-bcg-ecg)). We collected 14 s of simultaneous ECG and BCG data during a motionless breath hold at the surface. BCG-derived instantaneous heart rates were within `r sprintf("%0.1f%% \u00B1 %0.1f%%", mean_bpm_diff * 100, sd_bpm_diff * 100)` of the ECG-derived rates (mean ± standard deviation). Ordinary least squares regression of BCG heartrates on ECG heartrates yielded a slope of `r sprintf("%0.2f \u00B1 %0.2f", coef(bpm_lm)[2], bpm_stderr[2])` and intercept of `r sprintf("%0.2f \u00B1 %0.2f", coef(bpm_lm)[1], bpm_stderr[1])` (mean ± standard error), which were not significantly different from the hypothesized 1 and 0, respectively.
160160

161161
## BCG application to blue whale
162162

@@ -289,8 +289,24 @@ Here we presented a ballistocardiogram method for detecting resting apneic heart
289289
- Everyone who helped collect and process the blue whale data.
290290
- The Sea World trainers.
291291
- Anna Krystalli, Ben Marwick, Karthik Ram, Nicholas Tierney, and other members of the open science R community for developing tools and educational resources that facilitate open science practices.
292-
- Funding from Office of Naval Research N000141912455, Stanford Terman Fellowship
293-
- M. F. Czapanskiy was supported by the Stanford University William R. and Sara Hart Kimball Fellowship and a Stanford Data Science Scholar Fellowship.
292+
293+
# Footnotes
294+
295+
## Author contributions
296+
297+
Conceptualization: M.F.C.,J.A.F.,P.J.P.,J.A.G.; Methodology: M.F.C.,J.A.F.,P.J.P.; Software: M.F.C.; Formal analysis: M.F.C.,P.J.P.; Investigation: M.F.C.,J.A.F.,P.J.P.; Resources: P.J.P.,J.A.G.; Writing - original draft: M.F.C; Writing - review & editing: M.F.C.,J.A.F.,P.J.P.,J.A.G.; Supervision: P.J.P.,J.A.G.; Project administration: P.J.P.,J.A.G.; Funding acquisition: J.A.G.
298+
299+
## Funding
300+
301+
This work was supported by grant N000141912455 from the Office of Naval Research. M.F.C. was supported by the Stanford University William R. and Sara Hart Kimball Fellowship and a Stanford Data Science Scholar Fellowship.
302+
303+
## Data availability
304+
305+
All data and code used in this analysis are available on Zenodo (DOI needed).
306+
307+
## Competing interests
308+
309+
The authors declare no competing interests.
294310

295311
\newpage
296312

@@ -303,7 +319,8 @@ t <- theme_classic() +
303319
strip.background = element_blank())
304320
t_yvoid <- t +
305321
theme(axis.text.y = element_blank(),
306-
axis.ticks.y = element_blank())
322+
axis.ticks.y = element_blank(),
323+
strip.text = element_blank())
307324
308325
# A: ECG
309326
ecg_sample <- corky_ecg %>%
@@ -349,21 +366,21 @@ pB <- ggplot(oo_400hz, aes(dt, surge_filt)) +
349366
lty = 3) +
350367
scale_x_datetime(date_labels = "%H:%M:%S") +
351368
expand_limits(y = 0.5) +
352-
labs(y = "Cranio-caudal acceleration (filtered)") +
369+
labs(y = "Acceleration\n(filtered)") +
353370
t_yvoid
354371
355372
# C: Surge diff
356373
pC <- ggplot(oo_400hz, aes(dt, surge_diff)) +
357374
geom_line(size = 0.2) +
358375
scale_x_datetime(date_labels = "%H:%M:%S") +
359-
labs(y = "Cranio-caudal jerk") +
376+
labs(y = "Jerk") +
360377
t_yvoid
361378
362379
# D: Shannon entropy
363380
pD <- ggplot(oo_400hz, aes(dt, surge_se)) +
364381
geom_line(size = 0.2) +
365382
scale_x_datetime(date_labels = "%H:%M:%S") +
366-
labs(y = "Shannon entropy") +
383+
labs(y = "Shannon\nentropy") +
367384
t_yvoid
368385
369386
# E: Smoothed
@@ -382,12 +399,13 @@ cowplot::plot_grid(pA, pB, pC, pD, pE,
382399
labels = "AUTO")
383400
```
384401

385-
```{r bw-bcg, fig.cap="Example of signal processing for 3-dimensional BCG during a motionless period in a blue whale dive. **A**: Band-pass filtered triaxial acceleration, where surge is along the cranio-caudal axis, sway is along the lateral axis, and heave is along the dorso-ventral axis. **B**: Differencing the filtered acceleration enhances peaks. **C**: Calculating the Shannon entropy combines information from all three axes and makes the signal strictly positive. **D**: Smoothing the Shannon entropy facilitates robust peak detection. Detected heart beats in blue. Y-axis labeling follows [@leePhysiologicalSignalMonitoring2016]; y-axis values were excluded because the filtering process introduces magnitude distortion and only the relative shape of the signal is relevant to the analysis."}
402+
```{r bw-bcg, fig.cap="Example of signal processing for 3-dimensional BCG during a motionless period in a blue whale dive. **A**: Band-pass filtered triaxial acceleration, with cranio-caudal in orange, lateral in blue, and dorso-ventral in green. **B**: Peaks enhanced after forward differencing acceleration (i.e., jerk). **C**: The Shannon entropy combines information from all three axes and makes the signal strictly positive. **D**: Smoothing the Shannon entropy facilitates robust peak detection. Detected heart beats in blue. Y-axis values excluded because the filtering process introduces magnitude distortion and only the relative shape of the signal is relevant to the analysis."}
386403
bw_bcg_plot <- function(rid) {
387404
bcg_sample <- filter(bw_400hz, region_id == rid)
405+
palette <- rgb(c(230, 86, 0), c(159, 180, 158), c(0, 233, 115), maxColorValue = 255)
388406
389-
# A: Filtered surge
390-
pA <- bcg_sample %>%
407+
# A: Filtered acceleration
408+
acceleration_data <- bcg_sample %>%
391409
rename(`Cranio-caudal` = surge_filt,
392410
Lateral = sway_filt,
393411
`Dorso-ventral` = heave_filt) %>%
@@ -396,17 +414,20 @@ bw_bcg_plot <- function(rid) {
396414
values_to = "acc") %>%
397415
mutate(axis = factor(axis, levels = c("Cranio-caudal",
398416
"Lateral",
399-
"Dorso-ventral"))) %>%
400-
ggplot(aes(dt, acc)) +
417+
"Dorso-ventral")))
418+
pA <- ggplot(acceleration_data, aes(dt, acc, color = axis)) +
401419
geom_line(size = 0.2) +
402420
scale_x_datetime(date_labels = "%H:%M:%S") +
403421
scale_y_continuous(n.breaks = 3) +
422+
scale_color_manual(values = palette) +
404423
facet_grid(rows = vars(axis)) +
405-
labs(y = "Acceleration (filtered)") +
406-
t_yvoid
424+
labs(y = "Acceleration\n(filtered)") +
425+
t_yvoid +
426+
theme(legend.position = "none",
427+
panel.spacing = unit(0, "lines"))
407428
408429
# B: Jerk vectors
409-
pB <- bcg_sample %>%
430+
jerk_data <- bcg_sample %>%
410431
mutate(jerk = set_names(as_tibble(jerk), c("Cranio-caudal",
411432
"Lateral",
412433
"Dorso-ventral"))) %>%
@@ -416,20 +437,23 @@ bw_bcg_plot <- function(rid) {
416437
values_to = "jerk") %>%
417438
mutate(axis = factor(axis, levels = c("Cranio-caudal",
418439
"Lateral",
419-
"Dorso-ventral"))) %>%
420-
ggplot(aes(dt, jerk)) +
440+
"Dorso-ventral")))
441+
pB <- ggplot(jerk_data, aes(dt, jerk, color = axis)) +
421442
geom_line(size = 0.2) +
422443
scale_x_datetime(date_labels = "%H:%M:%S") +
423444
scale_y_continuous(n.breaks = 3) +
445+
scale_color_manual(values = palette) +
424446
facet_grid(rows = vars(axis)) +
425447
labs(y = "Jerk") +
426-
t_yvoid
448+
t_yvoid +
449+
theme(legend.position = "none",
450+
panel.spacing = unit(0, "lines"))
427451
428452
# C: Shannon entropy of jerk (NOT jerk norm)
429453
pC <- ggplot(bcg_sample, aes(dt, jerk_se)) +
430454
geom_line(size = 0.2) +
431455
scale_x_datetime(date_labels = "%H:%M:%S") +
432-
labs(y = "Shannon entropy") +
456+
labs(y = "Shannon\nentropy") +
433457
t_yvoid
434458
435459
# D: Smoothed
@@ -444,13 +468,14 @@ bw_bcg_plot <- function(rid) {
444468
align = "v",
445469
axis = "lr",
446470
ncol = 1,
471+
rel_heights = c(1.5, 1.5, 1, 1),
447472
labels = "AUTO")
448473
}
449474
450475
bw_bcg_plot(23)
451476
```
452477

453-
```{r bw-validation-plots, fig.cap="**A** Signal-to-noise ratio was higher for the 3-dimensional BCG (lower panel) than the 1-dimensional BCG (cranio-caudal acceleration only; upper panel). Each panel shows the power spectral density for the BCG. Based on previously observed blue whale heart rates, 4-8 bpm was considered signal (gray shading). The signal-to-noise ratio was calculated as the ratio of the area under the curve in the signal band to the area under the rest of the curve, up to 60 bpm. **B** Heart rates observed in the 3-dimensional BCG followed characteristic diving physiology patterns. Heart rate is lowest at the start of the dive (~4-5 bpm), increasing towards ascent (~8-9 bpm). Points indicate instantaneous heart rates and the line is a Theil-Sen regression. Outliers likely represent premature beats which are common in heart rate profiles during dives of cetaceans, seals, and penguins [@goldbogenExtremeBradycardiaTachycardia2019; @mcdonaldDeepdivingSeaLions2014; @andrews1997; @wright2014]."}
478+
```{r bw-validation-plots, fig.cap="**A** Signal-to-noise ratio was higher for the 3-dimensional BCG (lower panel) than the 1-dimensional BCG (cranio-caudal acceleration only; upper panel). Each panel shows the power spectral density for the BCG. Based on previously observed blue whale heart rates, 4-8 bpm was considered signal (gray shading). The signal-to-noise ratio was calculated as the ratio of the area under the curve in the signal band to the area under the rest of the curve, up to 60 bpm. **B** Heart rates observed in the 3-dimensional BCG followed characteristic diving physiology patterns. Heart rate is lowest at the start of the dive (~4-5 bpm), increasing towards ascent (~8-9 bpm). Points indicate instantaneous heart rates and the line is a Theil-Sen regression. Outliers likely represent premature beats which are common in heart rate profiles during dives of cetaceans, pinnipeds, and penguins [@goldbogenExtremeBradycardiaTachycardia2019; @mcdonaldDeepdivingSeaLions2014; @andrews1997; @wright2014]."}
454479
labels <- bw_psd %>%
455480
filter(between(freq_bpm, 7.99, 8.01)) %>%
456481
group_by(metric) %>%

analysis/paper/paper.docx

83.5 KB
Binary file not shown.
37.8 MB
Binary file not shown.

0 commit comments

Comments
 (0)