# Grid test.m

Plots grid integration quality as a function of spherical rank.

## Syntax

    grid_profile=grid_test(alphas,betas,gammas,weights,max_rank,sfun)


## Description

The quality of a grid is defined as the norm of the residual of spherical harmonics or Wigner functions integrated using the grid provided.

## Arguments

     alphas - alpha Euler angles of the grid, in radians,
zeros for single-angle grids

betas - beta Euler angles of the grid, in radians

gammas - gamma Euler angles of the grid, in radians,
zeros for two-angle grids

weights - point weights of the grid

max_rank - maximum spherical rank to consider

sfun - spherical function type: for three-angle
grids use 'D_lmn', for two-angle grids use
'Y_lm', for single-angle grids use 'Y_l0'.


## Returns

   grid_profile - a vector of residual norms in each spherical rank


The function also produces a figure showing the absolute value of the integration residual as a function of the spherical rank.

## Examples

Perfomance of the 400-point 2-angle REPULSION grid on spherical harmonics of different ranks.

## Notes

A good grid produces near-zero answers for as many spherical ranks as possible.