4. Creating data files - ashleyblawas/respdetect GitHub Wiki
In Steps 2-4 of main.m
you will make data files containing information about the tag deployment.
Step 2: Make metadata file (-md.mat)
When you run Step 2 you will be prompted to enter the tag on and tag off time (in seconds). You can use the zoom function to zoom in on the start/end of the dive profile to determine where the dive starts/ends. The purpose of this step is two-fold. Firstly, it is to ensure that the breath detection step only receives portions of the data where the tag is on the animal, and therefore doesn't attempt to detect respiration events when the tag is off the animal. Secondly, it ensures that the actual tagging event is removed from the portion of tag data to analyze. The actual event of tagging results in a jerk signal whose magnitude is much greater than peaks in jerk resulting from breathing, so if the tagging event is not removed, respdetect
will likely do a bad job of detecting breaths in that initial surfacing. As a safety factor, if the animal is at the surface at the tag on time (the alternative being the tag doesn't actually turn on until the animal is submerged) the breath detector will remove the first 10 seconds after the tag on time.
You will also be asked to specify the DTAG version. A file ending in -md.mat
will be saved with the metadata information.
Step 3: Find dives (-dives.mat, -divetable.mat)
This step will allow you to set a dive threshold for finding dives using the finddives.m
script by Mark Johnson. You will be prompted to enter a dive threshold (in meters). The default dive threshold is 5 meters. Note that this information will not be used any further for the respdetect
tools, but if you choose to export the breath data for further analysis in R, the dive information will be included in this exported data. This step will output two files containing the same information. One is a mat file containing each dive variable saved as a vector (-dives.mat
) and the other is the same information in table format (-divetable.mat
).
Step 4: Process movement data (-movement.mat)
In Step 4 the acceleration and pitch data will be processed through a series of steps to amplify the movement signatures associated with breathing. Several of these steps are based on Czapanskiy et al., 2022's method for ballistography. Note that this step filters the acceleration and pitch data using a bandpass filter with cutoff frequnecies of 2 Hz and 15 Hz, unless the sampling frequency is less than 30 Hz, then a highpass filter with a cutoff frequency of 2 Hz is applied. The movement data is saved in a file ending in -movement.mat
.