Skip to content

Commit

Permalink
minor modifications in the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyGelb committed Jan 2, 2024
1 parent 893d16e commit 4314c43
Show file tree
Hide file tree
Showing 38 changed files with 797 additions and 194 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export(network_listw.mc)
export(nkde)
export(nkde.mc)
export(nkde_get_loo_values)
export(nkde_worker)
export(quartic_kernel)
export(simple_lines)
export(simplify_network)
Expand Down
12 changes: 11 additions & 1 deletion R/adaptive_simultaneous_tnkde_bw.R
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ adaptive_bw_tnkde <- function(grid, events_loc, events, lines,
tol, digits, sparse, verbose){

##step 1 split the datas !
selections <- split_by_grid_abw(grid, events_loc, lines, max(trim_bw_net), tol, digits)
selections <- split_by_grid_abw.mc(grid, events_loc, lines, max(trim_bw_net), tol, digits)

## step 2 calculating the temp NKDE values
if(verbose){
Expand Down Expand Up @@ -200,6 +200,11 @@ adaptive_bw_tnkde <- function(grid, events_loc, events, lines,
tot_arr <- do.call(abind::abind, lapply(dfs, function(x){x[[1]]}))
all_wids <- do.call(c, lapply(dfs, function(x){x[[2]]}))

## petite galipette pour eviter des valeurs incroyablement basses !
tot_arr <- ifelse(tot_arr < 2.225074e-200, 0, tot_arr)
above_0 <- min(c(tot_arr)[c(tot_arr) > 0])
tot_arr <- ifelse(tot_arr == 0, above_0, tot_arr)

# tot_df <- do.call(rbind,dfs)
# tot_df <- data.frame(tot_df[order(tot_df[,1]),])
# names(tot_df) <- c("goid", "k")
Expand Down Expand Up @@ -354,6 +359,11 @@ adaptive_bw_tnkde.mc <- function(grid, events_loc, events, lines,
tot_arr <- do.call(abind::abind, lapply(dfs, function(x){x[[1]]}))
all_wids <- do.call(c, lapply(dfs, function(x){x[[2]]}))

## petite galipette pour eviter des valeurs incroyablement basses !
tot_arr <- ifelse(tot_arr < 2.225074e-200, 0, tot_arr)
above_0 <- min(c(tot_arr)[c(tot_arr) > 0])
tot_arr <- ifelse(tot_arr == 0, above_0, tot_arr)

# tot_df <- do.call(rbind,dfs)
# tot_df <- data.frame(tot_df[order(tot_df[,1]),])
# names(tot_df) <- c("goid", "k")
Expand Down
5 changes: 3 additions & 2 deletions R/nkde_execution_functions_sf.R
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ adaptive_bw.mc <- function(grid,events,lines,bw,trim_bw,method,kernel_name,max_d
rep(x, nrow(sel$events))
})
}
invisible(capture.output(values <- nkde_worker(lines = sel$lines,
invisible(capture.output(values <- spNetwork::nkde_worker(lines = sel$lines,
events = sel$events,
samples = sel$samples,
kernel_name = kernel_name,
Expand Down Expand Up @@ -900,7 +900,7 @@ adaptive_bw.mc <- function(grid,events,lines,bw,trim_bw,method,kernel_name,max_d
})
}

values <- nkde_worker(lines = sel$lines,
values <- spNetwork::nkde_worker(lines = sel$lines,
events = sel$events,
samples = sel$samples,
kernel_name = kernel_name,
Expand Down Expand Up @@ -996,6 +996,7 @@ adaptive_bw.mc <- function(grid,events,lines,bw,trim_bw,method,kernel_name,max_d
#' @importFrom igraph adjacent_vertices get.edge.ids
#' @return A numeric vector with the nkde values
#' @keywords internal
#' @export
#' @examples
#' #This is an internal function, no example provided
nkde_worker <- function(lines, events, samples, kernel_name, bw, bws, method, div, digits, tol, sparse, max_depth, verbose = FALSE){
Expand Down
9 changes: 7 additions & 2 deletions R/temporal_nkde_sf.R
Original file line number Diff line number Diff line change
Expand Up @@ -483,11 +483,16 @@ tnkde <- function(lines, events, time_field, w, samples_loc, samples_time, kerne
}else{
if(adaptive_separate == TRUE){
## we want to use an adaptive bw in the network space
bws_net <- adaptive_bw(grid, events_loc, lines, bw_net, trim_bw_net, method,
bws_net_all <- adaptive_bw.mc(grid = grid,
events = events_loc,
lines = lines,
bw = bw_net,
trim_bw = trim_bw_net,
method,
kernel_name, max_depth, tol, digits, sparse, verbose)
## and in the time space
bws_time <- adaptive_bw_1d(events$time, w, bw_time, kernel_name)
bws_net <- bws_net[events$goid]
bws_net <- bws_net_all[events$goid]
}else{
interaction_bws <- adaptive_bw_tnkde(grid, events_loc, events, lines,
bw_net, bw_time ,trim_bw_net, trim_bw_time,
Expand Down
2 changes: 1 addition & 1 deletion docs/articles/Isochrones.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/KNetworkFunctions.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4314c43

Please sign in to comment.