Differences

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

Link to this comparison view

tagwiki:tools:calibration:crop_to [2017/08/04 13:32] (current)
das39 created
Line 1: Line 1:
 +====== crop_to ======
 +Reduce the time span of data by cropping out any data that falls before and after two time cues.
 +-----
  
 +===== Syntax =====
 +=== Matlab & Octave ===
 +<​code>​
 +Y = crop_to(X,​tcues) % X is a sensor structure
 + or
 +Y = crop_to(X,​fs,​tcues) % X is a regularly sampled vector or matrix
 + or
 +[Y,T] = crop_to(X,​T,​tcues) % X is an irregularly sampled vector or matrix
 +</​code>​
 +=== R ===
 +<​code>​
 +list <- crop_to(X, tcues = tcues) ​         # X is a sensor list
 +      or
 +list <- crop_to(X, sampling_rate,​ tcues) ​    # X is a regularly sampled vector or matrix
 +      or 
 +list <- crop_to(X, sampling_rate = T, tcues) ​  # X is an irregularly sampled vector or matrix
 +</​code>​
 +
 +===== Description =====
 +Reduce the time span of data by cropping out any data that falls before and after two time cues.
 +
 +===== Inputs =====
 +^ Input var ^ Description ^ Units ^
 +|X| is a sensor structure, vector or matrix. X can be regularly or irregularly sampled data in any frame and unit.|N/A|
 +|fs/​sampling_rate| is the sampling rate of X in Hz. This is only needed if X is not a sensor structure and X is regularly sampled. If X is not a sensor structure/​list and X is not regularly sampled, use the input "​T",​ a vector of sampling times for X.|Hz|
 +|tcues| is a two-element vector containing the start and end time cue in seconds of the data segment to keep, i.e., tcues = [start_time,​ end_time] (%Mat. or Oct.) tcues >- c(start_time,​ end_time) (#R). |seconds|
 +
 +===== Outputs =====
 +^ Output var ^ Description ^ Units^
 +|Y| is a sensor structure/​list,​ vector or matrix containing the cropped data segment. If the input is a sensor structure/​list,​ the output will also be. The output has the same units, frame and sampling characteristics as the input.|N/A|
 +|T| is a vector of sampling times for Y. This is only returned if X is irregularly sampled and X is not a sensor structure/​list. If X is a sensor structure/​list,​ the sampling times are stored in the structure/​list.|Hz|
 +
 +===== Example =====
 +
 +==== Matlab & Octave ====
 +<​code>​
 +load_nc('​testset3'​)
 +d = find_dives(P,​300) ;
 +P2 = crop_to(P,​[d.start(2) d.end(2)]);​ % crop to 2nd dive
 +plott(P2)
 +% plot shows the profile of the second dive
 +</​code>​
 +
 +==== R ====
 +<​code>​
 +data <- beaked_whale
 +d <- find_dives(data$P,​300)
 +P2 <- crop_to(data$P,​ tcues = c(d$start[2],​ d$end[2])) #​crop to 2nd dive
 +Xdata <- list(datatest = P2$X)
 +plott(Xdata)
 +#plot shows the dive profile and acceleration of the second dive
 +</​code>​
 +
 +===== About =====
 +[[bugs@animaltags.org]]
 +Last modified: 4 August ​ 2017
  • tagwiki/tools/calibration/crop_to.txt
  • Last modified: 2017/08/04 13:32
  • by das39