section of routines in yao_util.i

functions in yao_util.i -

 
 
 
apod


             apod(length,degree)  
 
  Returns apodization functions for 1D Fourier transforms.  
  degree = 1 to 3 : apodization functions for the FTS  
  degree = 4      : sinc  
  degree = 5      : Bartlett filter (cf NR p 547)  
  degree = 6      : Hann filter  
  degree = 7      : Welch filter  
SEE ALSO:
 
 
 
axisLegend


             axisLegend(xtext,ytext,xyoff=,yxoff=)  
 
  plot the axis captions. works for myboxed.gs graphic style.  
  F.Rigaut, 2001/11/10.  
 
 
 
bin2


             bin2(image)  
 
  Returns the input image, binned by a factor of 2.  
  That is, a 512x512 image is transformed in a 256x256 image.  
  one output pixel is the average of the 4 corresponding input ones,  
  so that it conserves the total intensity.  
SEE ALSO:
 
 
 
calcpsf


             calcpsf(pupil,phase,init=)  
 
  Compute psfs from pupil and phase using FFT.  
  F.Rigaut, 2001/11/10.  
SEE ALSO: fft,   rfftconvol  
 
 
 
clmfit


             clmfit(y,x,&a,function,&yfit)  
 
  Useful wrapper for the lmfit procedure.  
  y = the data to fit vs x  
  a = the output coefficients (may have initial value on input)  
  function = a string containing the function definition where  
  x and a must be used as variable and coefficients name  
  e.g. "a(1)+a(2)*cos(x)"  
  yfit = optional output. Best fit.  
SEE ALSO: lmfit  
 
 
 
colorbar


             colorbar  
             colorbar, cmin, cmax  
 
     draw a color bar to the right of the plot.  If CMIN and CMAX  
     are specified, label the top and bottom of the bar with those  
     numbers.  
 
 
 
convol2d


             convol2d(image,kernel)  
 
  For small kernel. Not FT based. Really slow ! use only for small images.  
  you can use convVE if you are running yao on a mac (see yao_veclib/yao_fast.i)  
  F.Rigaut, 2001  
  NOTE: name changed as of yorick-1.6.01. used to be named convol  
SEE ALSO: rfftconvol  
 
 
 
decimal_time


             decimal_time(str,delim)  
 
   Returns the decimal time (in hours) from string like "20:33:12"  
   or "21&32&01" or "06 55 32". You can specify a delimiter.  
   F.Rigaut 2001/10  
   OBSOLETE. THIS ROUTINE IS SUPERSEEDED BY "ParseTime".  
SEE ALSO:
 
 
 
diag


             diag(image)  
 
  Returns a vector containing the diagonal of the input matrix  
  F.Rigaut, 2001/10  
SEE ALSO: trace  
 
 
 
doc


             doc and docyo  
 
  Spawns ghostview (actually, gv) to display the short doc and  
  extended yorick doc ps files. gv has to be in the path.  
SEE ALSO:
 
 
 
docyo


 docyo  
 
SEE doc  
 
 
 
ds9


             ds9(image)  
 
  Writes the input image on disk and start ds9 to view it.  
  this is rather an ugly hack but ds9 is sometimes useful  
  to look at large image of have a display of the pixel value.  
  Of course, ds9 has to be in the path.  
SEE ALSO:
 
 
 
even


             even(arg)  
 
  returns 1 is argument is even, zero otherwise.   
  The argument should be an integer.  
  F.Rigaut, 2001/11/10.  
SEE ALSO: odd  
 
 
 
exist


             exist(arg)  
 
  Returns 0 if element is not set or is a , 1 otherwise  
  F.Rigaut 2002/04/03  
SEE ALSO: is_void,   where  
 
 
 
extractImage


             extractImage(image,dimx,dimy,method=)  
 
  Interactively extract a subimage from a larger one.  
  dimx[,dimy] are the dimensions of the subimage (not used for method 2)  
  method = 1 center is selected with mouse  
  method = 2 use mouse to click and drag to define subimage  
  NOTE: The image has to be displayed before calling the rountine.  
  This allows the user to arrange cuts and zoom level.  
SEE ALSO:
 
 
 
factoriel


             factoriel(arg)  
 
  Return factoriel of the argument      
SEE ALSO:
 
 
 
fftfit


             fftfit(yin,fraccut,nsig)  
 
  routine of iterative fit by FT, discarding aberrant points  
  yin = input vector to fit  
  fraccut = cut in the fourier plane in fraction of cut-off frequency  
  nsig = number of sigma for rejection of aberrant points  
  F.Rigaut 2001/10  
SEE ALSO:
 
 
 
fftrebin


             fftrebin(image,nreb)  
 
  Returns "image" rebinned nreb times (nreb should be an integer,  
  power of 2, i.e. 2, 4, 8, ...) using a Fourier technique (basically,  
  extention of the support in the Fourier plane by zero values.  
  F.Rigaut, 2001/11/10.  
SEE ALSO: fft,   fft_setup,   fft_inplace  
 
 
 
fftshift


             fftshift(image,xs,ys)  
 
  Shift the input array by an arbitrary amount (xs,ys) in pixel units.  
  Of course xs and ys can be fractional. This rountine shift the  
  image by passing in the Fourier plane. All the usual restrictions  
  apply:  
     - The image should be well sampled (Nyquist)  
     - There should not be discontinuities at the edges, etc...  
  The input array can be 1D or 2D  
SEE ALSO: fftrebin  
 
 
 
fileExist


             fileExist(filename)  
 
   Returns "1" if the file(s) exist(s), "0" if it does not.  
   filename can be an array, in which case the results is an array  
   of 0s and 1s.  
   F.Rigaut 2002/01  
SEE ALSO:
 
 
 
findfiles


             findfiles(filter)  
 
  This routines returns a list of files which satisfy the filter  
  argument. The list is a string vector. If no files were found,  
  the results is the empty string.  
  F.Rigaut, 2001/11/10.  
SEE ALSO: spawn  
 
 
 
gamma


             gamma(arg)  
 
  Gamma function.  
SEE ALSO: gamma,   i,   in,   yorick/i/  
 
 
 
indices


             indices(dim)  
 
  Return a dimxdimx2 array. First plane is the X indices of the pixels  
  in the dimxdim array. Second plane contains the Y indices.  
  Inspired by the Python scipy routine of the same name.  
  New (June 12 2002): dim can either be :  
    - a single number N (e.g. 128) in which case the returned array are  
      square (NxN)  
    - a Yorick array size, e.g. [#dimension,N1,N2], in which case  
      the returned array are N1xN2  
    - a vector [N1,N2], same result as previous case  
  F.Rigaut 2002/04/03  
SEE ALSO: span  
 
 
 
is_set


             is_set(arg)  
 
  Returns 0 if element is void or equal to zero, 1 otherwise  
  F.Rigaut 2002/06/03  
SEE ALSO: is_void,   where,   exist  
 
 
 
log00


             log00() and log11()  
 
  Shortcuts for logxy,0,0 and logxy,1,1      
SEE ALSO: logxy  
 
 
 
log11


 log11  
 
SEE log00  
 
 
 
ls


             ls: system command ls   
 
  F.Rigaut, 2001/11/10.  
SEE ALSO: pwd,   system,   $  
 
 
 
makegaussian


             makegaussian(size,fwhm,xc=,yc=)  
 
  Returns a centered gaussian of specified size and fwhm.  
  F.Rigaut 2001/09  
  norm returns normalized 2d gaussian  
SEE ALSO:
 
 
 
medianCube


             medianCube(cube)  
 
  Returns a 2D array which elements are the median along the  
  3rd dimension of the input variable "cube".  
  F.Rigaut, 2001/11/10.  
SEE ALSO: median  
 
 
 
minmax


             minmax(arg)  
 
  Returns a vector containing the min and the max of the argument  
  F.Rigaut 2001/09  
SEE ALSO:
 
 
 
mrot


             mrot(angle)  
 
  returns the matrix of rotation for a given angle.  
  It has to be used as follow:  
  If you want to rotate a vector of two coefficients xy=[x,y],  
  You should do rotated vector = mrot(+,)*xy(+,);  
  Angle is in degrees.  
SEE ALSO:
 
 
 
nprint


             func nprint(var,sep=,format=)  
 
   Neat print of a 2d array.  
   example:  
   > nprint,optpos*pi/3.14e9,sep=", "  
      +0, -5.003e-07,       +0, -9.005e-08,       +0,       +0   
      +0, -4.002e-07,       +0, +9.005e-08,       +0,       +0   
      +0, -3.002e-07,       +0, +9.005e-08,       +0,       +0   
      +0, -2.001e-07,       +0, +9.005e-08,       +0,       +0   
      +0, -1.801e-07,       +0, +9.005e-08,       +0,       +0   
      +0, -1.001e-07,       +0, +9.005e-08,       +0,       +0   
      +0, +1.001e-07,       +0, +9.005e-08,       +0,       +0  
   sep= seperator string. The default separator is two blanks ("  ").  
   format= swrite format  
   Restricted to 2D arrays  
SEE ALSO: pm  
 
 
 
odd


             odd(arg)  
 
  Returns 1 is argument is odd, zero otherwise.   
  The argument should be an integer.  
  F.Rigaut, 2001/11/10.  
SEE ALSO: even  
 
 
 
oldclip


             pli, clip(arg, mini, maxi);  
 
  Returns the argument, which has been "clipped" to mini  
  and maxi, i.e. in which all elements lower than "mini"  
  have been replaced by "mini" and all elements greater  
  than "maxi" by "maxi". Array is converted to float.  
  Either "mini" and "maxi" can be ommited, in which case  
  the corresponding mini or maxi is not clipped.  
  Equivalent to the IDL ">" and "<" operators.  
  F.Rigaut, 2001/11/10.  
SEE ALSO:
 
 
 
olddist


             dist(size,xc=,yc=)  
 
  Returns an array which elements are the distance to (xc,yc). xc and  
  yc can be omitted, in which case they are defaulted to size/2+1.  
  F.Rigaut, 2001/11/10.  
SEE ALSO: indices  
 
 
 
oldeclat


             eclat(image)  
 
  Equivalent, but slightly faster (?) than roll. Transpose the four main  
  quadrants of a 2D array. Mostly used for FFT applications.  
  F.Rigaut, 2001/11/10.  
SEE ALSO: roll  
 
 
 
plot


             plot(vect,x,square=,histo=)  
 
  Short cut for a fma + plg  
  Set histo to get plh type plot  
  F.Rigaut 2001/10  
SEE ALSO: plg,   fma,   tv,   plh  
 
 
 
prepzernike


             prepzernike(size,diameter,xc,yc)  
 
  Call this function to set up the geometry for subsequent calls  
  to the zernike function.  
  size : size of the 2d array on which future "zernike" will be returned  
  diameter : diameter of the pupil in pixel in the array  
  xc, yc (optional) : Coordinates (in pixels of the center of the pupil)  
  Example:  
  > prepzernike,128,100  
  > pli,zernike(6)  
SEE ALSO: zernike,   zernike_ext,   zernumero  
 
 
 
psd


             psd(s, length, step=, filter=, samp=, db=,noplot=,overplot=,  
 
     sqrt=,roddier=,xtitre=,ytitre=)  
  Procedure PSD : Compute the Power Spectral Density of a vector  
  s	   = variable on which the PSD has to be computed  
  length  = length of the subsample for FFTs  
  step	   = shift in pixels between subsamples  
  filter  = apodization function as in apod.pro (usually 6)  
  samp	   = sampling time  
  db      = plots in dB :10*alog10(dsp)  
  noplot  = do not plot  
  overplot= over plot  
  sqroot  = returns the sqrt of the dsp  
  roddier = plots the psd roddier style      
SEE ALSO:
 
 
 
pwd


             pwd: system command pwd   
 
  F.Rigaut, 2001/11/10.  
SEE ALSO: ls,   system,   $  
 
 
 
rfftconvol


             rfftconvol(image,kernel)  
 
  Not specialy optimized fft convolution.  
  Inputs are two real positive arrays (images) of identical size.  
  Output is a real array. The output is Normalized in flux.  
  F.Rigaut, 2002/04/04  
SEE ALSO: convol  
 
 
 
round


             round(arg)  
 
  Returns the rounded version of a floating point argument  
  F.Rigaut 2001/10  
SEE ALSO: ceil,   floor  
 
 
 
secToHMS


             secToHMS(time)  
 
  Convert from time (float in sec) to string in the form hh:mm:ss.s  
  AUTHOR : F.Rigaut, June 13 2002.  
SEE ALSO:
 
 
 
sinc


             sinc(ar)  
 
  Return the sinus cardinal of the input array  
  F.Rigaut, 2002/04/03  
SEE ALSO: Eric,   Thiebault,   wrote,   a,   sinc,   which,   is,  
probably,   better  
 
 
 
strInt


             strInt(ivec,nchar);  
 
  Create a string array which elements are the string  
  equivalent of each elements of "ivec", with as many   
  heading "0" added to fill a string of length nchar.  
  example:   
  print,strInt(indgen(10:12),4)   
  ["0010","0011","0012"]  
  F.Rigaut, 2001/11/10.  
SEE ALSO: str,   routines,   in,   string,   i  
 
 
 
surface


             surface(image,shade=)  
 
  Simple wrapper to get a simple mesh (or shaded) of the input array.  
SEE ALSO:
 
 
 
tac


             tac()  
 
  Marks the end of a time lapse  
  ex: tic ; do_something ; tac()  
  will print out the time ellapsed between tic and tac  
  F.Rigaut 2001/10  
SEE ALSO: tic  
 
 
 
tic


             tic  
 
  Marks the beginning of a time lapse  
  ex: tic ; do_something ; tac()  
  will print out the time ellapsed between tic and tac  
  F.Rigaut 2001/10  
SEE ALSO: tac  
 
 
 
trace


             trace(image)  
 
  Returns the trace of the input matrix  
  F.Rigaut 2001/10  
SEE ALSO: diag  
 
 
 
tv


             tv(im,square=)   
 
  This routines does a frame advance, display the image  
  and set the limits to have the image full display.  
  Inspired from the IDL tvscl  
  F.Rigaut, 2001/11/10.  
SEE ALSO: fma,   pli,   plot  
 
 
 
typeReturn


             typeReturn(void)  
 
  A simple convenient function that does what is name says.  
SEE ALSO:
 
 
 
uint


             uint(arg)  
 
  Return the unsigned version of an integer of long argument.  
  Sorry, I neede this for some fits files. There is a uint type  
  in yorick-mb, beware.  
  F.Rigaut, 2001/10  
SEE ALSO:
 
 
 
wheremax


 wheremax  
 
SEE wheremin  
 
 
 
wheremin


             func wheremin(ar)  
 
        and func wheremax(ar)  
   Short hand for where(array == min(array) or max(array)  
SEE ALSO: where,   where2,   min,   max  
 
 
 
window2


             window2()  
 
  Create a window with style "myboxed.gs"  
  F.Rigaut 2002/04/03  
SEE ALSO: window,   window3  
 
 
 
zernike


             zernike(zn)  
 
  Returns the zernike number zn, defined on a 2D array as per  
  the prepzernike function.  
  These zernikes follow the Noll (JOSA, 1976) numbering and  
  definition (rms of 1 over the pupil)  
  Example:  
  > prepzernike,128,100  
  > pli,zernike(6)  
SEE ALSO: prepzernike,   zernumero  
 
 
 
zernike_ext


             zernike_ext(zn)  
 
  Same as the zernike function, except that the function is not masked  
  at R=1. This might be useful for some WFS codes where the derivative  
  of the wavefront is needed (and therefore a pixel outside of the  
  pupil is used to compute the derivatives).  
  These zernikes follow the Noll (JOSA, 1976) numbering and  
  definition (rms of 1 over the pupil)  
  Example:  
  > prepzernike,128,100  
  > pli,zernike(6)  
SEE ALSO: zernike,   prepzernike,   zernumero  
 
 
 
zernumero


             zernumero(zn)  
 
  Returns the radial degree and the azimuthal number of zernike  
  number zn, according to Noll numbering (Noll, JOSA, 1976)  
SEE ALSO: prepzernike,   zernike