# Help for "shapelets_chi" routine:

## Calculate 2D polar shapelet basis functions.

This routine calculates the 2D polar shapelet basis functions chi. It can be called using basis=shapelets_chi([2,0],1,1).

The first argument specifies that the n=2, m=0 basis function should be calculated. The second and third argumentscontain the position where the basis function should be evaluated, in (x,y) Cartesian coordinates. This could be replaced by a grid of points, such as those created by shapelets_make_xarr.pro, where x1 is an array containing the x positions and x2 is an array of the same size containing the y positions. Optionally, beta can be specified by adding e.g. beta=1.4, but if it is not, beta is assumed to be unity. Frequently elsewhere in the shapelets code, the x1 and x2 are rescaled instead to create the same effect.

Setting the flag /INTEGRATE integrates the basis functions within rectangular pixels centred on the (x1,x2) grid points, rather than just calculating the central pixel value. Setting the flag /ARRAY returns an array containing all polar shapelet basis functions with n less than or equal to that input. Since the (integrated) polar shapelet basis functions are calculated using a recursion relation anyway, this is no slower ad can be useful (e.g. for simultaneously fitting all of the shapelet coefficients).

```; NAME:
;      SHAPELTS_CHI
;
; CATEGORY:
;      Shapelets.
;
; PURPOSE:
;      Compute (dimensionless) 2D polar shapelet basis functions chi_n_m(x,y),
;      based on Laguerre polynomials. Dimensional basis functions
;      can be calculated with shapelets_chi(nm,x1/beta[,x2/beta])/beta.
;
; INPUTS:
;      nm         - Basis function order. Integer vector [n,m].
;
; OPTIONAL INPUTS:
;      x1         - Grid of x coordinates (e.g. created by shapelets_make_xarr.pro).
;      x2         - Grid of y coordinates.
;      BETA       - Shapalet scale size beta.
;      ELLIPTICITY- Ellipticity of basis functions, in weak lensing notation:
;                   either [e1,e2] or complex(e1,e2), where e1=e*cos(2theta) and
;                   e2=e*sin(2theta), with e=(a-b)/(a+b) for major and minor axes
;                   and theta is the angle of the major axis, a/c/w from x axis.
;      THETA_ZERO - Basis functions are rotated by this anlge, a/c/w from x axis.
;
; KEYWORD PARAMETERS:
;      /INTEGRATE - Default behaviour is to simply evaluate phi at the centre
;                   of each pixel. If /INTEGRATE is set, the routine will use
;                   the recursion relation in Shapelets III to integrate the
;                   the Cartesian basis functions within pixels, then convert
;                   these to polar shapelets via the matrix in Shapelets I.
;      /ARRAY     - Instead of just returning one basis function, if /AARRAY is
;                   set, the routine will return an array containing all of
;                   the (pixellated) basis functions up to n_max=n.
;
; OUTPUTS:
;      Polar shapelet basis function chi_n1[_n2](x[,y]), in a complex array.
;
; EXAMPLE USE:
;      plot,r,shapelets_chi(4,r,beta=1),psym=-3
;      tvscl,float(shapelets_chi([2,2],/integrate))
;
; MODIFICATION HISTORY:
;      Jan 09 - Division error if beta and X1, X2 are integers caught by RM.
;      Apr 07 - RM added theta_zero option.
;      Mar 07 - Elliptical basis functions added by RM.
;      Jul 05 - 1D basis functions enabled by RM.
;      Jul 05 - Minus sign in definition of polar basis functions fixed by RM.
;      Jul 05 - BETA input added by RM to make dimensionful basis functions.
;      Oct 03 - Written by R. Massey.
```