actel icon indicating copy to clipboard operation
actel copied to clipboard

Global residency: black boxes for global ratios

Open SimonDedman opened this issue 1 year ago • 14 comments

Residency: not sure what's expected here but presumably the black box shows something's wrong?

Possibly related to too many sections/arrays?

image

SimonDedman avatar Dec 10 '24 01:12 SimonDedman

I have recently seen this on a mac. It is hard for me to debug the underlying reason since I don't use one. Are you using a mac too?

hugomflavio avatar Dec 10 '24 02:12 hugomflavio

Linux, so unix, so... kinda. If I give you my 5 preload objects, would you might trying it on your end to see if it works fine in Windows?

And not that you need it but:

biometrics <- readRDS(file = file.path(loadloc, "actel", "processed", "biometrics.Rds"))
spatial <- readRDS(file = file.path(loadloc, "actel", "processed", "spatial.Rds"))
deployments <- readRDS(file = file.path(loadloc, "actel", "processed", "deployments.Rds"))
detections <- readRDS(file = file.path(loadloc, "actel", "processed", "detections.Rds"))
distances <- readRDS(file = file.path(loadloc, "actel", "processed", "distances.Rds"))

mypreload <- actel::preload(biometrics = biometrics,
                            spatial = spatial,
                            deployments = deployments,
                            detections = detections,
                            distances = distances,
                            tz = "UTC")

exploreResults <- actel::explore(datapack = mypreload,
                                 tz = NULL, # tz = "America/New_York", not needed if datapack provided
                                 max.interval = 60, # number of minutes that must pass between detections for a new event to be created
                                 min.total.detections = 2,
                                 min.per.event = 1,
                                 start.time = NULL, # Detection data prior to the timestamp set in start.time (in YYYY-MM-DD HH:MM:SS format) is not considered during the analysis
                                 stop.time = NULL, # ditto, posterior
                                 speed.method = c("last to first", "last to last", "first to first"),
                                 # And do in other functions below
                                 speed.warning = 1, # NULL; warns if speed in m/s > this value. <= speed.error. See Yannis email 2024-10-01 "Bull shark data cleaning questions"
                                 speed.error = 3, # ditto but suggests user input
                                 jump.warning = 2, # warns if jumping arrays w/o detection
                                 jump.error = 3, # ditto, errors
                                 inactive.warning = NULL, # n days inactive
                                 inactive.error = NULL, # ditto, error
                                 exclude.tags = NULL, # vector of tags, different codespace but same signal detected
                                 override = NULL, # vector of signals user defined as in/valid
                                 report = TRUE, # generate HTML report?
                                 auto.open = TRUE, # open report?
                                 discard.orphans = FALSE, # detections outside receiver deployment periods or before animal release dates
                                 discard.first = NULL, # hours after release to begin counting detections as valid
                                 save.detections = FALSE, # save processed detections for future runs?
                                 # HUGO NOTE: manpage unclear why user would want this
                                 # https://github.com/hugomflavio/actel/issues/111
                                 GUI = c("needed", "always", "never"),
                                 save.tables.locally = FALSE, # only if too big for R console/whenever possibility to invalidate events/never
                                 print.releases = TRUE, # print release sites on study area diagrams
                                 detections.y.axis = c("auto", "stations", "arrays"))
migrationsResults <- actel::migration(
  tz = NULL,
  section.order = NULL, # vector containing the order by which sections should be aligned in the results
  datapack = mypreload,
  success.arrays = NULL, # arrays that mark the end of the study area. If a tag crosses one of these arrays, the respective animal is considered to have successfully migrated through the study area
  max.interval = 60,
  min.total.detections = 2,
  min.per.event = 1,
  start.time = NULL,
  stop.time = NULL,
  speed.method = c("last to first", "last to last", "first to first"),
  speed.warning = 1,
  speed.error = 3,
  jump.warning = 2,
  jump.error = 3,
  inactive.warning = NULL,
  inactive.error = NULL,
  exclude.tags = NULL,
  override = NULL,
  report = TRUE,
  auto.open = TRUE,
  discard.orphans = FALSE,
  discard.first = NULL,
  save.detections = FALSE,
  if.last.skip.section = TRUE, # Should a tag detected at the last array of a given section be considered to have disappeared in the next section?
  replicates = NULL,
  disregard.parallels = TRUE, # Should the presence of parallel arrays invalidate potential efficiency peers?
  GUI = c("needed", "always", "never"),
  save.tables.locally = FALSE,
  print.releases = TRUE,
  detections.y.axis = c("auto", "stations", "arrays")
)
residencyResults <- actel::residency(
  tz = NULL,
  section.order = NULL,
  datapack = mypreload,
  max.interval = 60,
  min.total.detections = 2,
  min.per.event = 1,
  start.time = NULL,
  stop.time = NULL,
  speed.method = c("last to first", "last to last", "first to first"),
  speed.warning = 1,
  speed.error = 3,
  jump.warning = 2,
  jump.error = 3,
  inactive.warning = NULL,
  inactive.error = NULL,
  exclude.tags = NULL,
  override = NULL,
  report = TRUE,
  auto.open = TRUE,
  discard.orphans = FALSE,
  discard.first = NULL,
  save.detections = FALSE,
  section.warning = 1, # warns for section movement events with <= this value
  section.error = 1,
  timestep = c("days", "hours"),
  replicates = NULL,
  GUI = c("needed", "always", "never"),
  save.tables.locally = FALSE,
  print.releases = TRUE,
  detections.y.axis = c("auto", "stations", "arrays")
)

SimonDedman avatar Dec 10 '24 02:12 SimonDedman

I'm on a Linux too, but my pc was able to compile the plots. Interesting. image

hugomflavio avatar Dec 10 '24 03:12 hugomflavio

Weird. I just tried with Chrome but the result is the same as Firefox; what are you using boss?

Link to my html, in case the html generation code process is the issue, and not the displaying of the already-generated html.

Cheers!

SimonDedman avatar Dec 10 '24 18:12 SimonDedman

First noticeable thing is that, in your html, the study area indeed shows overstretched image

(but that is for #152)

To this issue, the plots show black for me too when I open your plot, so it is an issue when the report is generated:

image

Would your plot show nicely if you try to pop it up using the plotRatios() function? On the other example I saw of this, plotRatios worked fine.

so, presumably, something is breaking when ggsave is called with an svg extension.

What is interesting is that your circular plots are still being properly displayed, so the svg-saving tools are working... It seems something is not connecting properly between ggplot and svglite?

What happens when you try saving anything else as svg through ggsave? e.g.

library("ggplot2")
x <- data.frame(A = 1:5, B = 6:10)
p <- ggplot(data = x)
p <- p + aes(x = A, y = B)
p <- p + geom_point()
p

ggsave("test_plot.svg", width = 4, height = 4)

hugomflavio avatar Dec 10 '24 18:12 hugomflavio

Some things that can be behind this that you can compare:

> packageVersion("ggplot2")
[1] ‘3.5.1’
> packageVersion("svglite")
[1] ‘2.1.3’
> packageVersion("rsvg")
[1] ‘2.6.1’
> packageVersion("rmarkdown")
[1] ‘2.29’

And on bash:

$ pandoc -v
pandoc 3.1.3
Features: -server +lua
Scripting engine: Lua 5.4

hugomflavio avatar Dec 10 '24 19:12 hugomflavio

test_plot

All package versions are the same, pandoc/lua the same.

Any chance you can send me your HTML just to make sure it opens correctly on my side, even though that probably isn't the issue, just in case? Cheers

SimonDedman avatar Dec 10 '24 19:12 SimonDedman

here: https://we.tl/t-0uHnqEiyRI

hugomflavio avatar Dec 10 '24 19:12 hugomflavio

Thanks! Ok so they are different, your version is 9016, mine's 9013. Updating all packages inc actel & trying again. I may have been using the newer version of actel but looking at older report htmls... Having just run it, the result is the same with 9016.

Also on your version, the penultimate radar plot fails for all radar plot sequences:

image

On mine (just generated) they're blank, but still absent.

SimonDedman avatar Dec 10 '24 20:12 SimonDedman

PR #163 was just merged into the master (bumps version to 9017), and fixes the circular plot issue.

I'm not sure what is causing those black plots... We can leave this open in hopes someone else might find the same issue and report on it. This is not critical since the user can use plotRatios() to see them anyway, but certainly not ideal.

hugomflavio avatar Dec 10 '24 20:12 hugomflavio

9017 update to radars:

image

Garden missing; if there was another one before that's gone too, so things have gotten worse potentially? This is for migration, residency does this:

image

i.e. slightly odd layout? And another looks dead:

image

Black boxes still present.

plotRatios does indeed work:

2024-12-10_residencyPlot

SimonDedman avatar Dec 10 '24 21:12 SimonDedman

Test: test_plot

hugomflavio avatar Dec 12 '24 18:12 hugomflavio

Another user just reported black screens on residency plots

hugomflavio avatar Feb 10 '25 23:02 hugomflavio

I too am getting black screens on residency plots on the generated report but can use plotRatios to make the graphs.

rl25-jump avatar Apr 01 '25 20:04 rl25-jump