Randomize {MCBackscattering}R Documentation

Random Numbers Selection for Single Photon Trajectory

Description

This function prepares vectors of random numbers to accelerate trajectory computation. Random numbers are selected from uniform distribution.

Usage

Randomize(myObject)

Arguments

myObject

The mandatory parameter of this function is the MCBS class created by MCBS constructor function.

Details

The Randomize function, alias Randomize.MCBS, puts random numbers into the container vectors created with the object. During trajectory computation, each interaction event occurs randomly. Prepared container vectors accelerate computation, since values for each event are accessible with myObject$midx move index. Vector length myObject$MAXLEN is adjusted by Setup function based on transport albedo and limiting energy.

Value

The Randomize function returns an MCBS object as class. Typically the same object is used in argument and result. There are five containers of random numbers. Values are in the range of 0 to +1 unless indicated in description.

rmv

length of linear section between interaction events. Used by Move function.

rabs

decision values for roulette algorithm. Used by Absorb function.

rx1

new scattering direction in the range of -1 to +1. Used by Scatter function.

rx1

new scattering direction in the range of -1 to +1. Used by Scatter function.

rmu

variable for Heyney-Greenstein phase function. Used by Scatter function.

Note

Please note that this function is designed to be used in Simulation function. You may use it separately in case you design your own procedure. In such a case, please note that function Randomize prepares random values for one photon and has to be run always before calculating single photon trajectory.

See Also

MCBS for construction of object with initial input parameters. Simulation for running the simulation with adjusted parameters. Chart for plot of calculated photon flux profile. Export for export of photon flux with corresponding radii. Setup for initial computation of specular reflection and transport albedo. Move for moving single photon forward. Absorb for absorption of single photon energy in interaction with media. Scatter for single photon scattering interaction with media.

Examples

## Apple simulation data according to Qin and Lu (2006).
## DOI: 10.13031/2013.20862

# create object
cfgMedia <- c(0.63,30,0,1.4)
cfgSimulation <- c(1e6,0.05,1e-9,3,0.012)
apple <- MCBS(cfgMedia,cfgSimulation)
apple <- Setup(apple)

# first five random values of move length
apple <- Randomize(apple)
apple$rmv[1:5]

[Package MCBackscattering version 0.1.1 Index]