What is it?
Locomotion in many animals involves the oscillatory movement of limbs, fins or wings. The idea behind dominant stroke frequency is that animals tend to prefer a particular oscillation rate during routine transport. This rate may be determined by the size, weight and spring constant of anatomical structures, i.e., coinciding with a resonance or pendulum frequency, making it an efficient rate at which to locomote. Although the precise DSF may vary by individual, DSF is often broadly similar across animals with similar size and locomotion style, leading to general allometric relationships between body size and DSF. For example stroke cycle frequencies of swimming specialist seabirds and marine mammals have been seen to be proportional to
mass^0.29 (Sato et al., 2007). However, there can also be significant variation within and across species, e.g., some individuals tend to adopt faster or slower locomotion rates, known as the pace of life syndrome. In addition it is quite common that animals have a different
dsf during the descent than the ascent phase, as an animal that encounters large forces (due to their buoyancy; Miller et al., 2004; MacAyeal et al., 2011) may respond by stroking faster.
How is it measured?
Locomotion generally involves the actuation of some of the larger muscles in the body. This produces specific acceleration oscillations as well as small cyclical changes in body orientation, which can be sensed potentially throughout the body. The presence of both acceleration and orientation changes at the locomotion rate means that any of the usual fine-scale motion sensors can be used to measure the DSF. Magnetometers and gyroscopes sense orientation, while accelerometers sense both orientation and specific acceleration, but any of these sensors in a surface-attached tag will produce components that vary at the locomotory rate. The magnitude of these locomotion signals depends on the position of the tag on the body but the oscillation rate, and therefore the DSF, does not.
Although the DSF can be estimated by finding each locomotory cycle in the motion sensor data (i.e., in the accelerometer, magnetometer or gyroscope signals), this would be a lot of work. A simpler approach is to compute a spectral average of the sensor data using fast Fourier transforms (FFTs). Locomotory motions are often largest in one or two of the animal’s three cardinal axes. For example, in cetacean swimming, locomotion signals are largest in the dorso-ventral and longitudinal axes. If the axis with strongest locomotion signal is known, the spectral average can be computed on just this axis. Alternatively, the spectral averages of each axis can be combined, or can be inspected individually for a peak corresponding to the DSF. In either case, the DSF peak is often readily identified.
What is it good for?
The DSF may be a useful parameter in itself, e.g., to evaluate activity budgets and to identify intervals when the animal exceeds its normal locomotory rate (perhaps due to the need for additional force or speed). The DSF can also be useful to guide the design of high-pass or low-pass filters to separate postural components from specific acceleration components in on-animal acceleration data, e.g., in the calculation of ODBA.
Usage of tool
dsf() function calculates the spectrum level of the signal (X), i.e., the amount of power per 1Hz band. Accelerometer and magnetometer signals have three axes each, so the spectrum level is estimated for each axis. Then,
dsf() sums the spectral power in the three axes, and returns the frequency with the maximum power as an estimate of the dominant stroke frequency (
fpk, i.e., the peak frequency in the sum of the power spectrum for each axis in Hz). This function also provides the quality of the peak (
q) measured by the peak power divided by the mean power of the spectra. This is a dimensionless number which is large if a clear spectral peak exists.
To calculate the spectrum level, the length of the Fast Fourier Transform (FFT), and therefore the frequency resolution, can be specified by the user (
Nfft). If not specified, the default value is the power of of two closest to
20*fs, i.e., an analysis block length of about 20 seconds and a frequency resolution of about 0.05 Hz. A shorter FFT may be required if movement behavior is highly variable. In contrast, a longer FFT may work well if propulsion is continuous and stereotyped.
fs is the sampling rate of the sensor data in Hz (samples per second). This is only required if
X is not a sensor structure.
Before computing the spectrum level at each frequency of a signal,
dsf() performs a low-pass filter on the signal. This prevents high frequency transients, e.g., in foraging, from dominating the spectra. The
dsf() function allows the user to specify the cut-off frequency in Hz of this low-pass filter (
fc). If not specified by the user,
fc is set to 5 Hz by default. It is important to note that the interval length over which
dsf() will be computed should be at least
Nfft/fs seconds, i.e., 20 s for the default FFT length.
Deep-Dive on Functionality
For a better understanding of how this works, let us plot the power spectra of the accelerometer and magnetometer data in the animal frame to visualize the dominant stroke cycle frequency. This will also help us to visualize not only the dominant stroke cycle frequency but how this differs from the low frequency postural changes in orientation and how we can set an appropriate cut off-frequency for the complementary filter
comp_filt(), to appropriately separate stroking, flapping or striding from postural signals. We will keep using the example of the beaked whale stroking during the ascent phase of a deep dive from the dsf tutorial.
Here, we plot a spectrogram with 1024 length FFTs (because the sampling frequency
fs is 50 Hz).
spectrum_level() divides the data up into as many blocks of 1024 samples as it can, computes the FFT of each of these, and averages the power of the results. It returns the spectral average in decibels i.e.,
20*log10(signal size), which is good for sound which has a high dynamic range, but is not always so useful for movement data. We can reverse the decibels by computing
10.^(Sa/20) in MATLAB (note that the operator
.^ means compute 10 to the power of each element in
Sa/20 and return a vector of the same size as
Sa). The units of the spectrum will then be in m/s2/√Hz for acceleration and µT/√Hz for magnetometers.
What is the frequency and time resolution of this spectrogram? Hint: one is 1024 divided by the sampling rate and the other is the inverse
The time resolution is 1024/50 ≈ 20 seconds, and the frequency resolution is 50/1024 ≈ 0.05 Hz.
You can plot the spectral averages for
Mseg on the same figure:
Expand to show figures …
You could zoom in to get a closer look at the figures.
In this plot, the longitudinal axes is plotted in blue, the dorso-ventral axes in yellow and the lateral axes in red. How do the spectra of
Mseg compare? (note: ignore any frequencies of the first peak: these are from slow changes in orientation). Looking first at the axis of each sensor with the strongest fundamental signal: is it the same axis for both sensors? If so, why?
Yes, the longitudinal axis. These data are from a swimming whale. The caudal propulsion of whales generates an oscillatory pitching rotation which shows up most clearly in the longitudinal axes of the accelerometer and magnetometer (remember that both the accelerometer and magnetometer are sensitive to orientation changes). Propulsion also produces specific acceleration (i.e., acceleration due to actual movement as opposed to gravity) and this shows up most clearly in the dorso-ventral axis in whale swimming. Because only the accelerometer is sensitive to specific acceleration, the dorso-ventral axis shows a clear peak in the top plot, albeit somewhat lower than in the longitudinal axis.
Do you see a 2nd harmonic (i.e., a smaller peak at twice the DSF) in either sensor? If not both, why do you think this might be? What spectral components (if any) are in the other axes?
There is a small second harmonic peak in the accelerometer data but not in the magnetometer data. In the accelerometer it is most apparent in the longitudinal axis.
Swimming animals that use caudal propulsion can produce one or two bursts of thrust per tailbeat cycle, e.g., by using a powerful down-stroke followed by a lazy up-stroke, or by using powerful strokes in both directions. The resulting thrust is forward-directed irrespective of whether it is produced once or twice per tailbeat.
The spectrum of the accelerometer longitudinal axis therefore tells us whether the whale is swimming with a lazy half-stroke or with two powerful half-strokes: the presence of some second harmonic indicates that two bursts of thrust are being made per tailbeat (although these may not be equally strong). In this example, the magnitude of the magnetometer data in the second harmonic is almost null. This is because the magnetometer measures orientation changes but not specific acceleration such as thrust or heave. The body rotations in caudal propulsion that are measured by a magnetometer are close to sinusoidal and so only produce a first harmonic (or fundamental frequency).
We could also plot the sum of the spectral power in the three axes for the accelerometer and magnetometer data:
Expand to show figures …
You could zoom in to get a closer look at the figures. This output will be the same as when we run the
If the sampling rate of the sensor(s) used for computing the DSF is well above twice the highest stroke frequency of the animal, and the other assumptions are met, dsf will be well estimated. To verify that you have run
dsf()correctly, you could plot the accelerometer or magnetometer signals at a time when the animal is locomoting. Look for complete oscillation cycles and count the seconds that it takes for the animal to perform a number of full cycles, for example 10 strokes/strides. The DSF should then be reasonably close to 10/t where t is your second count. This will give you an idea if the output of
dsf() is correct, but it may be that you do not get the exact DSF as there could be periods when the animal locomotes at a higher or lower rate.
Aseg, zoom, for example, in the period from 70 to 110 seconds. Using the function
ginput(2) mark the start and end of the period containing 10 full strokes. Then calculate how many strokes the animal performs in a second.
Expand to show figures …
DSF is often broadly similar across animals with similar size and locomotion style. However, there can also be significant variation within and across species, e.g., some individuals tend to adopt faster or slower locomotion rates. In addition it is quite common that diving animals have a different
dsf during the descent than the ascent phase, as an animal that encounters large forces (due to their tissue weight or buoyancy) may respond by stroking faster. The same may be true of wingbeat rates in birds with faster stroking needed on ascent than during horizontal or descending flight.
It is essential that the sampling rate of the sensor(s) used for computing the DSF is well above twice the highest stroke frequency of the animal, otherwise aliasing can occur. Signals alias when the sampling rate is less than twice the highest oscillation frequency in the signal. An aliased signal may still give an apparent DSF peak but the peak frequency will be incorrect. In addition for the
dsf() function to work well and give an obvious result you should aim for estimating DSF during periods of locomotion and avoid having long periods where the animal is performing other activities, such as grooming or making social displays, without actually stroking, flapping or walking. Also you may need to avoid periods when the animal is manuevering rapidly, e.g., foraging, as this can mask the spectral peak due to locomotion.
Miller, P. J. O., Johnson, M. P., Tyack, P. L., and Terray, E. A. (2004). Swimming gaits, passive drag and buoyancy of diving sperm whales Physeter macrocephalus. Journal of Experimental Biology, 207, 1953–1967.https://doi.org/10.1242/jeb.00993
Sato, K., Watanuki, Y., Takahashi, A., Miller, P. J. ., Tanaka, H., Kawabe, R., Ponganis, P. J., Handrich, Y., Akamatsu, T., Watanabe, Y., Mitani, Y., Costa, D. P., Bost, C.-A., Aoki, K., Amano, M., Trathan, P., Shapiro, A., & Naito, Y. (2007). Stroke frequency, but not swimming speed, is related to body size in free-ranging seabirds, pinnipeds and cetaceans. Proceedings of the Royal Society B: Biological Sciences, 274(1609), 471–477. https://doi.org/10.1098/rspb.2006.0005
MacAyeal, L.C., Riskin, D.K., Swartz, S.M., Breuer, K.S. (2011). Climbing flight performance and load carrying in lesser dog-faced fruit bats (Cynopterus brachyotis). Journal of Experimental Biology,214 (5): 786–793. https://doi.org/10.1242/jeb.050195