In development... - ashleyblawas/respdetect GitHub Wiki
Several additional functions that are not a part of this package are in development but were not ready at the time of publication. If any of these seem useful for your work, please contact me and I would be happy to share more!
Kinematic audit for DTAGs or CATS tags
In some cases you may want to manually go through your detections and audit them. This code chunk exists to let you do that.
In Step S2a you will load in information for a tag of your choice. You can control which tag record you are looking at by changing the k value at the start of the loop. You could consider making this more automated, but the k value works just fine.
In Step S2b you will get a figure of the dive record (depth, jerk, and roll) and will be able to manually go through and add/remove detected breaths. This function is built on the audit code originally built by Mark Johnson and available in tagtools. The commands for auditing are as follows:
f - Moves forward in time b - Moves backward in time s - Moves to the next surfacing d - Moves to the next dive c - Selects the current cursor position and add it to the audit as a 0-length event. You will be prompted to enter a comment on the Matlab command window. Enter a 'b' for breath and type return when complete x - Deletes the audit entry at the cursor position. If there is no audit entry at the cursor, nothing happens. If there is more than one audit entry overlapping the cursor, one will be deleted (the first one encountered in the audit structure). q - Saves/quits the audit
After you do the audits you can run Step S2c to look at the instantaneous breathing rate across the tag record. This can help to highlight where you may have missed detections/over detected breaths and need to manually correct the detections.
Dropping initial breaths after tagging for CATS
In some occasions you may want to drop the segment of data that immediately follows tag deployment from your analysis. This code chunk allows you to do that.
Random sampling of breaths to audit for CATS tag
To come...
Acoustic audits
For DTAGs: If you choose to do so, the R script respdetect_workup.rmd includes two sections for validating breath detections during logging with acoustic audits. The first section of this R script randomly samples logging intervals for acoustic auditing. This will produce a dataframe called logs_to_audit. Once you have created this dataframe you should use either Step S5a. or S5b. to conduct an acoustic audit for respirations of each of the logging periods contained in the aforementioned dataframe.
Note: It might be the case that you can't hear any breaths because it of surfacing splashing... that is okay, and you should only audit breaths that can clearly distinguish.
Once you have audited these sections, you will have many files ending in _acousticaud.txt in your audit folder in your data path. If any of these are of size 0 (i.e. there were no audited breaths for that tag), go ahead and remove them from that folder or delete them. R will get confused if it tries to read in an empty file.
Now you can run the second section in R for the acoustic auditing which will match up your acoustic audits with the closest detected breath by the breath detector. It will output a plot with the time differences between the acoustic audits and detections which can be used to determine the accuracy of the detectors for this random sample.