flip.gridding#
Attributes#
Functions#
|
The _compute_grid_window function computes the window function for a given grid size. |
|
The compute_grid_window function computes the window function for a given grid size and kind. |
|
The construct_grid_regular_sphere function constructs a regular spherical grid. |
|
The construct_grid_regular_rectangular function constructs a regular rectangular grid. |
|
Nearest Grid Point. |
|
Nearest Grid Point with Weighted error. |
|
Cloud In Cell. |
|
Triangular Shaped Cloud. |
|
Triangular Shaped Cloud. |
|
The attribute_weight_density function takes in the grid size, xobj, yobj, zobj (the coordinates of the objects), |
|
|
|
The grid_data_density function takes in the data and grids it using a given grid size. |
|
The cut_grid function is used to remove grid cells from the catalog. |
|
The grid_data_density_pypower function takes in the ra, dec, and rcom values of a galaxy catalog |
|
The grid_data_velocity_pypower function takes in the ra, dec, rcom, variance, and velocity values of a velocity catalog |
Module Contents#
- flip.gridding.log#
- flip.gridding._GRID_KIND = ['ngp', 'ngp_errw', 'cic', 'tsc', 'pcs']#
- flip.gridding._compute_grid_window(grid_size, k, order, n)[source]#
The _compute_grid_window function computes the window function for a given grid size.
- Parameters:
grid_size – Determine the size of the grid
k – Compute the window function
order – Determine the order of the sinc function
n – Determine the number of points in the grid
- Returns:
The window function for a given grid size, k, order and n
- flip.gridding.compute_grid_window(grid_size, kh, kind='ngp', n=1000)[source]#
The compute_grid_window function computes the window function for a given grid size and kind.
- Parameters:
grid_size – Define the size of the grid
kh – Compute the window function
kind – Specify the type of grid
n – Define the number of points used to compute the window function
- Returns:
A window function
- flip.gridding.construct_grid_regular_sphere(grid_size, rcom_max)[source]#
The construct_grid_regular_sphere function constructs a regular spherical grid.
- Parameters:
grid_size – Determine the number of grid voxels per axis
rcom_max – Cut the grid with rcom_max
- Return type:
A dictionary with the following keys
- flip.gridding.construct_grid_regular_rectangular(grid_size, rcom_max)[source]#
The construct_grid_regular_rectangular function constructs a regular rectangular grid.
- Parameters:
grid_size – Determine the number of grid voxels per axis
rcom_max – Determine the size of the grid
- Returns:
A dictionary with the grid coordinates
- flip.gridding.attribute_weight_density(grid_size, xobj, yobj, zobj, xgrid, ygrid, zgrid, weight_fun)[source]#
The attribute_weight_density function takes in the grid size, xobj, yobj, zobj (the coordinates of the objects), xgrid, ygrid and zgrid (the coordinates of the grid) and a weight function. It then calculates how many objects are in each cell by using a for loop to iterate through all of them. The dX is calculated by taking the difference between each object’s x coordinate and each cell’s x coordinate divided by grid_size. This is done for both dY and dZ as well. The w variable is calculated using this formula: w = weight_fun(dX)
- Parameters:
grid_size – Normalize the distances between objects and grid points
xobj – Store the x coordinates of all objects in a galaxy
yobj – Create a grid of y values
zobj – Calculate the z-component of the distance between a grid point and an object
xgrid – Define the x-coordinate of each grid cell
ygrid – Calculate the distance between the object and grid
zgrid – Determine the z-coordinate of the grid cell
weight_fun – Determine the weight of each object
- Returns:
A tuple of three arrays
- flip.gridding.define_randoms(random_method, xobj, yobj, zobj, raobj, decobj, rcomobj, Nrandom=None, coord_randoms=None, max_coordinates=None)[source]#
- flip.gridding.grid_data_density(grid, grid_size, ra, dec, rcom, kind='ngp', n_cut=None, weight_min=None, verbose=False, compute_density=True, Nrandom=10, random_method='cartesian', coord_randoms=None)[source]#
The grid_data_density function takes in the data and grids it using a given grid size. It also computes the density of each voxel, as well as its error.
- Parameters:
grid – Store the grid properties
grid_size – Define the size of each voxel in mpc/h
ra – Define the right ascension of the object
dec – Compute the cartesian coordinates of the objects
rcom – Compute the comoving distance of each object
kind – Select the method used to compute voxcell values
n_cut – Cut the grid in cells with a minimum number of objects
weight_min – Cut the grid
verbose – Print the number of cells in the grid
compute_density – Compute the density field
Nrandom – Create random points in the grid_data_density function
random_method – Choose the method to create random points
:param : Define the grid size
- Return type:
A dictionary with the following keys
- flip.gridding.cut_grid(grid, remove_nan_density=True, remove_empty_cells=False, n_cut=None, weight_min=None, rcom_max=None, xmax=None, ymax=None, zmax=None, remove_origin=False)[source]#
The cut_grid function is used to remove grid cells from the catalog.
- Parameters:
grid – Pass the grid data to the function
remove_nan_density – Remove any cells that have a density of nan
n_cut – Remove grid cells with less than n_cut stars
weight_min – Remove cells with too few stars
rcom_max – Cut the grid by a maximum comoving distance
xmax – Remove the cells that are too far away from the center of mass
ymax – Cut the grid in y direction
zmax – Cut the grid in z direction
remove_origin – Remove the origin of the grid
- Returns:
A dictionary with the same keys as grid, but where
- flip.gridding.grid_data_density_pypower(raobj, decobj, rcomobj, rcom_max, grid_size, grid_type, kind, Nrandom=10, random_method='cartesian', interlacing=2, compensate=False, coord_randoms=None, min_count_random=0, overhead=20)[source]#
The grid_data_density_pypower function takes in the ra, dec, and rcom values of a galaxy catalog and returns a grid of density contrast values. The function uses pypower to create the grid. The function also has options for creating random points using different methods: choice, healpix, or cartesian.
- Parameters:
raobj – Pass the ra values of the data
decobj – Calculate the z coordinate of the object in cartesian coordinates
rcomobj – Calculate the comoving distance of each galaxy
rcom_max – Cut the grid in a sphere of radius rcom_max
grid_size – Determine the size of each cell in the grid
grid_type – Determine whether to use a rectangular or spherical grid
kind – Set the resampler in the catalogmesh function
Nrandom – Determine the number of random points to be generated
random_method – Choose the method used to generate random points
interlacing – Reduce the variance of the density field
compensate – Correct for the fact that we are using a finite number of random points
:param : Remove the nan values from the grid
- Returns:
A dictionary with the grid coordinates and density contrast values
- flip.gridding.grid_data_velocity_pypower(raobj, decobj, rcomobj, rcom_max, variance, velocity, grid_size, grid_type, kind, interlacing=0, compensate=False, overhead=20)[source]#
The grid_data_velocity_pypower function takes in the ra, dec, rcom, variance, and velocity values of a velocity catalog and returns a grid of variance and velocities. The function uses pypower to create the grid.
- Parameters:
raobj – Pass the ra values of the data
decobj – Calculate the z coordinate of the object in cartesian coordinates
rcomobj – Calculate the comoving distance of each galaxy
rcom_max – Cut the grid in a sphere of radius rcom_max
variance – variance of the data points
velocity – veloctity of the data
grid_size – Determine the size of each cell in the grid
grid_type – Determine whether to use a rectangular or spherical grid
kind – Set the resampler in the catalogmesh function
Nrandom – Determine the number of random points to be generated
random_method – Choose the method used to generate random points
interlacing – Reduce the variance of the density field
compensate – Correct for the fact that we are using a finite number of random points
:param : Remove the nan values from the grid
- Returns:
A dictionary with the grid coordinates and density contrast values