# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#' Computing the angular momentum of the particles.
#'
#' The purpose of this function is to compute the angular momentum vector.
#'
#' @param part_data The particles from which you would like to calculate the
#' angular momentum vector, J.
#' @return The numeric vector describing the magnitudes of each component of
#' the angular momentum.
#' @examples
#' galaxy_data = data.frame("ID"=1:100, "x"=stats::rnorm(100),
#' "y"=stats::rnorm(100), "z"=stats::rnorm(100),
#' "vx"=stats::rnorm(100), "vy"=stats::rnorm(100),
#' "vz"=stats::rnorm(100), "Mass"=rep(1,100))
#' J = angmom_galaxy(galaxy_data)
#' @export
angmom_galaxy <- function(part_data) {
.Call('_SimSpin_angmom_galaxy', PACKAGE = 'SimSpin', part_data)
}
#' Centering the galaxy.
#'
#' The purpose of this function is to centre the galaxy such that the origin of the
#' system lies at (0,0,0).
#'
#' @param part_data A data.frame describing the particles ID, positions,
#' velocities and masses.
#' @return A list containing the input data.frame with positions and velocities
#' centered, as well as the median coordiantes and velocities of the original
#' distribution
#' @examples
#' galaxy_data = data.frame("ID"=1:100, "x"=stats::rnorm(100),
#' "y"=stats::rnorm(100), "z"=stats::rnorm(100),
#' "vx"=stats::rnorm(100), "vy"=stats::rnorm(100),
#' "vz"=stats::rnorm(100), "Mass"=rep(1,100))
#' centered_galaxy = cen_galaxy(galaxy_data)
#' @export
cen_galaxy <- function(part_data) {
.Call('_SimSpin_cen_galaxy', PACKAGE = 'SimSpin', part_data)
}
#' Constructing galaxy observation data from the Gadget output file data.
#'
#' The purpose of this function is to produce the observable features of
#' simulation data when taking mock IFU observations.
#'
#' @param part_data A data.frame describing the particle positions and
#' velocities.
#' @param inc_rad The observed inclination angle in radians.
#' @return Returns a data frame containing the original particle information plus the observed
#' z-position (\code{$z_obs}), observed radial position (\code{$r_obs}) and the observed line of
#' sight velocity (\code{$vy_obs}) at the given inclination.
#' @examples
#' galaxy_data = data.frame("x"=stats::rnorm(100), "y"=stats::rnorm(100),
#' "z"=stats::rnorm(100), "vx"=stats::rnorm(100),
#' "vy"=stats::rnorm(100), "vz"=stats::rnorm(100))
#' observed_data = obs_galaxy(galaxy_data, inc_rad = 1.047)
#' @export
obs_galaxy <- function(part_data, inc_rad) {
.Call('_SimSpin_obs_galaxy', PACKAGE = 'SimSpin', part_data, inc_rad)
}
#' Twisting the galaxy relative to the observer.
#'
#' The purpose of this function is to re-orient the galaxy and rotate the
#' observer around the z-axis.
#'
#' @param part_data A data.frame describing the particles positions and
#' velocities.
#' @param twist_rad The observed inclination angle in radians.
#' @return Returns the original data frame containing the original particle
#' information but in the new orientation.
#' @examples
#' galaxy_data = data.frame("x"=stats::rnorm(100), "y"=stats::rnorm(100),
#' "z"=stats::rnorm(100), "vx"=stats::rnorm(100),
#' "vy"=stats::rnorm(100), "vz"=stats::rnorm(100))
#' observed_data = twist_galaxy(galaxy_data, twist_rad = 1.047)
#' @export
twist_galaxy <- function(part_data, twist_rad) {
.Call('_SimSpin_twist_galaxy', PACKAGE = 'SimSpin', part_data, twist_rad)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.