Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

render_gif generates an error when generated frames are less than the frames argument specified #8

Open
huizezhang-sherry opened this issue Oct 6, 2022 · 0 comments

Comments

@huizezhang-sherry
Copy link
Owner

An error with render_gif():

library(tourr)
set.seed(123)
gif_file <- file.path(tempdir(), "test.gif")
tourr::render_gif(
  flea[1:6],
  tour_path = guided_tour(holes()),
  display = display_xy(),
  frames = 70,
  gif_file = gif_file
)
  
#> Value  0.538   43.4 % better  - NEW BASIS
#> Value  0.730   35.6 % better  - NEW BASIS
#> Value  0.780   6.8 % better  - NEW BASIS
#> Value  0.846   8.5 % better  - NEW BASIS
#> Value  0.872   3.2 % better  - NEW BASIS
#> Value  0.883   1.3 % better  - NEW BASIS
#> Value  0.887   0.4 % better  - NEW BASIS
#> Value  0.891   0.5 % better  - NEW BASIS
#> Value  0.897   0.7 % better  - NEW BASIS
#> Value  0.903   0.7 % better  - NEW BASIS
#> Value  0.906   0.3 % better  - NEW BASIS
#> Value  0.906   0.0 % better 
#> Value  0.910   0.5 % better  - NEW BASIS
#> Value  0.910   0.0 % better 
#> Value  0.912   0.3 % better  - NEW BASIS
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.1 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.1 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.1 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.1 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> No better bases found after 25 tries.  Giving up.
#> Final projection: 
#> 0.333  0.486  
#> 0.338  -0.344  
#> 0.412  -0.189  
#> 0.381  -0.337  
#> 0.467  0.644  
#> 0.492  -0.285
#> Error in normalizePath(png_files, mustWork = TRUE): path[61]="/var/folders/_t/v9kjp3yn2k73wm16y_jlphgsbbd6_6/T//Rtmpb5P9kJ/frame061.png": No such file or directory

Created on 2022-10-06 by the reprex package (v2.0.1)

This is because only 60 frames are generated with this guided tour configeration while 70 frames are asked to be rendered. The following uses tourr::render() to validate:

library(tourr)
set.seed(123)
png_files <- file.path(tempdir(), "test-%03d.png")
tourr::render(
  data = flea[,1:6],
  tour_path = guided_tour(holes()),
  display = display_xy(),
  frames = 100, "png",
  png_files)
#> Converting input data to the required matrix format.
#> Value  0.538   43.4 % better  - NEW BASIS
#> Using half_range 0.98
#> Value  0.730   35.6 % better  - NEW BASIS
#> Value  0.780   6.8 % better  - NEW BASIS
#> Value  0.846   8.5 % better  - NEW BASIS
#> Value  0.872   3.2 % better  - NEW BASIS
#> Value  0.883   1.3 % better  - NEW BASIS
#> Value  0.887   0.4 % better  - NEW BASIS
#> Value  0.891   0.5 % better  - NEW BASIS
#> Value  0.897   0.7 % better  - NEW BASIS
#> Value  0.903   0.7 % better  - NEW BASIS
#> Value  0.906   0.3 % better  - NEW BASIS
#> Value  0.906   0.0 % better 
#> Value  0.910   0.5 % better  - NEW BASIS
#> Value  0.910   0.0 % better 
#> Value  0.912   0.3 % better  - NEW BASIS
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.1 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.1 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.1 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.1 % better 
#> Value  0.913   0.0 % better 
#> Value  0.913   0.0 % better 
#> No better bases found after 25 tries.  Giving up.
#> Final projection: 
#> 0.333  0.486  
#> 0.338  -0.344  
#> 0.412  -0.189  
#> 0.381  -0.337  
#> 0.467  0.644  
#> 0.492  -0.285
length(list.files(tempdir()))
#> [1] 60

Created on 2022-10-06 by the reprex package (v2.0.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant