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

moveTrappedPoints crashes R if table distances are all negative for a serum. #147

Open
drserajames opened this issue Mar 15, 2023 · 0 comments

Comments

@drserajames
Copy link
Member

Sometimes when I'm adjusting the column bases, the column base is lower than the lowest titre for a serum so that all the table distances for that serum are negative. The map optimises just fine, but then I get an error when I try to use moveTrappedPoints that crashes R.

> library(Racmacs)
> packageVersion("Racmacs")
[1] ‘1.1.40’
> 
> set.seed(123)
> dat2 <- 10*2^round(rbind(cbind(matrix(rep(7, 9), ncol=3), matrix(rep(3, 9), ncol=3)),
+                          cbind(matrix(rep(3, 9), ncol=3), matrix(rep(7, 9), ncol=3))))
> dat2[,1] <- dat2[,1]*8
> dat2
      [,1] [,2] [,3] [,4] [,5] [,6]
[1,] 10240 1280 1280   80   80   80
[2,] 10240 1280 1280   80   80   80
[3,] 10240 1280 1280   80   80   80
[4,]   640   80   80 1280 1280 1280
[5,]   640   80   80 1280 1280 1280
[6,]   640   80   80 1280 1280 1280
> 
> 
> map <- make.acmap(dat2, verbose=F, options=list(report_progress = F))
> mtp <- moveTrappedPoints(map)
Checking for trapped points recursively: no trapped points found.
> 
> cb_map <- optimizeMap(map, 2, 100, fixed_column_bases = rep(5,6))
Discarding previous optimization runs.
Performing 100 optimizations
================================================================================
Optimization runs complete
Took 0.05 secs

> cb_mtp <- moveTrappedPoints(cb_map)
Checking for trapped points recursively:terminate called after throwing an instance of 'std::logic_error'
  what():  Cube::min(): object has no elements
zsh: abort      R

I would prefer that moveTrappedPoints worked as normal. If that's not easy, then for an warning message ("Trapped points not moved due to negative table distances for at least one serum"), rather than a crash.

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