Skip to content

Commit

Permalink
Add b in x3ptools::x3p_average as parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
YuhangTom committed Sep 24, 2023
1 parent 0c2ecca commit b29623b
Show file tree
Hide file tree
Showing 18 changed files with 45 additions and 37 deletions.
2 changes: 1 addition & 1 deletion R/df_rmtrend_x3p.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' mask_col <- "#FF0000"
#' concavity <- 1.5
#'
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity)
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity, b = 1)
#'
#' x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df)
#' x3p_inner_nomiss_res
Expand Down
4 changes: 2 additions & 2 deletions R/vec_align_sigs_list.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
#' mask_col <- "#FF0000"
#' concavity <- 1.5
#'
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity)
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity, b = 1)
#' x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df)
#' x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, x3p, mask_col = mask_col,
#' concavity = concavity, ifsave = FALSE, dir_name = NULL, ifplot = FALSE)
#' concavity = concavity, b = 1, ifsave = FALSE, dir_name = NULL, ifplot = FALSE)
#'
#' x3p_bin_rotate <- x3p_vertical(x3p_inner_impute, min_score_cut = 0.1)
#' vec_align_sigs_list(x3p_raw_sig_vec(x3p_bin_rotate), x3p_shift_sig_vec(x3p_bin_rotate),
Expand Down
4 changes: 2 additions & 2 deletions R/x3p_MLE_angle_vec.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
#' mask_col <- "#FF0000"
#' concavity <- 1.5
#'
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity)
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity, b = 1)
#' x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df)
#' x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, x3p, mask_col = mask_col,
#' concavity = concavity, ifsave = FALSE, dir_name = NULL, ifplot = FALSE)
#' concavity = concavity, b = 1, ifsave = FALSE, dir_name = NULL, ifplot = FALSE)
#'
#' x3p_MLE_angle_vec(x3p_inner_impute, min_score_cut = 0.1, ifplot = TRUE)
#'
Expand Down
10 changes: 6 additions & 4 deletions R/x3p_impute.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#' @param x3p_mask x3p object for mask
#' @param mask_col colour for the polygon
#' @param concavity strictly positive value used in \code{concaveman::concaveman}
#' @param b positive integer value, block size, used in \code{x3ptools::x3p_average}
#' @param ifsave whether the imputation procedure gif is going to be saved
#' @param dir_name required when \code{ifsave} is \code{TRUE}
#' @param ifplot whether graphs are displayed
Expand All @@ -24,19 +25,20 @@
#' mask_col <- "#FF0000"
#' concavity <- 1.5
#'
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity)
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity, b = 1)
#' x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df)
#'
#' x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, x3p, mask_col = mask_col,
#' concavity = concavity, ifsave = FALSE, dir_name = NULL, ifplot = TRUE)
#' concavity = concavity, b = 1, ifsave = FALSE, dir_name = NULL, ifplot = TRUE)
#' x3p_inner_impute
#'
#' if (interactive()) {
#' x3p_image_autosize(x3p_inner_impute)
#' }
#'
x3p_impute <- function(x3p, x3p_mask, mask_col = "#FF0000",
concavity = 1.5, ifsave = FALSE, dir_name = NULL, ifplot = FALSE) {
concavity = 1.5, b = 10,
ifsave = FALSE, dir_name = NULL, ifplot = FALSE) {
layer <-
x <-
y <-
Expand Down Expand Up @@ -170,7 +172,7 @@ x3p_impute <- function(x3p, x3p_mask, mask_col = "#FF0000",
x3p_surface_polygon(colour = mask_col, concavity = concavity)
### Extract inner part as x3p based on mask
x3p_inner <- x3p_extract(x3p_mask, mask_vals = mask_col) %>%
x3p_average(b = 1, na.rm = TRUE)
x3p_average(b = b, na.rm = TRUE)
x3p_inner_focal_impute <- x3p_add_mask(x3p_inner_focal_impute, x3p_inner$mask)

x3p_inner_impute <- x3p_inner_focal_impute %>%
Expand Down
7 changes: 4 additions & 3 deletions R/x3p_insidepoly_df.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#' @param x3p x3p object
#' @param mask_col colour for the polygon
#' @param concavity strictly positive value used in \code{concaveman::concaveman}
#' @param b positive integer value, block size, used in \code{x3ptools::x3p_average}
#' @return data frame of inside polygon
#' @import dplyr
#' @importFrom x3ptools x3p_extract x3p_average x3p_to_df
Expand All @@ -17,10 +18,10 @@
#' mask_col <- "#FF0000"
#' concavity <- 1.5
#'
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity)
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity, b = 1)
#' str(insidepoly_df)
#'
x3p_insidepoly_df <- function(x3p, mask_col = "#FF0000", concavity = 1.5) {
x3p_insidepoly_df <- function(x3p, mask_col = "#FF0000", concavity = 1.5, b = 10) {
to <-
from <-
neighbor_val <-
Expand All @@ -35,7 +36,7 @@ x3p_insidepoly_df <- function(x3p, mask_col = "#FF0000", concavity = 1.5) {

### Extract inner part as x3p based on mask
x3p_inner <- x3p_extract(x3p, mask_vals = mask_col) %>%
x3p_average(b = 1, na.rm = TRUE)
x3p_average(b = b, na.rm = TRUE)

x3p_inner_df <- x3p_inner %>%
x3p_to_df()
Expand Down
4 changes: 2 additions & 2 deletions R/x3p_quantile_angle_vec.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
#' mask_col <- "#FF0000"
#' concavity <- 1.5
#'
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity)
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity, b = 1)
#' x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df)
#' x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, x3p, mask_col = mask_col,
#' concavity = concavity, ifsave = FALSE, dir_name = NULL, ifplot = FALSE)
#' concavity = concavity, b = 1, ifsave = FALSE, dir_name = NULL, ifplot = FALSE)
#'
#' x3p_quantile_angle_vec(x3p_inner_impute, min_score_cut = 0.1, ifplot = TRUE)
#'
Expand Down
4 changes: 2 additions & 2 deletions R/x3p_raw_sig_vec.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
#' mask_col <- "#FF0000"
#' concavity <- 1.5
#'
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity)
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity, b = 1)
#' x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df)
#' x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, x3p, mask_col = mask_col,
#' concavity = concavity, ifsave = FALSE, dir_name = NULL, ifplot = FALSE)
#' concavity = concavity, b = 1, ifsave = FALSE, dir_name = NULL, ifplot = FALSE)
#'
#' x3p_bin_rotate <- x3p_vertical(x3p_inner_impute, min_score_cut = 0.1)
#' x3p_raw_sig_vec(x3p_bin_rotate, ifplot = TRUE) %>%
Expand Down
4 changes: 2 additions & 2 deletions R/x3p_shift_sig_vec.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
#' mask_col <- "#FF0000"
#' concavity <- 1.5
#'
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity)
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity, b = 1)
#' x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df)
#' x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, x3p, mask_col = mask_col,
#' concavity = concavity, ifsave = FALSE, dir_name = NULL, ifplot = FALSE)
#' concavity = concavity, b = 1, ifsave = FALSE, dir_name = NULL, ifplot = FALSE)
#'
#' x3p_bin_rotate <- x3p_vertical(x3p_inner_impute, min_score_cut = 0.1)
#' if (interactive()) {
Expand Down
4 changes: 2 additions & 2 deletions R/x3p_vertical.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
#' mask_col <- "#FF0000"
#' concavity <- 1.5
#'
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity)
#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity, b = 1)
#' x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df)
#' x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, x3p, mask_col = mask_col,
#' concavity = concavity, ifsave = FALSE, dir_name = NULL, ifplot = FALSE)
#' concavity = concavity, b = 1, ifsave = FALSE, dir_name = NULL, ifplot = FALSE)
#'
#' x3p_bin_rotate <- x3p_vertical(x3p_inner_impute, min_score_cut = 0.1, ifplot = TRUE)
#' x3p_bin_rotate
Expand Down
2 changes: 1 addition & 1 deletion man/df_rmtrend_x3p.Rd

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

4 changes: 2 additions & 2 deletions man/vec_align_sigs_list.Rd

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

4 changes: 2 additions & 2 deletions man/x3p_MLE_angle_vec.Rd

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

7 changes: 5 additions & 2 deletions man/x3p_impute.Rd

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

6 changes: 4 additions & 2 deletions man/x3p_insidepoly_df.Rd

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

4 changes: 2 additions & 2 deletions man/x3p_quantile_angle_vec.Rd

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

4 changes: 2 additions & 2 deletions man/x3p_raw_sig_vec.Rd

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

4 changes: 2 additions & 2 deletions man/x3p_shift_sig_vec.Rd

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

4 changes: 2 additions & 2 deletions man/x3p_vertical.Rd

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

0 comments on commit b29623b

Please sign in to comment.