voronoi: A function for Voronoi tessellation of pixels to meet some...

View source: R/voronoi.R

voronoiR Documentation

A function for Voronoi tessellation of pixels to meet some minimum particle number threshold

Description

The purpose of this function is to bin particles into Voronoi tesselated pixels which meet a minimum particle per pixel limit to reduce the effects of shot noise on the resulting kinematic measurements.

Usage

voronoi(
  part_in_spaxel,
  obs,
  particle_limit,
  roundness_limit = 0.3,
  uniform_limit = 0.8,
  verbose = F
)

Arguments

part_in_spaxel

The list containing the pixel position ($pixel_pos), contained particle IDs ($ID) and number of particles per pixel ($N) as produced in the build_datacube() function.

obs

The list produced as part of the observation() function for a given mock observation.

particle_limit

Numeric. The minimum number of requested particles per pixel.

roundness_limit

Numeric float between 0 and 1. Default is 0.3. Describes how round pixels should be within the voronoi tesselation, where 0 is perfectly round and 1 is elongated.

uniform_limit

Numeric float between 0 and 1. Default is 0.8. Describes how close to the particle limit joined pixels must be to be binned together.

verbose

Boolean. Default is FALSE. Outputs running commentary of code progress when TRUE.

Value

Returns a list mimicking part_in_spaxel input, but with each row describing a voronoi bin and $pixel_pos describing all pixel positions within that bin. List should contain:

  1. pixel_pos - a numeric array containing all pixel positions within a givien voronoi bin.

  2. ID - a numeric array of the particle IDs belonging within the voronoi bin.

  3. N - the number of particles within the voronoi bin.

Examples

ss_gadget = system.file("extdata", "SimSpin_example_Gadget_spectra.Rdata",
                        package = "SimSpin")
cube = build_datacube(simspin_file = ss_gadget,
                     telescope = telescope(type="SAMI"),
                     observing_strategy = observing_strategy(),
                     voronoi_bin = TRUE, vorbin_limit = 10)


kateharborne/SimSpin documentation built on April 28, 2024, 2 p.m.