-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #151 from tdhock/fix-line-group
FunctionalPruning data test
- Loading branch information
Showing
10 changed files
with
123 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Package: animint | ||
Maintainer: Toby Dylan Hocking <[email protected]> | ||
Author: Toby Dylan Hocking, Susan VanderPlas, Carson Sievert, Kevin Ferris, Tony Tsai | ||
Version: 2016.03.23 | ||
Version: 2016.05.07 | ||
License: GPL-3 | ||
Title: Interactive animations | ||
Description: An interactive animation can be defined using a list of | ||
|
@@ -30,7 +30,4 @@ Suggests: | |
devtools, | ||
httr, | ||
maps | ||
Remotes: tdhock/ggplot2, | ||
ropensci/RSelenium, | ||
hadley/scales@2c3edf45de56d617444dc38e47e0404173817886 | ||
RoxygenNote: 5.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
\name{FunctionalPruning} | ||
\alias{FunctionalPruning} | ||
\docType{data} | ||
\title{ | ||
Functional Pruning Algorithm | ||
} | ||
\description{ | ||
Output of an algorithm for optimal change-point detection. | ||
} | ||
\usage{data("FunctionalPruning")} | ||
\format{ | ||
a named list of 4 data.frames | ||
} | ||
\source{ | ||
https://github.com/tdhock/PeakSegFPOP-paper/blob/master/figure-constrained-PDPA-normal-real.R | ||
} | ||
\keyword{datasets} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
context("FunctionalPruning") | ||
|
||
data(FunctionalPruning, package="animint") | ||
min.bug.viz <- list( | ||
pruning=ggplot()+ | ||
geom_line(aes(mean, cost, | ||
showSelected=minimization), | ||
color="grey", | ||
size=5, | ||
data=FunctionalPruning$envelope)+ | ||
geom_line(aes(mean, cost, color=data.i.fac, | ||
group=paste(piece.i, data.i), | ||
showSelected=minimization), | ||
data=FunctionalPruning$cost.lines)+ | ||
geom_point(aes(min.cost.mean, min.cost, | ||
color=data.i.fac, | ||
showSelected=minimization), | ||
size=5, | ||
data=FunctionalPruning$minima), | ||
data=ggplot()+ | ||
geom_tile(aes(timestep, total.segments, | ||
fill=optimal.cost, | ||
id=paste0("segs", total.segments, "time", timestep), | ||
clickSelects=minimization), | ||
data=FunctionalPruning$grid), | ||
first=list(minimization="2 segments up to data point 4") | ||
) | ||
info <- animint2HTML(min.bug.viz) | ||
|
||
some.lines <- subset(FunctionalPruning$cost.lines, timestep==4 & n.segments==2) | ||
with(some.lines, table(data.i, piece.i)) | ||
test_that("one line rendered for min envelope", { | ||
path.list <- getNodeSet( | ||
info$html, | ||
'//g[@class="geom1_line_pruning"]//path') | ||
expect_equal(length(path.list), 1) | ||
}) | ||
|
||
test_that("four lines rendered for cost candidates", { | ||
path.list <- getNodeSet( | ||
info$html, | ||
'//g[@class="geom2_line_pruning"]//path') | ||
expect_equal(length(path.list), 4) | ||
}) | ||
|
||
html <- clickHTML(id="segs1time4") | ||
|
||
test_that("min envelope line disappears", { | ||
path.list <- getNodeSet( | ||
html, | ||
'//g[@class="geom1_line_pruning"]//path') | ||
expect_equal(length(path.list), 0) | ||
}) | ||
|
||
test_that("cost candidates lines disappear", { | ||
path.list <- getNodeSet( | ||
html, | ||
'//g[@class="geom2_line_pruning"]//path') | ||
expect_equal(length(path.list), 0) | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters