-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added helper functions for PointSim class
- Loading branch information
Showing
2 changed files
with
60 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|