Skip to content

Commit

Permalink
pushing new features and avoiding curl.
Browse files Browse the repository at this point in the history
  • Loading branch information
wincowgerDEV committed May 8, 2024
1 parent b677176 commit adc687c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
5 changes: 2 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ Imports:
signal,
glmnet,
jpeg,
shiny,
ggplot2
shiny
Suggests:
knitr,
rmarkdown,
Expand All @@ -104,7 +103,7 @@ Suggests:
dplyr,
DT,
mongolite,
loggit
ggplot2
RoxygenNote: 7.3.1
Roxygen: list(markdown = TRUE)
Config/testthat/edition: 3
10 changes: 6 additions & 4 deletions R/def_features.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@ collapse_spec.OpenSpecy <- function(x, ...) {
ts$id <- x$metadata$feature_id
x$spectra <- ts[, lapply(.SD, median, na.rm = T), by = "id"] |>
transpose(make.names = "id")


r <- g <- b <- NULL # workaround for data.table non-standard

if(all(c("r", "g", "b") %in% names(x$metadata))){
x$metadata[, r := as.integer(sqrt(mean(r^2))), by = "feature_id"]
x$metadata[, g := as.integer(sqrt(mean(g^2))), by = "feature_id"]
x$metadata[, b := as.integer(sqrt(mean(b^2))), by = "feature_id"]
x$metadata[, "r" := as.integer(sqrt(mean(r^2))), by = "feature_id"]
x$metadata[, "g" := as.integer(sqrt(mean(g^2))), by = "feature_id"]
x$metadata[, "b" := as.integer(sqrt(mean(b^2))), by = "feature_id"]
x$metadata <- x$metadata |>
unique(by = c("feature_id", "area", "feret_max", "centroid_y",
"centroid_x", "first_x", "first_y", "rand_x", "rand_y",
Expand Down
16 changes: 8 additions & 8 deletions tests/testthat/test-manage_lib.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
tmp <- file.path(tempdir(), "OpenSpecy-testthat")
dir.create(tmp, showWarnings = F)

test_that("stop if OSF not reachable", {
skip_on_cran()
skip_if_not(is.null(curl::nslookup("api.osf.io", error = F)),
message = "OSF is online")

get_lib(type = "test", path = tmp) |>
expect_error()
})
#test_that("stop if OSF not reachable", {
# skip_on_cran()
#skip_if_not(is.null(curl::nslookup("api.osf.io", error = F)),
# message = "OSF is online") #Curl doesn't work nicely with shinylive

# get_lib(type = "test", path = tmp) |>
# expect_error()
#})

test_that("get_lib() downloads test library", {
skip_on_cran()
Expand Down

0 comments on commit adc687c

Please sign in to comment.