Skip to content

Commit

Permalink
make sure there is a crosscut
Browse files Browse the repository at this point in the history
  • Loading branch information
heike committed May 23, 2024
1 parent 29940de commit cb6b4c6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,16 @@ server <- function(input, output, session) {
## Get the ideal Cross Sections
progress$set(message = "Get suitable Cross Sections", value = 0)
bullets$crosscut <- sapply(bullets$x3p,x3p_crosscut_optimize, ylimits = c(150, NA))
bullets$ccdata <- mapply(x3p_crosscut,bullets$x3p,bullets$crosscut, SIMPLIFY=FALSE)
try_x3p_crosscut <- function(x3p, y = NULL, range = 1e-5) {
res <- x3p_crosscut(x3p=x3p, y = y, range = range)
if (nrow(res) == 0) {
# if there is no result, just use the middle
res <- x3p_crosscut(x3p=x3p, y = NULL, range = range)
}
res
}
bullets$ccdata <- mapply(try_x3p_crosscut,bullets$x3p,bullets$crosscut, SIMPLIFY=FALSE)


## Get the Groove Locations
progress$set(message = "Get the Groove Locations", value = .05)
Expand Down

0 comments on commit cb6b4c6

Please sign in to comment.