Introduction

The aim of this practical is to familiarise users with tag tools.

Learning objectives

1. Gain confidence with using the tagtools to load, plot and process data.
2. Gain understanding of different data representations in the tagtools: vectors vs sensor structures, raw vs corrected.
3. Learn how to use the tools to quantify simple aspects of behaviour.
4. Learn how to compute and evaluate data quality metrics for 3d field sensors.
5. Learn how to derive orientation from acceleration and magnetometer.
6. Evaluate the impact of specific acceleration on orientation estimates.
7. Compute and visualize a dead-reckoned track while appreciating some of the sources of error

Section 1: Working with pressure data & data structures

Pressure data and data structures

Pressure data (e.g., depth or altitude) are useful for identifying behavioural epochs (dives or flights) but can be strongly affected by temperature and, in the case of altimeters, by the ambient pressure. Sensors on deep diving animals can also suffer from poor resolution because of the large pressures they have to handle. Here we are going to use tools to read in some example data, examine it and correct temperature errors. We will then quantify dive duration in the corrected data.

Requirements

In the first section of this practical we will be using the mn12_186a_raw.nc dataset, and you will be using the following tag tools:

2. sens2var
3. plott
4. crop
5. median_filter
6. crop_to
7. fix_pressure
8. find_dives

1.1a & b Load and explore the test data set

1.1a Load and explore the test dataset

Load the test dataset mn12_186a. This dataset has already been converted from the source file that was offloaded from the tag into a NetCDF file. In doing so, some metadata was gleaned from the file and added to the data. Use load_nc to load a NetCDF file:

load_nc('mn12_186a_raw') % Matlab & Octave
or
X <- load_nc('mn12_186a_raw', which_vars=NULL)   #R

If this does not work and no variables are loaded into your workspace you might have to add the path to your file, for example if the file is in your working directory '/Users/mj/tagtools/testdata', then you need to enter:

load_nc('/Users/mj/tagtools/testdata/mn12_186a_raw')

This automatically loads some variables into your workspace. If you have workspace view enabled you will see these listed, otherwise type:

whos % Matlab & Octave
ls.str() #R

To see what is in your workspace. You should see the that the variables A, M, P, S, T and info have been added.

1.1b Explore the testdata set

Octave users before exploring the loaded data you might want to enable the following option, to prevent Octave from showing all the data in a structure when you ask for its contents (the data are too large to print to the screen).

struct_levels_to_print(0) % Octave users only

Find out what each of these variables is by just typing their name followed by enter. For info you will see:

info

info - Metadata. This tells you where the data came from, when it was collected, on what animal, and with what type of tag. info is the general metadata store for a dataset.

                            depid: 'mn12_186a'
data_source: [1x426 char]
data_nfiles: 9
data_format: 'csv'
device_serial: []
device_make: 'Little Leonardo Inc., Japan'
device_type: 'Archival'
device_model_name: []
device_model_version: []
device_url: []
sensors_list: [1x67 char]
dephist_device_tzone: 'unknown'
dephist_device_regset: 'dd-mm-yyyy HH:MM:SS'
dephist_device_datetime_start: '04-Jul-2012 07:59:01'
creation_date: '22-Jul-2017 20:59:15'

A

A - 3 Axis Acceleration

A =

scalar structure containing the fields:

data: 1172115x3 matrix
sampling: 1x7 sq_string
sampling_rate: 1x1 scalar
sampling_rate_unit: 1x2 sq_string
depid: 1x9 sq_string
creation_date: 1x20 sq_string
history: 1x9 sq_string
name: 1x1 sq_string
full_name: 1x12 sq_string
description: 1x21 sq_string
unit: 1x1 sq_string
unit_name: 1x6 sq_string
unit_label: 1x6 sq_string
column_name: 1x5 sq_string
frame: 1x3 sq_string
axes: 1x3 sq_string
files: 1x150 sq_string 

M

M - 3 Axis Magnetometry

P - depth.

T - Temperature

S

S - Speed

You can find out what is in a specific field in info, e.g., the sensors_list by typing info.sensors_list and then enter:

3 axis Accelerometer,3 axis Magnetometer,Pressure,Temperature,Speed

Load the test dataset mn12_186a. This dataset has already been converted from the source file that was offloaded from the tag into a NetCDF file. In doing so, some metadata was gleaned from the file and added to the data. Use load_nc to load a NetCDF file:

load_nc('mn12_186a_raw') % Matlab & Octave
or
X <- load_nc('mn12_186a_raw', which_vars=NULL)   #R

If this does not work and no variables are loaded into your workspace you might have to add the path to your file, for example if the file is in your working directory '/Users/mj/tagtools/testdata', then you need to enter:

load_nc('/Users/mj/tagtools/testdata/mn12_186a_raw')

This automatically loads some variables into your workspace. If you have workspace view enabled you will see these listed, otherwise type:

whos % Matlab & Octave
ls.str() #R

To see what is in your workspace. You should see the that the variables A, M, P, S, T and info have been added.

1.1d Exploratory data plots

Octave users before exploring the loaded data you might want to enable the following option, to prevent Octave from showing all the data in a structure when you ask for its contents (the data are too large to print to the screen).

struct_levels_to_print(0) % Octave users only

Find out what each of these variables is by just typing their name followed by enter. For info you will see:

info

                            depid: 'mn12_186a'
data_source: [1x426 char]
data_nfiles: 9
data_format: 'csv'
device_serial: []
device_make: 'Little Leonardo Inc., Japan'
device_type: 'Archival'
device_model_name: []
device_model_version: []
device_url: []
sensors_list: [1x67 char]
dephist_device_tzone: 'unknown'
dephist_device_regset: 'dd-mm-yyyy HH:MM:SS'
dephist_device_datetime_start: '04-Jul-2012 07:59:01'
creation_date: '22-Jul-2017 20:59:15'

This tells you where the data came from, when it was collected, on what animal, and with what type of tag. info is the general metadata store for a dataset.

A

A =

scalar structure containing the fields:

data: 1172115x3 matrix
sampling: 1x7 sq_string
sampling_rate: 1x1 scalar
sampling_rate_unit: 1x2 sq_string
depid: 1x9 sq_string
creation_date: 1x20 sq_string
history: 1x9 sq_string
name: 1x1 sq_string
full_name: 1x12 sq_string
description: 1x21 sq_string
unit: 1x1 sq_string
unit_name: 1x6 sq_string
unit_label: 1x6 sq_string
column_name: 1x5 sq_string
frame: 1x3 sq_string
axes: 1x3 sq_string
files: 1x150 sq_string 

[…]

[…]

S

[…]

You can find out what is in a specific field in info, e.g., the sensors_list by typing info.sensors_list and then enter:

3 axis Accelerometer,3 axis Magnetometer,Pressure,Temperature,Speed
• tagwiki/tutorials/practical1.txt