Helper Functions¶
Summary¶
Functions¶
after_new_electronics
function after_new_electronics, tag
I have in my notes that the new read-out electronics were
installed on March 4. ;
They were then removed around March 27
They were then reinstalled in on June 4th.;
new function that analyzes the _when
tag and treturns 1 is it is after
the new electronics were installed (which makes the read time faster)
ca_ccid_align_and_internal
pro ca_ccid_align_and_internal, analyze=aflag, return=rflag, noplots=noplots, dontuseflat=duflag, thisflat=tfflag, stop=stopflag
No header information available.
ca_locate_actuators
pro ca_locate_actuators, phaseoverride_tweet=ptflag, demo=dflag, tweet=tflag, woof=wflag, nosave=nosaveflag, ttover=ttover, stop=stopflag, from_mems_flat=fmfflag, less_poke=lpflag, smallerpupil=spflag, analyze=aflag, gory=goryflag, otherway=otherflag, removezerns=rzflag, white=whiteflag
No header information available.
cal_find_white_light_fringe
function cal_find_white_light_fringe, raw_ims=raw_ims, pos=pos, display=display
NAME:
cal_find_white_light_fringe;
PURPOSE:
Analyze the fringe scan to find the white light fringe
EXPLANATION:
This identifies the location of the fringe by looking
at the variance of each slice relative to the median
image created by collapsing the cube. Pixels that have
a value less than the 3*readnoise are discarded.
The function returns the peak value, no files are
modified and no motors are moved.
If no inputs are provided the most recent files
are used.
Calling SEQUENCE:
cal_find_white_light_fringe
INPUT/OUTPUT:
testing - only used for development offline - will be descoped
OPTIONAL OUTPUT:
errout - 1 on error condition
EXAMPLES:
REVISION HISTORY
Written, 11/12/2015 by PI
cal_parse_default_file
function cal_parse_default_file, filename
NAME:
cal_parse_default_file
PURPOSE:
This parses the CAL DEFAULT file into a two-column array with one row for each file line.
This allows modification of the parameters.
CALLING SEQUENCE:
output = cal_parse_default_file(filename)
INPUT/OUTPUT:
filename - Full path and filename to read CAL DEFAULT file from.
output - 2 x N array, with N the number of lines in the file contained in filename.
OPTIONAL OUTPUT:
None
EXAMPLE:
output = cal_parse_default_file('/data1/cal/config/DEFAULT')
DEPENDENCIES:
None.
NOTES:
If the line is a comment (starting with zero), the first element of the row is '#'
and the second is the entire comment, including '#'.
If the line is blank, the first and second elements of the row are both ''.
If the first element of the row is the variable name (key), and the second is the value, stored as a string.
REVISION HISTORY
Written, 11/12/2015 by Eric Cady and PI
cal_peek
pro cal_peek, autoscale=autoscale, howfs=howfs, outim=caltest, silent=silent, calmag=calmag
NAME:
cal_peek
PURPOSE:
Take LOWFS or HOWFS images, display and calculate basic
statistics.
EXPLANATION:
Wrapper for tlc_command_take_cal_exp
CALLING SEQUENCE:
cal_peek,[options]
INPUT/OUTPUT:
/autoscale - Auto scale output image
/howfs - Use HOWFS (default to LOWFS)
/silent - Don't print stats
OPTIONAL OUTPUT:
outim = Raw HOWFS or LOWFS image.
EXAMPLE:
DEPENDENCIES:
Assumes access to executables in $TLC_ROOT and accessible connection to server tlc.
tlc_command_take_cal_exp
NOTES:
REVISION HISTORY
Written by Bruce Macintosh somewhere in the mists of time.
Modified by bmac 11/27/2012 to draw the subap boundaries and
reduce navigational confusion
02.26.2013 - Updated mag calculation.
cal_update_default_file
pro cal_update_default_file, param_arr, value_arr, orig_file=orig_file, new_file=new_file, dir=dir, clobber=clobber, no_load=no_load
NAME:
cal_update_default_file
PURPOSE:
This is meant to update portions of the defaults file in a scriptable manner, create a new file, then
load it into the tlc (optional). This is really a work around to allow us to do fringe finding and scans.
CALLING SEQUENCE:
cal_update_default_file, param_arr, value_arr, orig_file=orig_file, new_file=new_file, dir=dir, /clobber
INPUT/OUTPUT:
param_arr - a string array with the parameters requiring changes
value_arr - a string array with the values for each parameter in param_arr
orig_file - the DEFAULT file requiring modification. If not declared than the
standard DEFAULT file will be used
new_file - the new DEFAULT file to be written
dir - directory for the orig_file and new_file. Defaults to '$CAL_ROOT/config'
clobber - overwrite the new DEFAULT file should it already exist
no_load - only write the new DEFAULT file
OPTIONAL OUTPUT:
None
EXAMPLE:
cal_update_default_file, ['AcqFringeCoarseStageNominalPos','AcqFringeCoarseStageScanRange'],$
['204.00','30.00'], orig_file='DEFAULT', new_file='DEFAULT_151011', /clobber
DEPENDENCIES:
None.
NOTES:
None.
REVISION HISTORY
Written, 11/12/2015 by PI
cal_update_default_value
function cal_update_default_value, key, value, outarray
NAME:
cal_update_default_value
PURPOSE:
Given an output array from parse_default_array representing the parsed
contents of a DEFAULT file, update the value of a key. Keys are case-insensitive.
CALLING SEQUENCE:
output = cal_parse_default_array(filename)
INPUT/OUTPUT:
key (string): parameter in config file to update. Case insensitive.
value (string, float, int): value of parameter to update
outarray (array): Output of parse_default_array, possibly modified.
See cal_parse_default_file procedure for syntax.
Output is same as input; also updated in place.
OPTIONAL OUTPUT:
None
EXAMPLE:
output = cal_update_default_value('AcqFringeCoarseStageNominalPos','204.00')
DEPENDENCIES:
None.
NOTES:
If the key is not present, the function will warn and the array will be unchanged.
If the key is duplicated in the file, the function will warn and replace all instances.
REVISION HISTORY
Written, 11/12/2015 by Eric Cady and PI
cal_write_default_file
pro cal_write_default_file, filename, outarray, clobber=clobber
NAME:
cal_write_default_file
PURPOSE:
Given an output array from cal_parse_default_array representing the parsed
contents of a DEFAULT file, write a new file using that array.
CALLING SEQUENCE:
output = cal_parse_default_array(filename)
INPUT/OUTPUT:
filename (string): Output file. Requires path.
outarray (array): Output of parse_default_array, possibly modified. See cal_parse_default_file for array syntax.
clobber (0/1): whether to overwrite the file if it already exists.
OPTIONAL OUTPUT:
None
EXAMPLE:
cal_write_default_file,'DEFAULT_20151225',outarray,/clobber
DEPENDENCIES:
None.
NOTES:
REVISION HISTORY
Written, 11/12/2015 by Eric Cady and PI
calculate_intensities
function calculate_intensities, wfsimg0, flat=flat, dark=dark, nozeromasking=nzflag
No header information available.
calculate_slopes
pro calculate_slopes, img0, xslopes, yslopes, pixels=pixflag, centroid=cflag, threshold=tflag, weighted=wflag, correlation=corflag, suboverride=sflag, binned=binnedflag, nobinscaling=nbsflag, nozeromasking=nzflag, use_cent_thresh=ucflag
No header information available.
get_av_flux (center_fpm.pro)
function get_av_flux, n=n, verb=verb
balancefluxes (center_fpm.pro)
function balancefluxes, axis, mv, verb=verb
center_fpm (center_fpm.pro)
pro center_fpm, band=band, verb=verb, nocheck=nocheck
No header information available.
get_av_flux (center_fpm_cl.pro)
function get_av_flux, n=n, ttout=ttout, verb=verb
balancefluxes_cl (center_fpm_cl.pro)
function balancefluxes_cl, axis, mv, verb=verb
center_fpm_cl (center_fpm_cl.pro)
pro center_fpm_cl, band=band, verb=verb, nocheck=nocheck
No header information available.
complexmp
function complexmp, mag, ph
No header information available.
constrained_quadratic_fit
function constrained_quadratic_fit, volts, phase, biasv
No header information available.
convert_sincos2complex
function convert_sincos2complex, series
No header information available.
dadsot_format_number
function dadsot_format_number, number0, dec
No header information available.
determine_and_display_second_order_transforms
pro determine_and_display_second_order_transforms, diffx0, diffy0, valid0, demo=dflag, uname=uname, reconstruct=rflag, prec=precflag, stop=stopflag, getback_numbers=gbnflag, getback_signals=gbsflag, woofspec=woofspecflag, gory=goryflag
NAME:
determine_and_display_second_order_transforms
PURPOSE:
Used to determine the alignment of a set of actuators to the
nominal grid (e.g. rotation, translation). Used by several
other functions.
EXPLANATION:
see above.
Calling SEQUENCE:
determine_and_display_second_order_transforms, diffx0, diffy0, valid0, [/demo, uname=uname, $
/reconstruct, prec=precflag, stop=stopflag, getback_numbers=gbnflag, getback_signals=gbsflag,$
woofspec=woofspecflag, gory=goryflag
INPUT/OUTPUT:
OPTIONAL OUTPUT:
None.
EXAMPLE:
DEPENDENCIES:
exptv
NOTES:
Way too many options here! The codes that call this work, so go
based on those before mucking around with changing things!
REVISION HISTORY
written in 2011 by LAP.
detilt
function detilt, ph, ap, tx, ty
detilt - remove tilt over an aperture
USAGE:
phdt = detilt(ph,ap)
INPUTS:
ph - phase
ap - aperture
OUTPUTS:
phdt - phase with tilt removed
tx, ty - (optional) tip and tilt coefficients (units: phase/pixel)
dopca
function dopca, x, y
No header information available.
ellip_hough
function ellip_hough, im, majorAxis=majorAxis, maxRotation=maxRotation, maxe=maxe
NAME:
ellip_hough
PURPOSE:
Find ellipses in field via generalized Hough transform
EXPLANATION:
CALLING SEQUENCE:
ellip_hough,im [,majorAxis=[min,max], maxRotation = ang]
INPUT/OUTPUT:
im - 2D image
majorAxis - [min, max] semi-major axis values to look for
maxRotation - maximum ellipse rotation
OPTIONAL OUTPUT:
Best (highest scoring) ellipse: [x0, y0, a, b, alpha, pow]
where x0,y0 are the center, a & b are the semi-major/minor
axes, alpha is the rotation angle, and pow is the score.
EXAMPLE:
DEPENDENCIES:
None.
NOTES:
Algorithm from Yonghong Xie Qiang and Qiang Ji, 2002
REVISION HISTORY
Written 03/19/2012. savransky1@llnl.gov
Based on code by Martin Simonovsky
extend
function extend, vector, dimension, length
extend - general purpose extend dimensions routine
USAGE:
e = extend(vector,dimension,m)
INPUTS:
vector - a 1-D n-vector
dimension - dimension to extend
1: || the vector is treated as a column, replicated m columns wide
2: = the vector is treated as a row and replicated m rows high
m - other dimension (number of replicas)
m is optional; if not given, m=n (size of vector)
OUTPUT:
an array of size m x n if dimension = 1
size n x m if dimension = 2
extend_grid_var3
PRO extend_grid_var3, subapmask, gx, gy, const
No header information available.
fftw
function fftw, arg, dir, pat=pat
No header information available.
fill_out_to_hermitian
function fill_out_to_hermitian, filt, phase=pflag
No header information available.
find_poke_location
function find_poke_location, phase, tweet=tflag, woof=wflag, peak=pflag, demo=dflag
No header information available.
findsubpro
pro findsubpro, in, proc=proc, fun=fun, ccase=ccase
NAME:
findsubpro
PURPOSE:
Find all files in IDL path containing a specified procedure/function
EXPLANATION:
greps all .pro files in idl path looking for input matches
CALLING SEQUENCE:
findsubpro,in ,[/pro,/fun]
INPUT/OUTPUT:
in - String containing desired procedure name
/proc - look specifically for procedures
/fun - look specifically for functions
/ccase - case sensitive (insensitive by default)
OPTIONAL OUTPUT:
EXAMPLE:
findsubpro,'aocSocket_close'
DEPENDENCIES:
assume posix system with grep installed
NOTES:
Both procedures and functions are looked for if neither option
is set.
REVISION HISTORY
Written 12/21/2011. savransky1@llnl.gov
fit_zernmodes
function fit_zernmodes, signal, nz0, phase=phaseflag, pingrid=pflag
No header information available.
fix_mapping
pro fix_mapping, mapping
No header information available.
ft
function ft, a, inverse=inverse
No header information available.
computeSlopes (ftwfs.pro)
function computeSlopes, a, subapFilter=subapFilter, differenceMethod=differenceMethod, geometry=geometry, verbose=verbose, cx=cx, cy=cy
ftwfs_iterative (ftwfs.pro)
function ftwfs_iterative, sx, sy, ap, warmRestart=a0, subapFilter=subapFilter, geometry=geometry, verbose=verbose, boundaryFix=boundaryFix, niter=niter, differenceMethod=differenceMethod, dewaffle=dewaffle, noiseVar=noiseVar, _extra=ex
deNyquist (ftwfs.pro)
function deNyquist, a
ftwfs (ftwfs.pro)
function ftwfs, sx, sy, ap, subapFilter=subapFilter, geometry=geometry, verbose=verbose, boundaryFix=boundaryFix, niter=niter, rx=rx, ry=ry, r=r, noiseVar=noiseVar, dewaffle=dewaffle, _extra=ex
No header information available.
function gen_avg_coper_unb, closedloop_data1, closedloop_data2, interval_length, halfover=halfflag, meanrem=mrflag, nofftw=nofftwflag, hanning=hflag, hamming=hmflag
No header information available.
function gen_avg_per_unb, closedloop_data, interval_length, halfover=halfflag, meanrem=mrflag, nofftw=nofftwflag, hanning=hflag, hamming=hmflag
No header information available.
gen_ellipse
function gen_ellipse, elparms, N=N
NAME:
gen_ellipse
PURPOSE:
Return x&y coordinates of an ellipse specified by elparms with
N points.
EXPLANATION:
See above
CALLING SEQUENCE:
out = gen_ellipse(elparms,[N=N])
INPUT/OUTPUT:
ellparms - Ellipse parameters (see ellip_hough for details).
N - Number of points, defaults to 100
out - 2xN array of x,y coords.
OPTIONAL OUTPUT:
EXAMPLE:
DEPENDENCIES:
None.
NOTES:
REVISION HISTORY
Written 03/20/2012 - savransky1@llnl.gov
gen_lines
function gen_lines, p1, p2, N=N
No header information available.
gen_per_unb
function gen_per_unb, closedloop_data, nofftw=nofftwflag, hanning=hflag, hamming=hmflag
No header information available.
geocluster
function geocluster, im, N=N
No header information available.
get_comments
function get_comments
No header information available.
gpi_correct_size
function gpi_correct_size, sig, tweet=tflag, woof=wflag, wfs=wfsflag, cent=centflag, status=sflag, scicam=sciflag, tt=ttflag, quiet=quietflag, silent=silentflag, telemtt=telemttflag, telemclip=telemclipflag
No header information available.
grab_hotspots
function grab_hotspots, im0, N, rad=rad, grad=grad, nofix=nofix, gaussfit=gaussfit
No header information available.
hartmann_gpical
pro hartmann_gpical, im
No header information available.
least_square_fit
function least_square_fit, xdata0, ydata0, order
No header information available.
load_actuator_locations
pro load_actuator_locations, xcoor=xc, ycoor=yc, tweet=tflag, woof=wflag
NAME:
load_actuator_locations
PURPOSE:
load the actuator locations from disk for use
EXPLANATION:
see above.
Calling SEQUENCE:
save_actuator_locations, xcoor=xc, ycoor=yc, [/tweet, /woof]
INPUT/OUTPUT:
x locations (unit is twt actuators) in variable xc
y locations (unit is twt actuators) in variable yc
/tweet specifies a Twt signal (will catch if wrong size)
/woof specifies a Wfr signal (will catch if wrong size)
writes two files to disk
OPTIONAL OUTPUT:
None.
EXAMPLE:
oad_actuator_locations, x=xc, y=yc, /tweet
DEPENDENCIES:
gpi_correct_size
NOTES:
REVISION HISTORY
written in 2011 by LAP.
make_diary
pro make_diary
No header information available.
make_zernike
function make_zernike, tabentry, r, theta
NAME:
make_zernike
PURPOSE:
Calculate the value of the zernike mode specified by the
indices in tabentry, with radial distance r and azimuthal
angle theta.
EXPLANATION:
See above.
CALLING SEQUENCE:
out = make_zernike(tabentry, r, theta)
INPUT/OUTPUT:
tabentry - 3x1 array of n,m indices and boolean for whether
this is a sin or cos mode. See ztable.pro for
details (default ordering, not Noll).
r - radial distance
theta - Azimuthal angle (rad)
out - Mode value.
OPTIONAL OUTPUT:
EXAMPLE:
DEPENDENCIES:
None.
NOTES:
Regular indexing is 0-based, but Noll indexing is 1-based.
REVISION HISTORY
Written by ?? (probably Don Gavel)
1.14.2013 - Offloaded to own function - ds
map_indices_dft_to_modes
function map_indices_dft_to_modes, n
No header information available.
map_indices_modes_to_dft
function map_indices_modes_to_dft, n
No header information available.
memshape_library
function memshape_library, name, N=N, pow=pow, offcent=offcent, rot=rot
NAME:
memshape_library
PURPOSE:
Collection of useful poke shapes for testing/aligning
EXPLANATION:
Returns NxN dm shape
CALLING SEQUENCE:
out = memshape_library(name,[N=x,pow=y,offcent=z)
INPUT/OUTPUT:
name - Name of shape. Prints out available ones if not set.
N - Size of output (defaults to 48x48)
pow - magnitude of poke (defaults to 1.)
offcent - offset from center for symmetric patterns (defaults
to 3 pixels)
rot - rotation angle for rotated patterns. defaults to pi/6
out - NxN array of pokes
OPTIONAL OUTPUT:
EXAMPLE:
out = memshap_library('pokex4',pow=0.5) ;; 5 micron symmetric
4 actuator poke about center
DEPENDENCIES:
None.
NOTES:
REVISION HISTORY
Written 03/20/2012 - savransky1@llnl.gov
06.22.12 - Added rotplusx4 - ds
mk_aperture
FUNCTION mk_aperture, N, R, whole=wflag, old=oflag, double=doubleflag
No header information available.
mk_blackman
function mk_blackman, n, sampfac, double=doubleflag
No header information available.
my_centroid
function my_centroid, ref, weight=wflag, denomfree=dlevel
No header information available.
my_histo
function my_histo, data, delta0, whole=wflag
No header information available.
my_round
function my_round, num, precision=lev
No header information available.
new_convert_slopes
function new_convert_slopes, insig, pix2nm=pflag, nm2pix=nflag
No header information available.
new_generate_reference_spot
function new_generate_reference_spot
No header information available.
nextpow2
function nextpow2, n0
nextpow2 - find the smallest power of 2 less or equal to a given number
USAGE:
n = nextpow2(n0)
now_array
function now_array
No header information available.
now_string
function now_string
No header information available.
number_string
function number_string, num, maxv
No header information available.
ones
function ones, n, m
ones.pro - return an array of all ones
usage:
a = ones(n,m)
input:
n = 1st dimension
m = 2nd dimension (optional)
output:
a = the resulting array
per_corr
function per_corr, refn, subn, lowpass=lflag
No header information available.
pupalign
pro pupalign, poke=poke, nopoke=nopoke, pupdark=pupdark, memshape=memshape, res=res, finalim=finalim, bothdim=bothdim, inttime=inttime, numcoadds=numcoadds, scalefac=scalefac, verb=verb, nofit=nofit, maxAxis=maxAxis, minAxis=minAxis
No header information available.
pupalign_lyot
pro pupalign_lyot, poke=poke, nopoke=nopoke, pupdark=pupdark, memshape=memshape, res=res, finalim=finalim, bothdim=bothdim, inttime=inttime, numcoadds=numcoadds, scalefac=scalefac, verb=verb, nofit=nofit, maxAxis=maxAxis, minAxis=minAxis
No header information available.
pupfit
function pupfit, pupdark=pupdark, im=im
No header information available.
quadratic_fit
function quadratic_fit, volts, phase, biasv
No header information available.
querysimbadcoords
function querysimbadcoords, ra, dec
No header information available.
read_split_filter
pro read_split_filter, num=num, den=den, ord=ord, fname=fname, rate=rate
NAME:
read_split_filter
PURPOSE:
Return free parameters of current splitFilterCoeff file for
the current camera rate
EXPLANATION:
See above
CALLING SEQUENCE:
read_split_filter,num=num,den=den,[fname=fname]
INPUT/OUTPUT:
num - Vector of numerators
den - Vector of denominators
fname - Optional filename input (defaults to
$AOC_ROOT/config/splitFilterCoeffs.txt)
rate - Optional camera rate index (overrides gpi_frame_rate_key)
OPTIONAL OUTPUT:
ord - Order of filter
EXAMPLE:
DEPENDENCIES:
None.
NOTES:
Output vectors will be of dimension ord+1. Will both return as
-1 on error.
REVISION HISTORY
Written 12/09/2013 - savransky1@llnl.gov
read_telem_info_file
function read_telem_info_file, fname
No header information available.
real
function real, a
No header information available.
remHotPix
function remHotPix, in, N
No header information available.
remove_from_phase_piston
pro remove_from_phase_piston, phase, ap, noap=aflag
No header information available.
remove_from_phase_tiptilt
pro remove_from_phase_tiptilt, phase, ap, noap=aflag
No header information available.
rescale
function rescale, sig, mag, gridinc=gridinc, nopadding=nflag, nofftw=nofftwflag
No header information available.
reshape_centroids
function reshape_centroids, in
No header information available.
rms
function rms, im, ap
rms.pro - find the rms value of an image over an ap
ans = rms(im)
sa_extractcube_undispersed
function sa_extractcube_undispersed, array0, xshift=xshift, yshift=yshift
No header information available.
save_actuator_locations
pro save_actuator_locations, xcoor, ycoor, tweet=tflag, woof=wflag
NAME:
save_actuator_locations
PURPOSE:
save the actuator locations to disk for use by other codes
EXPLANATION:
see above.
Calling SEQUENCE:
save_actuator_locations, xcoor, ycoor, [/tweet, /woof]
INPUT/OUTPUT:
xcoor is the x locations (unit is twt actuators)
ycoor is the y locations (unit is twt actuators)
/tweet specifies a Twt signal (will catch if wrong size)
/woof specifies a Wfr signal (will catch if wrong size)
writes two files to disk
OPTIONAL OUTPUT:
None.
EXAMPLE:
save_actuator_locations, xc, yc, /tweet
DEPENDENCIES:
gpi_correct_size
NOTES:
REVISION HISTORY
written in 2011 by LAP.
save_telem_info_file
pro save_telem_info_file, fname, later_info
No header information available.
shift2d_nowrap
function shift2d_nowrap, sig, x, y
No header information available.
slave_nearest_neighbor
function slave_nearest_neighbor, sig, mask
No header information available.
subpixelshift
function subpixelshift, img0, dx, dy, nofftw=nofftwflag
No header information available.
transpose_gains
function transpose_gains, g
No header information available.
tt_log
pro tt_log, duration=duration, delay=delay, logfile=logfile, verbose=verbose, graph=graph, do37=do37, psd=psd
NAME:
tt_log
PURPOSE:
Log RMS TT data.
EXPLANATION:
Wrapper for dumpdata and extract_tt_types.
Calling SEQUENCE:
tt_log,[duration=duration,delay=delay /verbose, logfile=logfile, /graph])
INPUT/OUTPUT:
duration - duration to dump (seconds). Defaults to 1.
/verbose - Print out tt information
delay - If set, wait for delay time (seconds) before dumping
data.
/graph - Generate graph of output
logfile - Specify location of logfile (defaults to
privatepath)
/do37 - Also include 37 Hz vibration
/psd - Plot PSD
OPTIONAL OUTPUT:
None.
EXAMPLE:
DEPENDENCIES:
rtc_retrieve_dumpdata
get_current_tt
NOTES:
REVISION HISTORY
written in 2012 by bmac.
05.06.13 - ds - Now points to get_current_tt and logs discrete
frequency info.
04.05.15 - Added do37 keyword, cleaned up output and display
type
function type, a, text=text
type.pro - determine the data type of an idl expression
usage:
t = type(a,[/text])
input:
a - any expression
output:
t - the type, in integer form:
0 - undefined
1 - byte
2 - int
3 - long int
4 - float
5 - double
6 - complex
7 - string
8 - structure
9 - complex double
10 - pointer
11 - object
12 - unsigned int
13 - unsigned long int
14 - 64 bit int
15 - unsigned 64 bit int
keyword:
/text - return the type as a text string instead of integer
zernike
function zernike, xa, ya, r, n, marg, center=c, l=l, table=nmax, noll=noll
NAME:
zernike
PURPOSE:
Generate zernike mode on a 2D image, or at specified coordinates.
EXPLANATION:
See above.
CALLING SEQUENCE:
result = zernike(nx,ny,r,n,m) - generate the zernike mode
on a 2-D (nx X ny) image
result = zernike(x,y,r,n,m) - generate the zernike mode values
at positions given by vectors x and y
table = zernike(table=nmax) - generate a table of allowed n,m pairs
INPUT/OUTPUT:
nx,ny - dimensions of image -or-
x,y - arrays of x and y coordinates
r - radius of aperture in pixels
n,m - zernike indices, n-radial, m-angular
/noll - Use Noll indexing
res - returned as a complex pair
real part = z(n,m) cos(m theta)
imaginary part = z(n,m) sin(m theta)
OPTIONAL OUTPUT:
EXAMPLE:
DEPENDENCIES:
ztable.pro
NOTES:
Regular indexing is 0-based, but Noll indexing is 1-based. The
result of zernike is unintless, and normalized according to Noll
normalization formula:
Noll, R J., Zernike polynomials and atmospheric
turbulence.Journal of the Optical Society of America 66,
no. 3 (1976): 207-211.
The Noll Zernike polynomials are orthogonal over the unit
radius circle and square-integrate to pi (the area of a unit
radius circle). The zernike slope is in units of (circle
radius)^-1.
x, y, r units are pixels
REVISION HISTORY
Written by Don Gavel
1.15.2013 - Offloaded to own function - ds
zernikeseries (zernikefit.pro)
function zernikeseries, coef, n, r, center=c
zernikefit (zernikefit.pro)
function zernikefit, phase, ap, r, nz, fit=fit, inverse=inverse, center=c, print=print
zernikefit.pro
1) fit a series of zernike polynomials to a given wavefront
2) create a wavefront consisting of a series of zernikes weighted by given coefficients
Usage:
form 1) list = zernikefit(phase,ap,r,nz,fit=fit)
Inputs:
phase - a 2-d real array of phase
ap - a 2-d aperture over which to fit the zernike polynomials on phase
r - radius for the zernike polynomial (defines the circle over which the zernike is defined as an orthonormal function)
nz - number of coefficients desired, starting at 0=piston
Output:
list - list of zernike coefficients
fit - a 2-d real array of the truncated zernike fit to the input phase (not apertured)
form 2) phase = zernikefit(coefs,n,r,/inverse)
Inputs:
coefs - list of zernike coefficients
n - the desired size of the 2-d phase array
r - radius for the zernike polynomial
Output:
phase - the 2-d real array of phase = sum_k(coef_k * zernike_k)
Author: Don Gavel, July 9, 2009
July 11, 2009 (added form 2)
zernmode_generator
function zernmode_generator, nz, pupiloverride=pupil, nonorm=nnflag
No header information available.
make_zernike_slope (zernmode_slope_generator.pro)
function make_zernike_slope, tabentry, r, theta, x=xflag, y=yflag
zernmode_slope_generator (zernmode_slope_generator.pro)
function zernmode_slope_generator, nz, pupiloverride=pupil, nonorm=nnflag
No header information available.
zeropad
function zeropad, im, n_arg, m_arg, by=by, no_center=no_center
No header information available.
ztable
function ztable, kmax, noll=noll
NAME:
ztable
PURPOSE:
Generate Zernike index table.
EXPLANATION:
Returns table of n,m indices in regular or Noll ordering. In
regular ordering, a boolean value is also generated for whether
there is a sin component (True corresponds to negative m for
Noll indexing).
CALLING SEQUENCE:
out = ztable(kmax,[/noll])
INPUT/OUTPUT:
kmax - Maximum index in table (default table will contain
kmax+1 rows, Noll ordering will contain kmax rows).
/noll - Use Noll sequential indices
out - When regular ordering, returns kmax+1 x 3 matrix. First
col is n, second col is m and third col is a boolean for
the sin component. When /noll is set returns kmax x 2
matrix with n,m values.
OPTIONAL OUTPUT:
EXAMPLE:
DEPENDENCIES:
None.
NOTES:
Regular indexing is 0-based, but Noll indexing is 1-based.
REVISION HISTORY
Written by Don Gavel
1.14.2013 - Offloaded to own function and replaced odd
function with mod operator - ds