Skip to content

Commit

Permalink
Merge pull request #1 from baktoft/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
baktoft authored Jun 28, 2018
2 parents c3ea6b9 + ebc3cb8 commit a12e118
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ vignettes/*.pdf
# Shiny token, see https://shiny.rstudio.com/articles/shinyapps.html
rsconnect/
*.Rd
.Rproj.user
27 changes: 16 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# yaps - YAPS (Yet Another Positioning Solver) (R package)
The yaps package requires [devtools] and [TMB](https://github.com/kaskr/adcomp).
Please see https://github.com/kaskr/adcomp/wiki/Download for instructions on TMB installation. Remember to install Rtools needed for TMB to run.
# YAPS - (Yet Another Positioning Solver)
Based on the original [YAPS](https://www.nature.com/articles/s41598-017-14278-z.pdf) presented in Baktoft, Gjelland, Økland & Thygesen (2017): Positioning of aquatic animals based on time-of-arrival and random walk models using YAPS (Yet Another Positioning Solver). DOI:10.1038/s41598-017-14278-z

A few changes have been made to improve performance and allow track estimation from random burst interval transmitters.

To use on own data, compile a toa-matrix based on synchronized hydrophone data and replace the hydros dataframe with actual hydrophone positions.

The yaps package requires [devtools](https://cran.r-project.org/web/packages/devtools/index.html) and [TMB](https://github.com/kaskr/adcomp).
Please see for [instructions](https://github.com/kaskr/adcomp/wiki/Download) on TMB installation. Remember to install [Rtools](https://cran.r-project.org/bin/windows/Rtools/) as specified in the TMB documentation.

Installation:
```
Expand All @@ -10,24 +15,23 @@ devtools::install_github("baktoft/yaps")
```

Usage example:

```
rm(list=ls())
library(yaps)
set.seed(42)
# Simulate "true" track of animal movement of n seconds
# Simulate true track of animal movement of n seconds
trueTrack <- simTrueTrack(model='crw', n = 15000, deltaTime=1, shape=1, scale=0.5, addDielPattern=TRUE)
# Simulate telemetry observations from true track.
# Format and parameters depend on type of transmitter burst interval (BI) - stable (sbi) or random (rbi).
pingType <- 'rbi'
if(pingType == 'sbi') {
# # # # stable BI
if(pingType == 'sbi') { # stable BI
sbi_mean <- 5; sbi_sd <- 1e-4;
teleTrack <- simTelemetryTrack(trueTrack, ss='rw', pingType=pingType, sbi_mean=sbi_mean, sbi_sd=sbi_sd)
} else if(pingType == 'rbi'){
# # # # random BI
} else if(pingType == 'rbi'){ # random BI
pingType <- 'rbi'; rbi_min <- 20; rbi_max <- 40;
teleTrack <- simTelemetryTrack(trueTrack, ss='rw', pingType=pingType, rbi_min=rbi_min, rbi_max=rbi_max)
}
Expand All @@ -49,9 +53,10 @@ maxIter <- ifelse(pingType=="sbi", 500, 5000)
outTmb <- runTmb(inp, maxIter=maxIter, getPlsd=TRUE, getRep=TRUE)
str(outTmb)
# Estimates
# Estimates in pl
pl <- outTmb$pl
# Error estimates
# Error estimates in plsd
plsd <- outTmb$plsd
# plot the resulting estimated track
Expand All @@ -60,4 +65,4 @@ lines(y~x, data=teleTrack)
points(hy~hx, data=hydros, col="green", pch=20, cex=3)
lines(pl$Y~pl$X, col="red")
```
```
5 changes: 5 additions & 0 deletions yaps.Rproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ SaveWorkspace: No
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX

AutoAppendNewline: Yes
StripTrailingWhitespace: Yes

Expand Down

0 comments on commit a12e118

Please sign in to comment.