Skip to content

Commit

Permalink
Added helper functions for PointSim class
Browse files Browse the repository at this point in the history
  • Loading branch information
dscolby committed Aug 31, 2021
1 parent 78e38fc commit cb615c4
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 57 deletions.
60 changes: 60 additions & 0 deletions R/PointSim-helpers.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Author: Darren Colby
# Date: 8/31/2021
# Purpose: To provide helper functions for point simulations for the PointSim
# class

# Helper functions for the PointSim class ---------------------------------


#' Simulate a Poisson point process
#'
#' @description helper function to simulate a Poisson point process
#'
#' @usage poisson_process(n, win)
#'
#' @details This function should not be called directly
#'
#' @param n the number of points to simulate
#' @param win a window of class spacejamr to use as the spatial extent
#'
#' @return A ppp object from the 'spatstat.core' package that contains
#' simulated points
#'
#' @author Darren Colby
#' Email: [email protected]
#' @noRd
poisson_process <- function(n, win) {

# Homogeneous point process
point_process <- spatstat.core::rpoint(n = n, win = win)

return(point_process)

}


#' Simulate a 2D Halton Sequence
#'
#' @description helper function to simulate a 2D Halton Sequence
#'
#' @usage halton(n, win)
#'
#' @details This function should not be called directly
#'
#' @param n the number of points to simulate
#' @param win a window of class spacejamr to use as the spatial extent
#'
#' @return A ppp object from the 'spatstat.geom' package that contains
#' contains simulated points
#'
#' @author Darren Colby
#' Email: [email protected]
#' @noRd
halton <- function(n, win) {

# Simulates the Halton sequence
halton_seq <- spatstat.geom::rQuasi(n, win, "Halton")

return(halton_seq)

}
57 changes: 0 additions & 57 deletions R/PointSim.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,6 @@
# Date: 8/31/2021
# Purpose: To simulate spatial point processes

# Helper functions for the PointSim class ---------------------------------


#' Simulate a Poisson point process
#'
#' @description helper function to simulate a Poisson point process
#'
#' @usage poisson_process(n, win)
#'
#' @details This function should not be called directly
#'
#' @param n the number of points to simulate
#' @param win a window of class spacejamr to use as the spatial extent
#'
#' @return A ppp object from the 'spatstat.core' package that contains
#' simulated points
#'
#' @author Darren Colby
#' Email: [email protected]
#' @noRd
poisson_process <- function(n, win) {

# Homogeneous point process
point_process <- spatstat.core::rpoint(n = n, win = win)

return(point_process)

}


#' Simulate a 2D Halton Sequence
#'
#' @description helper function to simulate a 2D Halton Sequence
#'
#' @usage halton(n, win)
#'
#' @details This function should not be called directly
#'
#' @param n the number of points to simulate
#' @param win a window of class spacejamr to use as the spatial extent
#'
#' @return A ppp object from the 'spatstat.geom' package that contains
#' contains simulated points
#'
#' @author Darren Colby
#' Email: [email protected]
#' @noRd
halton <- function(n, win) {

# Simulates the Halton sequence
halton_seq <- spatstat.geom::rQuasi(n, win, "Halton")

return(halton_seq)

}


# Constructor methods for the PointSim class ------------------------------

#' Validate the input to an instance of a PointSim class
Expand Down

0 comments on commit cb615c4

Please sign in to comment.