# Differences

This shows you the differences between two versions of the page.

— |
tagwiki:tools:calibration:fix_pressure [2017/08/03 22:07] (current) das39 created |
||
---|---|---|---|

Line 1: | Line 1: | ||

+ | ====== fix_pressure ====== | ||

+ | Correct a depth or altitude profile for offsets caused by mis-calibration and temperature. | ||

+ | ----- | ||

+ | ===== Syntax ===== | ||

+ | === Matlab & Octave === | ||

+ | <code> | ||

+ | [p,pc] = fix_pressure(p,t,maxp) % p and t are sensor structures | ||

+ | or | ||

+ | [p,pc] = fix_pressure(p,t,fs,maxp) % p and t are vectors | ||

+ | </code> | ||

+ | === R === | ||

+ | <code> | ||

+ | list <- fix_pressure(p, t, maxp = NULL) # p and t are sensor structures | ||

+ | or | ||

+ | list <- fix_pressure(p, t, sampling_rate, maxp = NULL) # p and t are vectors | ||

+ | </code> | ||

+ | |||

+ | ===== Description ===== | ||

+ | Correct a depth or altitude profile for offsets caused by mis-calibration and temperature. This function finds minima in the dive/altitude profile that are consistent with surfacing/landing. It uses the depth/height at these points to fit a temperature regression. | ||

+ | |||

+ | ===== Inputs ===== | ||

+ | ^ Input var ^ Description ^ Units ^ | ||

+ | | p | is a sensor structure/list or vector of depth/altitude in meters. |meters| | ||

+ | |t| is a sensor structure/list or vector of temperature in degrees Celsius. |degrees Celsius| | ||

+ | |fs/sampling_rate| is the sampling rate of p and t in Hz. This is only needed if p and t are not sensor strucures/lists. The depth and temperature must both have the same sampling rate (use decdc.m or resample.m if needed to achieve this).|Hz| | ||

+ | |maxp| is the maximum depth or altitude reading in the pressure data for which the animal could actually be at the surface. This is a rough measurement of the potential error in the pressure data. The unit is meters. Start with a small value, e.g., 2 m and re-run fix_depth with a larger value if there are still obvious temperature-related errors in the resulting depth/altitude profile.|meters| | ||

+ | |||

+ | ===== Outputs ===== | ||

+ | ^ Output var ^ Description ^ Units^ | ||

+ | |p| is a sensor structure/list or vector of corrected depth/altitude measurements at the same sampling rate as the input data. If the input is a sensor structure/list, the output will also be. |meters| | ||

+ | |pc| is a structure/list containing the pressure offset and temperature correction coefficients. It has fields: pc.tref is the temperature reference in degrees Celsius (this will always be 20. pc.tcomp is the temperature compensation polynomial. This is used within the function to correct pressure as follows: p = p+polyval(pc.tcomp,t-pc.tref) |N/A| | ||

+ | |||

+ | ===== Notes & assumptions ===== | ||

+ | -This function makes a number of assumptions about the depth/altitude data and about the behaviour of animals: | ||

+ | - the depth data should have few incorrect outlier (negative) values that fall well beyond the surface. These can be reduced using median_filter.m before calling fix_depth. | ||

+ | - the animal is assumed to be near the surface at least 2% of the time. If the animal is less frequently at the surface, you may need to change the value of PRCTSURF near the start of the function. | ||

+ | - potential surfacings are detected by looking for zero-crossings in the vertical speed and this requires defining a threshold in vertical speed that must be crossed by each zero crossing. The value used is 0.05 m/s but this may be too high for animals that move very slowly near the surface. In which case, change MAXSPEED near the start of the function. | ||

+ | |||

+ | ===== Example ===== | ||

+ | |||

+ | ==== Matlab & Octave ==== | ||

+ | <code> | ||

+ | Example coming soon! | ||

+ | </code> | ||

+ | |||

+ | ==== R ==== | ||

+ | <code> | ||

+ | Example coming soon! | ||

+ | </code> | ||

+ | |||

+ | ===== About ===== | ||

+ | [[bugs@animaltags.org]] | ||

+ | Last modified: 10 May 2017 |