Before you start, decide on a deployment ID and put this in a variable called
depid. You also need to specify the directory where the raw data is, e.g.:
The raw sensor data from a DTAG deployment resides in the
.swv files. To get the entire sensor dataset, each file needs to be read in and checked [Note]There are tools for reading all the
.swv files automatically, but unless your deployment was very short, the size of the resulting sensor dataset can be so big that it will either not fit in memory or will at least slow down your computer. To get around this, the
.swv reading tool allows you to decimate (i.e., reduce the sampling rate) of the sensor data and/or select a subset of the sensor channels to read..
To choose the proper reading options you first need to find out what sensors were recorded in a deployment and what the original sampling rates were. Do this using:
In most cases, there will be more than one sampling rate across the sensors. For example: the accelerometers will have been sampled at a higher rate than the pressure sensor or the magnetometers [Note]There is a good reason for varying sampling rates: acceleration signals contain high frequency information which may be useful for inferring behavior whereas pressure and magnetometers tend not to, at least to the same extent. This adds an extra complexity in choosing a decimation factor – do you want to apply the same decimation factor to all sensor channels or use different factors on different channels? Both are possible..
Here are some examples for how to read in the sensor data that may be useful. None of these actions change the data in the original
.swv files, so you can read the same data in multiple ways. If you just want to get started with DTAG data without learning all of the different methods for reading it in, just do the first step below and then go to the next page in this tutorial.
1. Read in all the sensor channels and decimate them to a common 5 Hz sampling rate. This is useful to get an overview of a deployment, i.e., a dive profile and a general idea of the orientation of the animal and its direction of movement. The full 5 Hz dataset should fit in memory even for a very long (2 month) deployment:
2. For smaller animals, a 5 Hz sampling rate may be too slow to capture rapidly changing behaviors. Decimating to a common 25 Hz sampling rate may be better in this case but the resulting dataset may only fit in memory for shorter deployments (up to 1-2 weeks).
3. If you want to retain some high frequency information in the accelerometer signals but reduce the total size of the dataset so that it fits in memory, you can choose a decimation factor to apply to all channels. For example, to read all the sensor channels and decimate each one by a factor of 10, do this:
If the original accelerometer and pressure sampling rates were 200 Hz and 50 Hz, they will now be decimated to sampling rates of 20 Hz and 5 Hz, respectively.
4. You can select a subset of channels to read in and decimate these. For example, to just read the pressure sensor channel(s) and decimate these by a factor of 10, do this:
This is useful for quickly reading in the dive or altitude profile, e.g., to find out when the tag was actually attached to an animal.
5. You might also want to read in just the accelerometer channels and process these in a different way (and at a different sampling rate) than the other sensors. For example, to read the accelerometer data without decimation do this:
6. If you really want to read in the entire sensor data at full sampling rate (this will only be feasible for short deployments), do the following:
7. If you want to read in a section of the sensor data at full sampling rate from times t1 to t2 (in seconds with respect to the start time of the deployment), do the following: