SDSS Library

This page is a listing of the entire contents of this library for IDL. This listing is the long version. Viewing the much more compact listing may be handier.

[Go Back to Main IDL Libraries Search Page]


Last modified: Thu Dec 21 21:29:04 2000.

List of Routines


Routine Descriptions

ADD_ARRVAL

[Next Routine] [List of Routines]

 NAME:
    ADD_ARRVAL
       
 PURPOSE:
    Add an element to an array "array". If input array is undefined, 
    set it equal to the new value.

 CALLING SEQUENCE:
    add_arrval, newval, array, front=front

 INPUTS: 
    newval: the new value to be added

 KEYWORD PARAMETERS:
    /front: If set then put the new value at the front of the array, else
       put at end.

 SIDE EFFECTS: 
    array is created or augmented.       

 
 PROCEDURE: 
    
	

 REVISION HISTORY:
    14-NOV-2000 Erin Scott Sheldon UofMich
       
                                      

(See /host/bluemoon/usr2/idllib/sdss/allpro/add_arrval.pro)


ADD_TAG

[Previous Routine] [Next Routine] [List of Routines]

 NAME:
    ADD_TAG
       
 PURPOSE:
    Add a new tag to the structure. NOTE: if you want to add more
    than one tag at once, use ADD_TAGS

 CALLING SEQUENCE:
    add_tag, oldstruct, tagname, tagtype, newstruct, structyp=structyp

 INPUTS: 
    oldstruct: The original structure (or array of structures)
    tagname: string containing the new tag name
    tagtype: the initial value of the new tag, e.g. fltarr(5)
           or [3,5,6], or 0L, etc.

 KEYWORD PARAMETERS:
   structyp: a string with the name of the new structure.
     if already defined the program will crash.

 OUTPUTS: 
    newstruct: The structure with the new tag it it.

 OPTIONAL OUTPUT
    NONE

 CALLED ROUTINES:
    COMBINE_STRUCTS
 
 PROCEDURE: 
    
	

 REVISION HISTORY:
    25-OCT-2000, Judith Racusin.
       
                                      

(See /host/bluemoon/usr2/idllib/sdss/allpro/add_tag.pro)


ADD_TAGS

[Previous Routine] [Next Routine] [List of Routines]

 NAME:
    ADD_TAGS
       
 PURPOSE:
    Add new tags to the structure. Similar to 
    add_tag, but with these major differences:
       --Unlike the program ADD_TAG, ADD_TAGS can add
         multiple new tags.
       --Unlike add_tag, which takes an actual
         value for the new tag, ADD_TAGS takes in string 
         indicators for each new tag, such as 'fltarr(3)', 
         or '10', and uses MRD_STRUCT
       --Because of this, ADD_TAGS cannot add specific values
         for non-scalars.
       --Also because of this, ADD_TAGS cannot add a substructure.
         If you want to add a substructure to a structure, use
         ADD_TAG: add_tag, oldstruct, tagname, substruct, newstruct 

 CALLING SEQUENCE:
    add_tags, oldstruct, tagnames, values, newstruct

 INPUTS: 
    oldstruct: The original structure (or array of structures)
    tagnames: new tag name(s), can be an array
    values: string containing values for tagnames. must be same size
            array as tagnames. Same format as MRD_STRUCT.PRO
 OPTIONAL INPUTS:
    NONE

 KEYWORD PARAMETERS:
    structyp: a string with the name of the new structure.
     if already defined the program will crash.
       
 OUTPUTS: 
    newstruct: The structure with the new tags in it.

 OPTIONAL OUTPUTS:
    NONE

 EXAMPLE: 
    tagnames=['ra', 'dec', 'image', 'name']
    values  =['0d', '0d',  'intarr(1000, 1000)', "'NGC3035'"]
    add_tags, oldstruct, tagnames, values

 CALLED ROUTINES:
    MRD_STRUCT
    DATATYPE
    COMBINE_STRUCTS
 
 PROCEDURE: 
    Use mrd_struct to create a new structure.
	

 REVISION HISTORY:
    25-OCT-2000, Erin Scott Sheldon
       
                                      

(See /host/bluemoon/usr2/idllib/sdss/allpro/add_tags.pro)


ANGDIST

[Previous Routine] [Next Routine] [List of Routines]

 NAME: 
    ANGDIST
       
 PURPOSE: 
    calculate angular diameter distance between zmin and zmax
    Currently only works for lambda = 0 universe.
	

 CALLING SEQUENCE: 
    result = angdist(z1, z2, h=h, q0=q0, omegamat=omegamat, $
                     silent=silent, plot=plot, oplot=oplot )
      
 INPUTS:  
    zmax: max redshift 

 OPTIONAL INPUTS:
    zmin:  Zmin is optional, the default is 0.0

 OPTIONAL KEYWORDS: 
    h: hubble parameter in units of H100 default is 1.0
    q0: dacceleration parameter. default is q0=0.5
    omegamat:  If input, uses q0=omegamat/2.

 OUTPUTS: 
    dist in MPC

 REVISION HISTORY: 
    Author: Erin Scott Sheldon 2/24/99
	   
                                      

(See /host/bluemoon/usr2/idllib/sdss/allpro/angdist.pro)


ANGDIST_LAMBDA

[Previous Routine] [Next Routine] [List of Routines]

 NAME: 
    ANGDIST_LAMBDA
       
 PURPOSE: 
    calculate angular diameter from zmin to zmax in flat lambda universe
    Uses 4th order polynomial approximation 
    see Pen, U., 1999, ApJ Supplement, 20, 49.
    For z between 0.2 and 1.0 the error is about .4% 
    (Exact for omega_matter = 1.0)
	

 CALLING SEQUENCE: 
    result = angdist(zmax, [zmin, h=h, omegamat=omegamat, dlum=dlum, 
                     verbose=verbose])
      
 INPUTS:  
    z: redshift

 OPTIONAL INPUTS: 
    h: hubble parameter       default is 1.0
    omegamat:  omega matter   default is .3

 OPTIONAL OUTPUTS:
    dlum: the luminosity distance.

 OPTIONAL KEYWORDS: 
    /verbose:  print distances.
       
 OUTPUTS: distance in megaparsecs.

 REVISION HISTORY: 
    Author: Erin Scott Sheldon 2/24/99
	
       
                                      

(See /host/bluemoon/usr2/idllib/sdss/allpro/angdist_lambda.pro)


APLOT

[Previous Routine] [Next Routine] [List of Routines]

 NAME:
    APLOT
       
 PURPOSE:
    Wrapper for PLOT that forces a user defined aspect ratio.

 CALLING SEQUENCE:
    aplot, aspect, [x,] y, center=center, _extra=extra

 INPUTS: 
    aspect: xsize/ysize
    y: y values

 OPTIONAL INPUTS:
    x: optional x values

 KEYWORD PARAMETERS:
    /center: if set then center up the display.
    _extra:  plotting keywords.
       
 CALLED ROUTINES:
    PLOT
 
 PROCEDURE: 
    
	

 REVISION HISTORY:
    Author:  Erin Scott Sheldon  UofMich 11/17/99  
       
                                      

(See /host/bluemoon/usr2/idllib/sdss/allpro/aplot.pro)


APLOTERROR

[Previous Routine] [Next Routine] [List of Routines]

 NAME:
    APLOTERROR
       
 PURPOSE:
    Wrapper for PLOTERR that forces a user defined aspect ratio.

 CALLING SEQUENCE:
    aploterr, aspect, [x,] y, [xerr,] yerr, center=center, _extra=extra

 INPUTS: 
    aspect: xsize/ysize
    y: y values
    yerr: y error values.

 OPTIONAL INPUTS:
    x: optional x values
    xerr: x error values.

 KEYWORD PARAMETERS:
    /center: if set then center up the display.
    _extra:  plotting keywords.
       
 CALLED ROUTINES:
    PLOTERR
 
 PROCEDURE: 
    
	

 REVISION HISTORY:
    Author: Erin Scott Sheldon  UofMich 11/17/99  
       
                                      

(See /host/bluemoon/usr2/idllib/sdss/allpro/aploterror.pro)


ARRSCL

[Previous Routine] [Next Routine] [List of Routines]

 NAME:
    ARRSCL
       
 PURPOSE:
    Rescale the range of an array.

 CALLING SEQUENCE:
    result = arrscl(arr, min, max, arrmin=arrmin, arrmax=arrmax)
                 
 INPUTS: 
    arr:  The array.
    min:  new minimum.
    max:  new maximum.

 OPTIONAL INPUTS:
    arrmin:  A number to be used as minimum of array range.
    arrmax:  A number to be used as maximum of array range.

    NOTE:  These are useful if the original array is known to only be a
           sample of possible range.  e.g. 

           if arr=randomu(seed,20) then one might wish to give arrmin=0, 
           arrmax=1

 KEYWORD PARAMETERS:
    None.
       
 OUTPUTS:
    The rescaled array. 

 PROCEDURE: 
    See the code.
	

 REVISION HISTORY:
    Author: Erin Scott Sheldon UofMich 10/18/99  
       
                                      

(See /host/bluemoon/usr2/idllib/sdss/allpro/arrscl.pro)


ASTRONOMYIMAGE__DEFINE[10]

[Previous Routine] [Next Routine] [List of Routines]
 METHODNAME:
       astronomyImage::Size

 PURPOSE:
       This method returns a vector storing the size of the image.

 CALLING SEQUENCE:
       Result = oAstronomyImage->Size()

 OUTPUTS:
       This method returns a two element vector containing the size
       of the current image array. The first element (Result[0])
       contains the 'x' size, and the second element (Result[1]) the
       y size.

 EXAMPLE:
       Result = oAstronomyImage->Size()

 MODIFICATION HISTORY:
       Written by      Eric H. Neilsen, Jr. 1997

(See /host/bluemoon/usr2/idllib/sdss/allpro/astronomyimage__define.pro)


ASTRONOMYIMAGE__DEFINE[11]

[Previous Routine] [Next Routine] [List of Routines]
 METHODNAME:
       astronomyImage::headerKeywordValue

 PURPOSE:
       This method returns a the value of a keyword in the header

 INPUTS:
       keyword: The name of the keyword whose value to return 

 CALLING SEQUENCE:
       Result = oAstronomyImage->headerKeywordValue('keyword')

 OUTPUTS:
       This method returns the value of the keyword

 EXAMPLE:
       time = oAstronomyImage->headerKeywordValue('EXPTIME')

 MODIFICATION HISTORY:
       Written by      Eric H. Neilsen, Jr. October 16, 2000

(See /host/bluemoon/usr2/idllib/sdss/allpro/astronomyimage__define.pro)


ASTRONOMYIMAGE__DEFINE[12]

[Previous Routine] [Next Routine] [List of Routines]
 METHODNAME:
       astronomyImage::deleteHeaderKeyword

 PURPOSE:
       This method deletes a line from the header

 INPUTS:
       keyword: the name of the keyword to delete

 CALLING SEQUENCE:
       oAstronomyImage->deleteHeaderKeyword, 'keyword'

 OUTPUTS:
       There is no output

 EXAMPLE:

 MODIFICATION HISTORY:
       Written by      Eric H. Neilsen, Jr. October 16, 2000

(See /host/bluemoon/usr2/idllib/sdss/allpro/astronomyimage__define.pro)


ASTRONOMYIMAGE__DEFINE[13]

[Previous Routine] [Next Routine] [List of Routines]
 METHODNAME:
       astronomyImage::addHeaderKeyword

 PURPOSE:
       This method adds a line from the header

 INPUTS:
       keyword: The name of the keyword to add
       value:   The value to give the keyword

 CALLING SEQUENCE:
       oAstronomyImage->addHeaderKeyword, 'keyword', value

 OUTPUTS:
       There is no output

 EXAMPLE:

 MODIFICATION HISTORY:
       Written by      Eric H. Neilsen, Jr. October 16, 2000

(See /host/bluemoon/usr2/idllib/sdss/allpro/astronomyimage__define.pro)


ASTRONOMYIMAGE__DEFINE[14]

[Previous Routine] [Next Routine] [List of Routines]
 METHODNAME:
       astronomyImage::replaceHeaderKeyword

 PURPOSE:
       This method replaces a line from the header

 INPUTS:
       keyword: The name of the keyword to replace
       value:   The value to give the keyword

 CALLING SEQUENCE:
       oAstronomyImage->replaceHeaderKeyword, 'keyword', value

 OUTPUTS:
       There is no output

 EXAMPLE:

 MODIFICATION HISTORY:
       Written by      Eric H. Neilsen, Jr. October 16, 2000

(See /host/bluemoon/usr2/idllib/sdss/allpro/astronomyimage__define.pro)


ASTRONOMYIMAGE__DEFINE[15]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       astronomyImage__DEFINE

 PURPOSE:
       This routine provides the deffinition of the astronomyImage
       object. This object is not intended to be used in practice;
       under most circumstances, one of it children (dataImage or
       maskImage) probably provides more functionality. 

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen, Jr. 1997 

(See /host/bluemoon/usr2/idllib/sdss/allpro/astronomyimage__define.pro)


ASTRONOMYIMAGE__DEFINE[1]

[Previous Routine] [Next Routine] [List of Routines]
 CLASS_NAME:
       astronomyImage

 PURPORSE:
       astronomyImage is intended to be a superclass of classes used
       store image used for astronomical applications.

 SUPERCLASSES:
       This inherets from no classes
 
 SUBCLASSES:
       Subclasses include dataImage, maskImage, and ircamImage

 CREATION:
       astronomyImage are generally created through the init
       of the desired subclass

 METHODS:
	Intrinsic Methods
       This class has the following methods:

       astronomyImage::Clone
       astronomyImage::GetData
       astronomyImage::InMemory
       astronomyImage::Load
       astronomyImage::Magnify
       astronomyImage::OnDisk
       astronomyImage::Save
       astronomyImage::SetData
       astronomyImage::Size

 PROCEDURES USED:
       From the GSFC IDL Astronomy User's Library
            http://idlastro.gsfc.nasa.gov/homepage.html
       READFITS, SXHREAD, SXOPEN, MKHDR, WRITEFITS, SXMAKE, SXWRITE

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen, Jr. 1997

(See /host/bluemoon/usr2/idllib/sdss/allpro/astronomyimage__define.pro)


ASTRONOMYIMAGE__DEFINE[2]

[Previous Routine] [Next Routine] [List of Routines]
 METHODNAME:
       astronomyImage::Clone

 PURPOSE:
       This method creates a duplicate image object. If no temporary
       file name is provided, the data for the new image is stored in
       memory. 

 CALLING SEQUENCE:
       Result = oAstronomyImage->Clone(Tempfilename)

 OPTIONAL INPUTS:
       tempFileName: This string contains the file name for the file
                     in which to store the image data, if any.  
	
 OUTPUTS:
       A copy of the image is returned. 

 SIDE EFFECTS:
       The clone is a new object; each must be destroyed separately.

 EXAMPLE:
       imagecopy = exampleimage->clone(tempfilename)

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen, Jr. 1997

(See /host/bluemoon/usr2/idllib/sdss/allpro/astronomyimage__define.pro)


ASTRONOMYIMAGE__DEFINE[2]

[Previous Routine] [Next Routine] [List of Routines]
 ======================================================================
 
 METHODNAME:
       astronomyImage::Cleanup

 PURPOSE:
       Clean up the memory used by the image object. In particular,
       free the data and header memory 

 CALLING SEQUENCE:
       OBJ_DESTROY, oAstronomyImage

       or

       oAstronomyImage->[astronomyImage::]Cleanup

 INPUTS:
       There are no inputs for this method

 KEYWORD PARAMETERS:
       There are no keyword parameters for this method

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen, Jr. 1997

RO astronomyImage::Cleanup
            
 self->inMemory
 PTR_FREE, self.dataHeader
 PTR_FREE, self.data

ND

(See /host/bluemoon/usr2/idllib/sdss/allpro/astronomyimage__define.pro)


ASTRONOMYIMAGE__DEFINE[3]

[Previous Routine] [Next Routine] [List of Routines]
 METHODNAME:
       astronomyImage::GetData

 PURPOSE:
       The method is used to return an array with the image data.

 CALLING SEQUENCE:
       Result = oAstronomyImage->getData()

 OUTPUTS:
       This function returns the data array associated with the image object.

 EXAMPLE:
       imagedataarray = astroimageobject->getData()

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen, Jr. 1997

(See /host/bluemoon/usr2/idllib/sdss/allpro/astronomyimage__define.pro)


ASTRONOMYIMAGE__DEFINE[4]

[Previous Routine] [Next Routine] [List of Routines]
 METHODNAME:
       astronomyImage::InMemory

 PURPOSE:
       If the image data is currently stored in a file, this method
       loads the data into memory and destroys the file. Otherwise,
       it has no effect.

 CALLING SEQUENCE:
       oAstronomyImage->InMemory

 EXAMPLE:
       oAstronomyImage->InMemory      

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.

(See /host/bluemoon/usr2/idllib/sdss/allpro/astronomyimage__define.pro)


ASTRONOMYIMAGE__DEFINE[5]

[Previous Routine] [Next Routine] [List of Routines]
 METHODNAME:
       astronomyImage::Load

 PURPOSE:
       This method load an image from disk into the image object.

 CALLING SEQUENCE:
       oAstronomyImage->Load, FileName

 OPTIONAL INPUTS:
	fileName: A string containing the name of the file from which
	          to load the image. If no name is given, the current
	          file name associated with the object is used.

 SIDE EFFECTS:
       The previous data and header information is lost.

 EXAMPLE:
       exampleImage->load, 'exampleImageFile.fits'

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen, Jr. 1997

(See /host/bluemoon/usr2/idllib/sdss/allpro/astronomyimage__define.pro)


ASTRONOMYIMAGE__DEFINE[6]

[Previous Routine] [Next Routine] [List of Routines]
 METHODNAME:
       astronomyImage::Magnify

 PURPOSE:
       This method resizes the image.

 CALLING SEQUENCE:
       oAstronomyImage->magnify, Newsize

 INPUTS:
       Newsize:  The desired size of the image. The new size must be
                 an integer miltiple of the current size.

 PROCEDURE:
       This method uses the REBIN function, as described in the IDL
       users manuals.

 EXAMPLE:
       To double the size of an image:
       oAstronomyImage->magnify, 2*oAstronomyImage->size()

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.

(See /host/bluemoon/usr2/idllib/sdss/allpro/astronomyimage__define.pro)


ASTRONOMYIMAGE__DEFINE[7]

[Previous Routine] [Next Routine] [List of Routines]
 METHODNAME:
       astronomyImage::OnDisk

 PURPOSE:
       This method saves the data array to a temporary disk file, and
       uses an array associated with this file to store this
       data. See the IDL documentation on associated variables (the
       ASSOC function) for more information about how this works.

 CALLING SEQUENCE:
       oAstronomyImage->OnDisk

 KEYWORD PARAMETERS:
       TEMPNAME:   Use this keyword to specify the name of the
                   temporary file in which to store the data.

 EXAMPLE:
       oAstronomyImage->OnDisk, TEMPNAME='/tmp/tmpImage.dat'

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.

(See /host/bluemoon/usr2/idllib/sdss/allpro/astronomyimage__define.pro)


ASTRONOMYIMAGE__DEFINE[8]

[Previous Routine] [Next Routine] [List of Routines]
 METHODNAME:
       astronomyImage::Save

 PURPOSE:
       This method saves the image object.

 CALLING SEQUENCE:
       oAstronomyImage->Save, FileName

 OPTIONAL INPUTS:
	fileName: A string containing the name of the file tp save the
	          file to. If no name is given, the current
	          file name associated with the object is used.

 RESTRICTIONS:
       Currently, images can only be saved in the STSDAS file format.

 EXAMPLE:
       exampleImage->save, 'exampleImageName.hhh'

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen, Jr. 1997

(See /host/bluemoon/usr2/idllib/sdss/allpro/astronomyimage__define.pro)


ASTRONOMYIMAGE__DEFINE[9]

[Previous Routine] [Next Routine] [List of Routines]
 METHODNAME:
       astronomyImage::SetData

 PURPOSE:
       This method sets the data of the image object. 

 CALLING SEQUENCE:
       oAstronomyImage->SetData, NewDataArray

 INPUTS:
       newData:  This parameter contains the new value of the data
                 array of the image. This will generally be a two
                 dimensional array.

 SIDE EFFECTS:
       The old data associated with the image is lost.

 RESTRICTIONS:

 EXAMPLE:
       exampleImage->setData, newDataArray

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen, Jr. 1997

(See /host/bluemoon/usr2/idllib/sdss/allpro/astronomyimage__define.pro)


ATLAS_NAME

[Previous Routine] [Next Routine] [List of Routines]

 NAME: 
    ATLAS_NAME

 PURPOSE: 
    Subroutine of get_atlas.  Creates the name of atlas file.

 CALLING SEQUENCE:
    atlas_name, run, camcol, field [, atlasname]

 INPUTS:  
    run: sdss run number
    camcol: camera column
    field: field of the object

 OUTPUTS: 
    atlasname

 REVISION HISTORY:
    Erin Scott Sheldon  3/14/99

(See /host/bluemoon/usr2/idllib/sdss/allpro/atlas_name.pro)


BEGPLOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	BEGPLOT	

 PURPOSE:

	This procedure redirects plots from the present display/
	graphics device to another display/graphics device. It
	is a 'macro' to the SET_PLOT and DEVICE graphics routines.  At
	this time only the 'PS' device is fully supported.

	See also KILLPLOT and ENDPLOT.

 CATEGORY:

	Misc.

 CALLING SEQUENCE:

	BEGPLOT

 INPUTS:

	None.

 KEYWORD PARAMETERS:

	These keywords are applicable to all graphics/display devices.

	LAYOUT:  Name of file containing keywords.  See example below.
	DEVICE:  Name of graphics device.
	NAME:  Name to give output file.
       INVBW: Invert b&w color table and make axes labels black for
              printing b&w spectrograms.

	These keywords are applicable to the 'PS', 'PCL', and 'HP'
	graphics device.  See also "IDL Graphics Devices" in IDL
	Reference Manual.

	INCHES:  Set to express sizes and offsets in inches.
	LANDSCAPE:  Set for 'landscape' orientation.  
	XOFFSET: Offset relative to lower left hand corner in
                portrait(default) orientation. Default is 0.75 inches.
	YOFFSET: Offset relative to lower left hand corner in
                portrait(default) orientation. Default is 1.0 inches.
	XSIZE:  Width of graphics output. Default = 5.0 inches.
	YSIZE:  Height of graphics output. Default = 9.0 inches.

	These keywords are specific to the 'PS' graphics device.

	BITS_PER_PIXEL: Integer (1,2,4,8) specifing resolution.
                       Default = 4 unless COLOR keyword set then
                       default = 8.
	BOLD: Set to use bold version of current PostScript font.
	COLOR: Set to enable color output.
	DEMI: Set to use demi version of current PostScript font.
	ENCAPSULATED: Set to create encapsulated PostScript font.
                     Suitable for importing into other documents.
	FONT: Name of PostScript font. See IDL Reference Manual for
             complete list.
	ITALIC: Set to use italic version of current PostScript font.
	LIGHT: Set to use light version of current PostScript font.
	MEDIUM: Set to use meduim version of current PostScript font.
	NARROW: Set to use narrow version of current PostScript font.
	OBLIQUE: Set to use oblique versin of current PostScript font.
	PREVIEW: Set to add 'device independent screen preview' to
                output file when using ENCAPSULATED.
	SCALE_FACTOR: Specifies scale factor applied to entire plot.
                     Default = 1.
 	CT: Number of color table to apply when using COLOR. Default =
           6 (prism).

 COMMON BLOCKS:

	PLOTFILE_COM:
		plotfile - name of output file.
		save_device - name of previous graphics device.
		spool - flag to prevent printing if ENCAPSULATED.

 RESTRICTIONS:
	
	!P.FONT must be set to 0 (zero) for the hardware-drawn (PostScript)
	fonts. If !P.FONT = -1, Hershey vector drawn fonts are used.  Vector 
	fonts should always be used for 3-dimensional plots.

 EXAMPLES:

	To redirect a plot to a PostScript printer named 'printer':

	BEGPLOT
	PLOT,x,y
	ENDPLOT,P='printer'

	To redirect a plot to an Encapsulated PostScript (EPS) file
	and inhibit printing:

	BEGPLOT,NAME='test.eps',/ENCAPSUATED
	PLOT,x,y
	ENDPLOT,/NOPRINT

	To use a 'layout file':

	BEGPLOT,LAYOUT='layoutfile'
	PLOT,x,y
	ENDPLOT

	Layout files can to used to set up the graphics device
	keywords. A syntax similar to Xdefaults files is used.  Each
	line looks like "device.keyword:value". 'device' is the
	name of graphcis device used by SET_PLOT. ('ps' is currently
	the only device supported).  'keyword' is the name of the
	keyword to send to DEVICE, and 'value' is the value to send
	with the keyword (1 is used to set and 0 to unset). A layout
	file to produce a half-page, portrait, EPS file  using the
	Times-Roman 12 point font and PREVIEW would look like:

	ps.font:times
	ps.font_size:12
	ps.portrait:1
	ps.encapsulated:1
	ps.preview:1
	ps.inches:1
	ps.xsize:5.0
	ps.ysize:5.0

	All of the keywords defined above can be set in this manner.

	To abort after running BEGPLOT but before running ENDPLOT, run
	KILLPLOT. This will close the plotfile and reset the graphics
	device to the one being used before BEGPLOT was called.

	See also the documentation for KILLPLOT and ENDPLOT.

 COPYRIGHT NOTICE:

	Copyright 1993, The Regents of the University of California. This
	software was produced under U.S. Government contract (W-7405-ENG-36)
	by Los Alamos National Laboratory, which is operated by the
	University of California for the U.S. Department of Energy.
	The U.S. Government is licensed to use, reproduce, and distribute
	this software. Neither the Government nor the University makes
	any warranty, express or implied, or assumes any liability or
	responsibility for the use of this software.

 MODIFICATION HISTORY:

 	Based on BEGPLT by Phil Klingner, NIS-3, LANL.

	Modified and renamed BEGPLOT. Michael J. Carter, NIS-1, LANL,
	March, 1994.

       Fixed landscape mode bug.  mjc, 1/24/95.

       Added INVBW keyword to load inverse black & white color map - 
       useful for printing spectrograms.

(See /host/bluemoon/usr2/idllib/sdss/allpro/begplot.pro)


BINARY_SEARCH

[Previous Routine] [Next Routine] [List of Routines]

 NAME:
    BINARY_SEARCH

 CALLING SEQUENCE:
    binary_search,arr,x,index

 PURPOSE:
    Perform a binary search on arr, an input array, for the closest match
    to x.

(See /host/bluemoon/usr2/idllib/sdss/allpro/binary_search.pro)


BTC_EXTRACT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       BTC_EXTRACT
 PURPOSE:
	Run sextractor on an image using the parameters passed in param_struct

 CALLING SEQUENCE:
       btc_extract, param_struct, filename

 INPUTS:
	param_struct: a structure containing all the parameters needed
		      to run sextractor
	filename: image to be processed
       
 OUTPUTS:
	

 OPTIONAL OUTPUT ARRAYS:

 INPUT KEYWORD PARAMETERS:
 
 PROCEDURE: This processes an image on disk using the parameters provided.
	

 REVISION HISTORY:
	Tim McKay	UM	1/8/98
	Tim McKay	UM	3/7/98  
		Added check for environment variables 
			EXTRACT_BIN, and EXTRACT_PAR
	Tim McKay	UM	11/3/98
		Altered for proper use of sextractor 2.0.15
	Tim MCKay	UM	1/14/99
		Made work for BTC data from rextract

(See /host/bluemoon/usr2/idllib/sdss/allpro/btc_extract.pro)


BTC_EXTRACT_SETUP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       BTC_EXTRACT_SETUP
 PURPOSE:
	Set up a parameter structure for sextractor operation on btc data

 CALLING SEQUENCE:
       btc_extract_setup, param_struct

 INPUTS:
       
 OUTPUTS:
	param_struct: a structure containing all the parameters needed
		      to run sextractor

 OPTIONAL OUTPUT ARRAYS:

 INPUT KEYWORD PARAMETERS:
 
 PROCEDURE: Prepares a param_struct for BTC sextractor operation
	

 REVISION HISTORY:
	Tim McKay	UM	1/8/98
	Tim McKay	UM	3/7/98  
	Tim McKay	UM 	1/14/99

(See /host/bluemoon/usr2/idllib/sdss/allpro/btc_extract_setup.pro)


CIRC_RADEC

[Previous Routine] [Next Routine] [List of Routines]

 NAME: 
    circ_radec
       
 PURPOSE: 
    Circles an ra and dec position on the input image.  We need 
    a photo structure, an index and the position of the object with that
    index inorder to complete the mapping.	

 CALLING SEQUENCE: 
    circ_radec, photostr, index, objx, objy, ra, dec, image, 
    nodisplay=nodisplay, radius=radius,color=color,box=box
      
                 

 INPUTS: photostr: a photo structure
         index: the index of an object in that structure
         objx, objy: the x and y positions of index object.
         ra, dec:  the ra and dec to be circled.
         image:  the image on which to circle.  
                 Only need this if NOT nodisplay

 INPUT KEYWORD PARAMETERS:
         nodisplay:  if set, image will not be displayed.
         radius: radius of the circle.  Default is image size/10.0
         clr: color index to make the mapping from.
         /box: use a box instead of a circle.  radius will be side of box
         /silent: Shut off the messages except errors.

       
 OUTPUTS: none

 CALLED ROUTINES: 
                  CONVERT2XY
                  POLYWARP
                  KMAP
                  (RDIS_SETUP)
                  (RDIS)
                  TVCIRCLE
                  (TVBOX)

 
 PROCEDURE: 
	convert the ra and dec to x y coordinates
	

 REVISION HISTORY:
	Author: Erin Scott Sheldon Umich 5/25/99
       
                                      

(See /host/bluemoon/usr2/idllib/sdss/allpro/circ_radec.pro)


CLOSE_MATCH

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 close_match

 PURPOSE:
 this will find close matches between 2 sets of points (t1,s1)
 and (t2,s2) (note t1,t2,s1,s2 are all arrays) in a 2 dimentional space.
 differnt then close_match in that it gives the 'allow' CLOSEST matches
 CALLING SEQUENCE:
 close_match,t1,s1,t2,s2,m1,m2,ep,allow,miss1

 INPUTS:
 t1,s1: the coordinates of the first set
 t2,s2: the coordinates of the second set
 ep:  this is the error which defines a close match. A pair is considered
 a match if |t1-t2| AND |s1-s2| are both less than ep. This is faster
 than doing a euclidean measure on the innermost loop of the program
 and just as good.
 allow: how many matches in the (t2,s2) space will you allow for
 each (t1,s1)

 OUTPUTS:
 m1,m2: the indices of the matches in each space. That is  
 (t1(m1),s1(m1)) matches (t2(m2),s2(m2))
 miss1: this gives the index of the things in x1 NOT found to match (optional)

 OPTIONAL KEYWORD PARAMETERS:
 none

 NOTES:
 It sorts the t2 list so that it can do a binary search for each t1.
 It then carves out the sublist of t2 where it is off by less than ep.
 It then only searches that sublist for points where s1 and s2 differ
 by less than ep. 
 PROCEDURES CALLED:
 binary_search, rem_dup
 REVISION HISTORY:
 written by David Johnston -University of Michigan June 97

   Tim McKay August 97
 	bug fixed, matcharr extended to "long" to accomodate ROTSE I images
   Tim McKay July 99
	bug fixed to correctly handle the first object in list 2, and 
	especially the case with a single object in list 2

(See /host/bluemoon/usr2/idllib/sdss/allpro/close_match.pro)


CLOSE_MATCH_RADEC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 close_match_radec

 PURPOSE:
 this will find close matches between 2 sets of points (t1,s1)
 and (t2,s2) (note t1,t2,s1,s2 are all arrays) in ra dec space.
 
 CALLING SEQUENCE:
 close_match_radec,t1,s1,t2,s2,m1,m2,ep,allow,miss1

 INPUTS:
 t1,s1: the ra dec of the first set
 t2,s2: the ra dec of the second set
 ep:  this is the error which defines a close match. A pair is considered
 a match if |t1-t2|/cos(dec) AND |s1-s2| are both less than ep. This is faster
 than doing a euclidean measure on the innermost loop of the program
 and just as good.
 allow: how many matches in the (t2,s2) space will you allow for
 each (t1,s1)

 OUTPUTS:
 m1,m2: the indices of the matches in each space. That is  
 (t1(m1),s1(m1)) matches (t2(m2),s2(m2))
 miss1: this gives the index of the things in x1 NOT found to match (optional)

 OPTIONAL KEYWORD PARAMETERS:
 none

 NOTES:
 It sorts the t2 list so that it can do a binary search for each t1.
 It then carves out the sublist of t2 where it is off by less than ep.
 It then only searches that sublist for points where s1 and s2 differ
 by less than ep. 
 PROCEDURES CALLED:
 binary_search, rem_dup
 REVISION HISTORY:
 written by David Johnston -University of Michigan June 97

   Tim McKay August 97
 	bug fixed, matcharr extended to "long" to accomodate ROTSE I images
   Tim McKay 6/23/98
	Altered to be an ra dec match, with appropriate scaling of ra range...
   Tim McKay 7/8/99
	Altered to order matches by distance, rather than just ra dec distance

(See /host/bluemoon/usr2/idllib/sdss/allpro/close_match_radec.pro)


COMBINE_ATLAS

[Previous Routine] [Next Routine] [List of Routines]

 NAME: 
    COMBINE_ATLAS

 PURPOSE: 
    Subroutine of get_atlas.  Combines images

 CALLING SEQUENCE:
   combine_atlas,xs, ys, cnum, color,imtot, 
         imu=imu,img=img,imr=imr,imi=imi,imz=imz

 INPUTS:  
          xs: xsize array
          ys: ysize array
          cnum: color numbers
          color: ['u','g'.....
          imtot: output array with all subimages in it.
          imu, img, ....

 OUTPUTS: 
          imtot

 REVISION HISTORY:
    Erin Scott Sheldon  3/14/99  Just a modularization.

(See /host/bluemoon/usr2/idllib/sdss/allpro/combine_atlas.pro)


COMBINE_STRUCTS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    COMBINE_STRUCTS

 PURPOSE:
  takes two arrays of structures str1,str2 which have the
  same number of elements but possibly different tags
  and makes another structure which has the same number of elements
  but the tags of both str1,str2 and has their respective tags 
  values copied into it

 CALLING SEQUENCE
    combine_structs, struct1, struct2, newstruct, structyp=structyp

 INPUTS:
    struct1,struc2: The two structures to be combined. If structure arrays, 
               Must contain the same number of structs.

 KEYWORD PARAMETERS:
   structyp: a string with the name of the new structure.
     if already defined the program will crash.

 Author Dave Johnston UofM

(See /host/bluemoon/usr2/idllib/sdss/allpro/combine_structs.pro)


COMPUTE_SEP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    COMPUTE_SEP
 PURPOSE:
  compute the seperation in arc seconds and position angle
  between an objects two children if it has two children
  position angle is an angle between 0 degrees and 180 degrees
  NOT 0 to 360 
  so it is not really the position angle of ONE with
  respect to the OTHER (ie. it is order independent)
  0 degrees is horizontal and 90 degrees vertical 
  cat is the sdss photo structure and index is the index of the parent
  assumes two children are indices index+1 and index+2

 CALLING SEQUENCE:
  compute_sep,cat,index,separation,position_angle

Revision History:
	David Johnston 5/20/99

(See /host/bluemoon/usr2/idllib/sdss/allpro/compute_sep.pro)


CONCAT_DSTRUCTS

[Previous Routine] [Next Routine] [List of Routines]

 NAME:
    CONCAT_DSTRUCTS
       
 PURPOSE:
    Concatenate two possibly DIFFERENT structures that have common tags 
    but not necessarily identical tags. 
   
    WARNING: CONCAT_DSTRUCTS just takes the common tags, so some tags
    might be lost!

 CALLING SEQUENCE:
    concat_dstructs,str1,str2,strsum

 INPUTS: 
    str1, str2: two structures.

 OPTIONAL INPUTS:
    NONE

 KEYWORD PARAMETERS:
    NONE
       
 OUTPUTS: 
    strsum: concatenated structure with only common tags from str1,str2

 OPTIONAL OUTPUTS:
    NONE

 CALLED ROUTINES:
    REM_DUP
    COPY_STRUCT
 
 PROCEDURE: 
    
 SIDE EFFECTS:
    The order of tags will follow the order in str1.
	

 REVISION HISTORY:
    Created: 10/12/2000 Erin Scott Sheldon UofM
       
                                      

(See /host/bluemoon/usr2/idllib/sdss/allpro/concat_dstructs.pro)


CONCAT_STRUCTS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    CONCAT_STRUCTS
 
 PURPOSE:
  for concatenating two arrays of structures of the same type
  but not necessarily the same name or order of tag names.

 CALLING SEQUENCE:
   concat_structs, str1, str2, strsum

 INPUTS:
   str1, str2: 2 structures with the same tags to be concatenated.

 OUTPUTS:
   strsum: concatenetion of str1, str2, with tag names in the order
        of str1. If tags have same name but different type, then
        a type conversion is performed, with result having type
        of tag in str1.  Resulting structure has name of str1.

 Author: Dave Johnston  UofM
 Used MATCH procedre to make sure tags all match. Use match indices
   to copy values.

(See /host/bluemoon/usr2/idllib/sdss/allpro/concat_structs.pro)


CONVERT2RD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    CONVERT2RD

 CALLING SEQUENCE:
    convert2rd,x,y,ra,dec,rac=rac,decc=decc

 PURPOSE:
    Convert from x-y to ra and dec

(See /host/bluemoon/usr2/idllib/sdss/allpro/convert2rd.pro)


CONVERT2XY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    CONVERT2XY

 CALLING SEQUENCE:
    convert2xy,ra,dec,xout,yout,rac=rac,decc=decc

 PURPOSE:
    Convert from ra and dec to x-y

(See /host/bluemoon/usr2/idllib/sdss/allpro/convert2xy.pro)


COPY_ATLAS

[Previous Routine] [Next Routine] [List of Routines]

 NAME: 
    COPY_ATLAS

 PURPOSE: 
    Subroutine of get_atlas. 

 CALLING SEQUENCE:
  copy_atlas, col,im, xs,ys,size_im, 
              imu=imu, img=img, imr=imr, imi=imi, imz=imz

 INPUTS:  col: color index
          im:  input image
          xs: xsize array
          ys: ysize array
          imu: img: imr: imi: imz:

 OUTPUTS: one of the subimages listed above.

 REVISION HISTORY:
    Erin Scott Sheldon  3/14/99  Just a modularization.

(See /host/bluemoon/usr2/idllib/sdss/allpro/copy_atlas.pro)


DATAIMAGE::ANGLE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dataImage::angle

 PURPOSE:
       This method replaces the data with an image where each pixel
       has the theta value of that pixels polar coordinate, where the
       origin is at the specified coordinate. Together with the
       dataImage::radius method, it can be used to get the polar
       coordinates of each pixel.

 CALLING SEQUENCE:
       oDataImage->angle, Pixelcoordinate

 INPUTS:
       Pixelcoordinate: A vector with the coordinates of the polar
                        coordinate systems center.

 EXAMPLE:
       exampleImage->angle, [400,400]

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DATAIMAGE::BUTTERWORTHFILTER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dataImage::butterworthFilter

 PURPOSE:
       This method applies a Butterworth filter to the image.

 CALLING SEQUENCE:
       oDataImage->butterworthFilter(Cutoff,Order)

 INPUTS:
       Cutoff:  This parameter is the value of the lowest (highest)
                spatial wavelength allowed through the filter.
       Order:   The order of the butterworth filter. Higher values
                will results in more ringing, and a sharper boundry
                between filtered and unfiltered frequencies.

 KEYWORD PARAMETERS:
       LOWPASS: By default, the image is highpass filtered. If this
                keyword is set, it is lowpass filtered instead. This
                correspondonds to smoothing the image.       
       MASK:    One may provide a pixel mask to remove the influence
                unwanted pixels. See the documentation for
                dataImage::frequencyFilter for the handling of masks.
       EXTENDEDSIZE: To reduce edge effects, the filtering may be
                performed on an image which has been padded with
                zeros, which are then masked. This parameter sets the
                size of the padded image.

 PROCEDURE:
       The Cutoff us converted from a wavelength to a wavenumber, the
       butterworth filter is constructed, and then applied to the image data.

 EXAMPLE:
       To apply an butterworth smoothing filter,
       exampleImage->butterworthFilter(10,2,/LOWPASS)

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DATAIMAGE::CENTER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dataImage::center

 PURPOSE:
       This method moves the center (or some specified coordinate) to
       the corner of the image. This is particularly useful for
       working with PSF images.

 CALLING SEQUENCE:
       oDataImage->center

 KEYWORD PARAMETERS:
       PIXELCOORDS: This keyword holds the coordiantes to be placed
                    at the corner of the image. If not specified, the
                    center is used. 

 EXAMPLE:
       psfDataImage->center

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DATAIMAGE::CLONE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dataImage::clone

 PURPOSE:
       This method creates a duplicate image object. If no temporary
       file name is provided, the data for the new image is stored in
       memory. 

 CALLING SEQUENCE:
       Result = oDataImage->Clone(Tempfilename)

 OPTIONAL INPUTS:
       tempFileName: This string contains the file name for the file
                     in which to store the image data, if any.  
	
 OUTPUTS:
       A copy of the image is returned. 

 SIDE EFFECTS:
       The clone is a new object; each must be destroyed separately.

 EXAMPLE:
       imagecopy = exampleimage->clone(tempfilename)

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen, Jr. 1997

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DATAIMAGE::COPY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dataImage::copy

 PURPOSE:
       This method is identical to the dataImage::clone method

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DATAIMAGE::ELLIPSESPACE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dataImage::ellipseSpace

 PURPOSE:
       This method creates a model of the galaxy using fits in
       (intensity, radius, angle) space. The center of the galaxy
       must be provided. This method works well for elliptical
       galaxies where the center of the isophotes varies little with
       the intensity of the isophote.

 CALLING SEQUENCE:
       oDataImage->ellipseSpace, CenterCoord, TransformSize

 INPUTS:
       CenterCoord:   A two element array giving the x,y coordinates
                      of the center of the galaxy in the image.
       TransformSize: The image of the galaxy is often at much higher
                      resolution than necessary for fitting
                      isophotes; transformSize specifies has small an
                      array to regrid the image to before examination
                      of the isophotes. 

 KEYWORD PARAMETERS:
       MASKIMAGE:     An object of type maskImage with the pixels not
                      to be used in the calculation of the isophotes
                      masked. 
       FITTERMS:      The number of terms to use in polynomial
                      fitting of log(radius) to log(intensity). 
       FOURIERTERMS:  The number of terms to retain the the fourier
                      expansion of radius as a function of position
                      angle. 
       SKY:           An estimate of the sky background value. This
                      is important primarily when FITTERMS is also
                      set.
       VERBOSE:       If this keyword is set, the progress of the
                      method is reported at several points in the
                      process. This can be interesting for the
                      impatient.  

 RESTRICTIONS:
       The completeness of the mask is vital to the success of the
       fitting; a small number of high or low pixels may cause very
       serious corruption in the result. For this reason, it is often
       helpful to median filter (or otherwise smooth) the image
       before it is fit.

 PROCEDURE:
       For each unmasked pixel in the resized image, the angle,
       radius, and intensity are calculated. Triangulation is then
       used to calculate an array where the index of one dimension is
       proportional to the log of the intensity, the index of the
       other dimension is proportional to the position angle, and the
       value of each pixel is the triangulated radius. Depending of
       the keyword parameters set, the lines of constant intensity
       may be low pass filtered, the lines of constant angle may
       be replaced by best fits to a (log) polynomial, or
       both. Triangulation is then used to return to the original
       (x,y) coordinate system. For additional details, see Neilsen
       (1998).

 EXAMPLE:
       oDataImage->ellipseSpace, [402,410], [64,64], MASKIMAGE=mask,$
            FITTERMS=2, FOURIERTERMS=4, SKY=1.8

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DATAIMAGE::ESTIMATEDISPLAYRANGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dataImage::estimateDisplayRange

 PURPOSE:
       This method estimates a good display range for viewing the image.

 CALLING SEQUENCE:
       Result=oDataImage->estimateDisplayRange(Maskimage)

 OPTIONAL INPUTS:
       Maskimage:  A maskImage mask covering bad pixels.
	
 KEYWORD PARAMETERS:
       STRETCH:    This pararmeter is set to 16 by default. Larger
                   values will result in a more uniform appearance in
                   the image, with more extreme values unsaturated.

 OUTPUTS:
       An estimated range for display is returned.

 PROCEDURE:
       

 EXAMPLE:
       To display an image using a reasonable range:
       range=exampleImage->estimateDisplayRange(exampleMask)
       TV,exampleImage->getData(RANGE=range)

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DATAIMAGE::ESTIMATEK

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dataImage::estimateK

 PURPOSE:
       This uses a power spectrum fit to esitmate k, the parameter
       of the Wiener filter.

 CALLING SEQUENCE:
       k=oDataImage->EstimateK(Psf)

 INPUTS:
       Psf:   A dataImage object with the PSF of the image

 KEYWORD PARAMETERS:
       MASK:            A mask which covers pixels not to be use in the
                        fits. Unlike the case of SBF power spectrum
                        fitting, one does not necessarily want to cover
                        all point sources.
       WAVELENGTHRANGE: as per dataImage::pspecFit() 
       POWERRANGE:      as per dataImage::pspecFit() 
       FITDATA:         as per dataImage::pspecFit() 
       SBFCOUNTS:       if this keyword is set, it the noise if fit
                        to the histogram of negative pixel values,
                        and the SBF noise removed to arrive at the
                        final noise.
   

 OUTPUTS:
       This method returns an estimate of the value of "k" which is
       appropriate for use in a Wiener filter.

 RESTRICTIONS:
       This method assumes the image is dominated by randomly
       distributed point sources. If this is not the case, the
       returned value will not necessarily be the appropriate "k"
       value, though it is often still a good estimate in practice.

 PROCEDURE:
       

 EXAMPLE:
       To wiener filter an image with a psf in dataImage psf,
       k=exampleDataImage->estimateK(psf)
       exampleDataImage->wienerFilter,psf,k

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.
       Sept. 30, 1997  EHN adds alternate estimation method triggered
                       by setting the SBFCOUNTS keyword. 

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DATAIMAGE::ESTIMATESIGMA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dataImage::estimateSigma

 PURPOSE:
       This method estimates the sky sigma using the pixels with low
       pixel values. It only provides meaningful results where the
       sky and diffuse background objects have been subtracted.

 CALLING SEQUENCE:
       sigma=oDataImage->estimateSigma(Maskimage)

 OPTIONAL INPUTS:
       Maskimage:  A maskImage object covering the pixels not to be
                   considered. 
	
 OUTPUTS:
       An estimate of the sky standard deviation is returned

 RESTRICTIONS:
       The image must be sky subtracted, and diffuse objects must
       either be subtracted or masked.

 PROCEDURE:
       The sky sigma is estimated to be the square root of the sum of
       the squares of the values of the unmasked, negative pixels. 

 EXAMPLE:
       PRINT,exampleImage->estimateSigma()

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DATAIMAGE::EXPONENTIALFIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dataImage::exponentialFit

 PURPOSE:
       Fit in exponential profile to a section of an image of a
       galaxy, and return the best fits.

 CALLING SEQUENCE:
       Result=oDataImage->exponentialFit(Centercoord,Anglerange,Radiusrange)

 INPUTS:
       Cenctercoord:  A two element array containing the x,y
                      coordinates of the center of the galaxy.
       Anglerange:    The range of angles in which to fit the
                      profile. This range should be small enough that
                      the pixels at a given radius will have roughly
                      the same flux. The angle is measure in radians.
       Radiusrange:   This is the range of radii over which to make
                      the fit. Particularly in double exponential
                      profiles, better sky estimates can be made from
                      large radii only.

 KEYWORD PARAMETERS:
       MASKIMAGE:      An array or maskImage object with a mask
                       covering points not to be used in the fit.
       INITIAL:        A 3 element array, the initial parameters of
                       the fits. The first element is an estimate of
                       the sky, and is usually all that is
                       necessary. At the completion of the
                       procedure. it will hold the best exponential
                       fit parameters.
       RANGEMASK:      A mask covering all pixels not used in the
                       profile fit, of the same type as MASKIMAGE.

 OUTPUTS:
       Fitsky:         The returned value of the function is an array
                       with the fits as follows:
                         FitSky[0,*]  =  the radii of the fit points
                         FitSky[1,*]  =  the fluxes of the fit points 
                         FitSky[2,*]  =  the fit value of the best fit
                                       exponential fit
                         FitSky[3,*]  =  the fit value of the best fit
                                       R^(1/4)

 RESTRICTIONS:

 PROCEDURE:
       Arrays of good pixels and the corresponding radii are
       created. Least squares fits are then made at an expnential
       plus a constant (sky), and an r^(1/4) law plus a constant.

 EXAMPLE:
       To plot the profile and the different fits:
       skyFit=oDataImage->exponentialFit, [401,410], [0.0,0.52],$
                   [30,500], MASKIMAGE=imageMask, INITIAL=[4.5,0.0,0.0]
       PLOT,skyFit[0,*],skyFit[1,*],PSYM=3
       OPLOT,skyFit[0,*],skyFit[2,*]
       OPLOT,skyFit[0,*],skyFit[3,*],LINE=2

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DATAIMAGE::FOURIERTRANSFORM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dataImage::fourierTransform

 PURPOSE:
       This method replaces the data associated with an image with it
       fourier transform

 CALLING SEQUENCE:
       oDataImage->fourierTransform

 KEYWORD PARAMETERS:
       INVERSE: If this keyword is set, the method takes the inverse
                fourier transform.      

 SIDE EFFECTS:
       After the transform is taken, the image data is complex.

 PROCEDURE:
       This method uses the IDL FFT funtion.

 EXAMPLE:
       oDataImage->fourierTransform

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DATAIMAGE::FREQUENCYFILTER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dataImage::frequencyFilter

 PURPOSE:
       This method replaces the data with the data passed through a
       fourier frequency filter. 

 CALLING SEQUENCE:
       oDataImage->frequencyFilter, Filter       

 INPUTS:
       Filter: This parameter is an array with the frequency filter
               to be applied to the image. If the size of the filter
               is greater than that of the data array, the data is
               padded with zeros before the filtering, and cut back
               to its original size afterwards.

 KEYWORD PARAMETERS:
       MASK:   Either a mask image or an array of the same size as
               the data image, where bad pixels are marked with ones
               and good pixels with zeros. Masked pixels are not used
               in the creation of the filtered image. See the
               PROCEDURE section of this documentation for a
               description of how masked images are handled.

 PROCEDURE:
       The filtered image is created by multiplying the fourier
       transform of the data image by the filter, and useing the
       inverse transform to bring it back into image space. To
       understand the handling of the mask, if provided, it is
       easiest to view the filter as a convolution. In the unmasked
       case, each pixel in the returned image is the weighted average
       of the surrounding pixels in the original image, where the
       weights are determined by the fourier transform of the
       filter. If a mask is provided, the weights of the masked
       pixels are set to zero. This procedure is not mathematically
       justified in the general case, but does provide good results
       where the filter lets through spacial frequencies that are
       large compared to the size of the masked regions. 

 EXAMPLE:
       To apply an "ideal" filter to an image,
       idealFilter=FLTARR(256,256)
       idealFilter(WHERE(DIST(256,256) LT 100)) = 1
       oDataImage->frequencyFilter, idealFilter
       

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DATAIMAGE::GETDATA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dataImage::getData

 PURPOSE:
       This methods returns an array containing the image data,
       optionally scaled to a provided exposure time, or for display.

 CALLING SEQUENCE:
       Result=oDataImage->GetData()

 KEYWORD PARAMETERS:
       TIME:    If this keyword is set, the images is scaled to the
                provided exposure time.
       DISPLAY: If this keyword is set, the image is scaled to a
                0:255 range suitable for display.
       RANGE:   This keword is used to scale the display output to a
                specified range of pixel values. The return array
                will be scaled such that pixels of value range[0]
                will be 0, and those of range[1] will be 255. 
       ERANGE:  If this keyword is set, a value for the RANGE is estimated.

 OUTPUTS:
       This function returns the data array for the image, scaled as
       specified by any present keywords.

 EXAMPLE:
       To display an image such that pixel values between 50 and 4000
       are distinguishable,
       TV, oDataImage->GetData(/ERANGE)       

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DATAIMAGE::GETPROPERTY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dataImage::GetProperty

 PURPOSE:
       This method gets some of the properties of the data image.

 CALLING SEQUENCE:
       oDataImage->GetProperty, FILENAME=filename, TEMPNAME=tempName,$
                  DATAARRAY=data, EXPOSURETIME=exposureTime,$
                  NEXPOSURES=numberOfExposures, DATAHEADER=dataHeader

 KEYWORD PARAMETERS:
       FILENAME - a string containing the name of the file assiciate 
                  with the data image
       TEMPNAME - a string with the file name of a temporary file for the
                  data to be saved in if onDisk is used
       DATAARRAY- a two dimensional floating point array containing
                  the image data 
       EXPOSURETIME - the exposure time of the image, such that the
                      count rate for a given x,y position equals
                      data(x,y)/exposureTime 
       NEXPOSURES - the number of exposures combined in the image
       DATAHEADER - a structure containing the header information for the
             image, in the format used by the image loading and saving
             routines from the astrolib library
       
 EXAMPLE:
       oDataImage->GetProperty,FILENAME=filename,$
                               EXPOSURETIME=exposureTime
       PRINT,"Image ',filename,' has an exposure time of ',exposureTime

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DATAIMAGE::IDEALFILTER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dataImage::idealFilter

 PURPOSE:
       This method applies an ideal filter to the image.

 CALLING SEQUENCE:
       oDataImage->idealFilter(Cutoff)

 INPUTS:
       Cutoff:  This parameter is the value of the lowest (highest)
                spatial wavelength allowed through the filter.

 KEYWORD PARAMETERS:
       LOWPASS: By default, the image is highpass filtered. If this
                keyword is set, it is lowpass filtered instead. This
                correspondins to smoothing the image.       
       MASK:    One may provide a pixel mask to remove the influence
                unwanted pixels. See the documentation for
                dataImage::frequencyFilter for the handling of masks.

 PROCEDURE:
       The Cutoff us converted from a wavelength to a wavenumber, the
       ideal filter is constructed, and then applied to the image data.

 EXAMPLE:
       To apply an ideal smoothing filter,
       exampleImage->idealFilter(10,/LOWPASS)

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DATAIMAGE::LOAD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dataImage::load

 PURPOSE:
       This method load an image from disk into the image object.

 CALLING SEQUENCE:
       oDataImage->Load, FileName

 OPTIONAL INPUTS:
	fileName: A string containing the name of the file from which
	          to load the image. If no name is given, the current
	          file name associated with the object is used.

 SIDE EFFECTS:
       The previous data and header information is lost.

 EXAMPLE:
       exampleImage->load, 'exampleImageFile.hhh'

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen, Jr. 1997

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DATAIMAGE::NORMALIZE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dataImage::normalize

 PURPOSE:
       This method normalizes the total flux of the image to a set
       value. This is particularly useful for normalizing PSF images
       to one count.

 CALLING SEQUENCE:
       oDataImage->normalize

 KEYWORD PARAMETERS:
       TOTAL:  Set this keyword to the desired total value of pixels
               in the image, if different from one.

 EXAMPLE:
       psfDataImage=OBJ_NEW('dataImage')
       psfDataImage->load, 'psfImageFile.hhh'
       psfDataImage->normalize

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DATAIMAGE::PIXELWAVENUMBER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dataImage::pixelWavenumber

 PURPOSE:
       Returns an array, where the value of each pixel corresponds to
       the wavenumber represented by that pixel in a fourier
       transformed image.

 CALLING SEQUENCE:
       Result = aDataImage->pixelWavenumber()

 KEYWORD PARAMETERS:
       EXTENDEDSIZE:  If the image to be considered is larger than
                      the data image, this keyword can be set to the
                      size desired. Smaller values are not allowed.

 OUTPUTS:
       The result is a two dimensional array of wavenumber values,
       suitable for use in creating frequency filters.

 PROCEDURE:
       This procedure is a wrapper for the DIST function in IDL.

 EXAMPLE:
       To apply an "ideal" filter to an image,
       idealFilter=FLTARR(256,256)
       idealFilter(oDataImage->pixelWavenumber() LT 100)) = 1
       oDataImage->frequencyFilter, idealFilter

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.
       September, 1998 Modified to use DIST to calculte wavenumbers

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DATAIMAGE::POWERSPECTRUM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dataImage::powerSpectrum

 PURPOSE:
       This method replaces the image data by its power spectrum.

 CALLING SEQUENCE:
       oDataImage->powerSpectrum

 EXAMPLE:
       To plot the power spectrum of an image
       testImage=OBJ_NEW('dataImage')
       testImage->load,'imageFile.hhh'
       testImage->powerSpectrum
       TVSCL,ALOG(testImage->getData())

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DATAIMAGE::PSFFILTER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dataImage::psfFilter

 PURPOSE:
       Frequency filters the image to emphasize point sources. It is
       intended to emphasize point source in front of extended
       sources, such as galaxies. If the galaxy has a bright, point
       source like center, it is often helpful to smooth it out
       before the appliation of this filter.

 CALLING SEQUENCE:
       oDataImage->psfFilter, Psf, Flux

 INPUTS:
       Psf:  A dataImage object with the point spread function of the image.
       Flux: An estimate of the total flux of point sources in the image.

 KEYWORD PARAMETERS:
       MODEL: A dataImage object containing a model for the
              background on which you are detecting point sources.
       SKY:   The sky value. If this is included already in the
              model, this keyword should not be set.

 PROCEDURE:
       This method uses frequency filtering to emphasize point
       sources. It begins by calculating the power spectrum of the
       point sources, using the psf and an estimate of their total
       flux, and the power spectrum of everything else, using the
       model (where available) or the power spectrum of the data
       itself (which assumes the background dominates the point
       sources). A frequency filter is then constructed which lets
       though only those frequencies where the power from the point
       sources is largest compared with other sources. This filter is
       essentially a Wiener filter where everything but the point
       sources is reguareded as noise. 

 EXAMPLE:
       oDataImage->psfFilter, psf, estimatedFlux

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DATAIMAGE::PSPECFIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dataImage::pspecFit

 PURPOSE:
       Fit the power spectrum of the image to a linear function of
       the power spectrum of the PSF. This is primarily useful for
       separation of surface brightness fluctuation (SBF) variance
       from noise variance.

 CALLING SEQUENCE:
       Result=oDataImage->pspecFit(Psf)

 INPUTS:
       Psf:   A dataImage object containing the PSF for the image.

 KEYWORD PARAMETERS:
       MASK:            A maskImage object which masks all pixels not
                        to be used.
       WAVELENGTHRANGE: A two element array giving the range of wavelength
                        over which to fit the power spectra,
       POWERRANGE:      A two element array giving the range of power
                        over which to fit the power spectra,
       FITDATA:         This keyword is set to an array with the
                        results of the fit. Fitdata[0,*] is an array
                        of wavenumbers, Fitdata[1,*] is the
                        corresponding power, and Fitdata[2,*] is the
                        corresponding fit to the power.

 OUTPUTS:
       This method returns a two element array. The first element is
       the constant term in the linear term, and the second element
       is the linear term.

 OPTIONAL OUTPUTS:
       FITDATA:         see the keyword description

 PROCEDURE:
       The fit is performed with the IDL POLY_FIT routine.

 EXAMPLE:
       

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DATAIMAGE::RADIUS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dataImage::radius

 PURPOSE:
       This method replaces the data with an image where each pixel
       contains the distance of that pixel to a specified coordinate.
       It may be used, for exampled, to get distances from the center
       of a galaxy,

 CALLING SEQUENCE:
       oDataImage->radius, CenterCoord

 INPUTS:
       CenterCoord: The coordinate from the the distances are to be
       calculated. 

 EXAMPLE:
       To create an image of the distances to the center of a galaxy
       centered at [410,400] in the image galaxyImage,
       radiusImage=galaxyImage->clone()
       radiusImage->radius, [410,400]

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DATAIMAGE::RESIZE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dataImage::resize

 PURPOSE:
       This method resizes the image. It does not change the pixel
       scale; it merely cuts off or pads the image to make it the
       desired size.

 CALLING SEQUENCE:
       oDataImage->resize, NewSize

 INPUTS:
       newSize: The dimensions of the new image. 

 RESTRICTIONS:
       At present, images cannot be resized such that one dimension
       is larger than the original, while the other is smaller.

 EXAMPLE:
       To ensure the image is 256x256,
       oDataImage->resize, 256

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DATAIMAGE::SEGMENT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dataImage::segment

 PURPOSE:
       Segment the data image. Pixels above the segmentation value
       are set to one, and those below it are set to zero. Often,
       one would want to use the maskImage::segment instead.

 CALLING SEQUENCE:
       oDataImage->segment, Cutoff

 INPUTS:
       Curoff:  The cutoff value for the segmentation.

 EXAMPLE:
       To create a map of the saturated pixels in an image where the
       saturation value is 4000,
       exampleDataImage->segment,400

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DATAIMAGE::SETPROPERTY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dataImage::SetProperty

 PURPOSE:
       This method sets the properties of the data image.

 CALLING SEQUENCE:
       oDataImage->SetProperty, FILENAME=filename, TEMPNAME=tempName,$
                  DATAARRAY=data, EXPOSURETIME=exposureTime,$
                  NEXPOSURES=numberOfExposures, DATAHEADER=dataHeader

 KEYWORD PARAMETERS:
       FILENAME - a string containing the name of the file assiciate 
                  with the data image
       TEMPNAME - a string with the file name of a temporary file for the
                  data to be saved in if onDisk is used
       DATAARRAY- a two dimensional floating point array containing
                  the image data 
       EXPOSURETIME - the exposure time of the image, such that the
                      count rate for a given x,y position equals
                      data(x,y)/exposureTime 
       NEXPOSURES - the number of exposures combined in the image
       DATAHEADER - a structure containing the header information for the
             image, in the format used by the image loading and saving
             routines from the astrolib library
       

 EXAMPLE:
       oDataImage->setProperty,FILENAME='newImageFile.hhh',$
                               TEMPNAME='/tmp/newImage.dat',$
                               DATAARRAY='newArray'
                               EXPOSURETIME=400

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DATAIMAGE::TRIANGULATE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dataImage::triangulate

 PURPOSE:
       This method replaces masked pixels with values calculated
       using triangulation from nearby food pixels.

 CALLING SEQUENCE:
       oDataImage->trinagulate, Mask

 INPUTS:
       Mask:  The mask image (a maskImage object), where the pixels
              to be triangulated are masked.

 RESTRICTIONS:
       Triangulation of pixels is limited by the limits of IDL's
       trinagulation routines. The method can be quite slow.

 PROCEDURE:
       This pixels surrounding regions of bad pixels are used to
       create a triangulation grid using the IDL procedure
       TRIANGULATE. Replacement values for the bad pixels are then
       calculated using TRIGRID.

 EXAMPLE:
       To view an image with the masked pixels replaced:
       oDataImage=OBJ_NEW('dataImage')
       oDataImage->load,'galaxyData.hhh'
       oMaskImage=OBJ_NEW('maskImage')
       oMaskImage->load,'galaxyMask.hhh'
       oDataImage->tringulate, oMaskImage
       TV,oDataImage->getData(/DISPLAY)

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DATAIMAGE::WIENERFILTER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dataImage::wienerFilter

 PURPOSE:
       This method replaces the method by a Wiener filtered version
       of the image. For information on using a Wiener filter,
       consult a image processing reference guide, _Digital Image
       Processing_ by Gonzales & Woods (1992), or _The Image
       Processing Handbook_ by Russ (1995).

 CALLING SEQUENCE:
       oDataImage->WienerFilter,Psf,K

 INPUTS:
       Psf:  A dataImage object containing the point spread function
             of the image.
       k:    The parameter "k" of the Wiener filter. 

 RESTRICTIONS:
       There is no accomodation for handling noise or PSF's which
       vary over the image.

 PROCEDURE:
       The Wiener filter is constructed using the supplied PSF and K,
       and then applied to the image.

 EXAMPLE:
       To wiener filter an image,
       psfImage=OBJ_NEW('dataImage')
       psfImage->load, 'imagePSF.hhh'
       dataImage=OBJ_NEW(('dataImage')
       dataImage->load, 'starfield1.hhh'
       k=1.0e-7
       dataImage->wienerFilter,psfImage,k

 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DATAIMAGE__DEFINE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       DATAIMAGE__DEFINE

 PURPOSE:
       This routing defines the dataImage object. The dataImage
       object is intended to be the primary object used to store and
       manipulate astronomical image. 

 CALLING SEQUENCE:
       oDataImage=OBJ_NEW('dataImage')


 MODIFICATION HISTORY:
       Written by:     Eric H. Neilsen Jr., 1997.

(See /host/bluemoon/usr2/idllib/sdss/allpro/dataimage__define.pro)


DCENTER

[Previous Routine] [Next Routine] [List of Routines]

 NAME:
    DCENTER
       
 PURPOSE:
    Center up the display

 CALLING SEQUENCE:
    dcenter, xsize, ysize, px, py, silent=silent

 INPUTS: 
    xsize, ysize: the size of the plot.

 OPTIONAL INPUTS:
    NONE

 KEYWORD PARAMETERS:
    NONE
       
 OUTPUTS: 
    px,py: the new positions of the plot region.

 OPTIONAL OUTPUTS:
    NONE

 CALLED ROUTINES:
    
 
 EXAMPLE: 
    plot, [0,1], [0,1], /nodata, xstyle=4, ystyle=4
    pxold = !x.window*!d.x_vsize
    pyold = !y.window*!d.y_vsize
    xsize = px[1] - px[0]
    ysize = py[1] - py[0]
    dcenter, xsize, ysize, px, py
    position=[ [ px(0), py(0)], [ px(1), py(1) ] ]

    plot, x, y, position=position, /device, /noerase, _extra=extra

 REVISION HISTORY:
    ??-??-2000 Erin Scott Sheldon
       
                                      

(See /host/bluemoon/usr2/idllib/sdss/allpro/dcenter.pro)


DISPLAY_ATLAS

[Previous Routine] [Next Routine] [List of Routines]

 NAME: 
    DISPLAY_ATLAS

 PURPOSE: 
    Subroutine of get_atlas.  Displays image.

 CALLING SEQUENCE
    display_atlas, objstruct, imtot, i, ret, zoom, run, camcol, 
                   field, obj_id, cnum, rerun=rerun, sep=sep, pa=pa, 
                   noprompt=noprompt,silent=silent,
                   hideradec=hideradec,_extra=extra

 Notes:  1. If plot titles don't fit on view screen, just make screen bigger.
         2. Might want to alter the !p.charsize commands in CASE statement
         to fit your tastes.  Same with titles, etc.


 INPUTS:  imtot:  image containing some atlas images
          i:      index of index of atlas image.  May change in this program.
          ph_id:  index of atlas image
          zoom:   zoom or not?
          run:    sdss run
          camcol: camera column
          field:  field of the object
          obj_id: id of object
          cnum: the requested color indexes
          color_str: color strings ['u','g',...
          struct: a photo structure
	   hideradec: if set it will not include ra dec in title	
          _extra: extra keywords for plotting.

 OUTPUTS: i may have changed
          ret: returns 'next' or 'q' for quit

 REVISION HISTORY:
    Erin Scott Sheldon  3/14/99  Just a modularization.
    Dave Johnston shortened plot titles to fit more info 
    Dave Johnston 5/18/99 added seperation and position angle
	(when nchild eq 2) to title
	added hideradec keyword

(See /host/bluemoon/usr2/idllib/sdss/allpro/display_atlas.pro)


DISPLAY_FCHART

[Previous Routine] [Next Routine] [List of Routines]

 NAME: 
    DISPLAY_FCHART
       
 PURPOSE: 
    display a photo finding chart and circle the object that was used 
    to make the chart.  Label axis with arcminutes from the center.
	

 CALLING SEQUENCE:  display_fchart, fchart, object, objx, objy, clr, 
     box=box, gif=gif, ps=ps, fnameps=fnameps, 
     fnamegif=fnamegif, silent=silent, nodisplay=nodisplay, 
     hideradec=hideradec,circ_rad=circ_rad, nocirc=nocirc, _extra=extra
      
                 

 INPUTS: fchart:  The finding chart
         object:  The photo object used to make the finding chart.
         objx:    x-position of object in the finding chart.
         objy:    y-position
         clr:     color index the finding chart was made from 
                                          used in the title.

 INPUT KEYWORD PARAMETERS:
         box:  Draw a box instead of a circle.
         gif:  If set a gif's are output to cwd.
         ps:   If set a postscript files are created for the requested items.
         fnameps: name of ps file.  Default is fchart.ps
         fnamegif: name if gif file.  Default is fchart.gif
         silent:  If set, program will be silent except for error messages.
         nodisplay: If set, there will be No x-window display of the chart.  
               -May still make ps files.-
         hideradec: Don't show the ra and dec on the plots.
         circ_rad: radius of circle.
         nocirc:  if set, no circle is drawn.
         _extra: any extra plotting command keywords.
       
 OUTPUTS: 

 OPTIONAL OUTPUTS: May output .ps or .gif files if requested.

 CALLED ROUTINES:

                  RADECSTR
                     RADEC
                  SIGMA_CLIP
                  BEGPLOT
                  ENDPLOT
                  RDIS_SETUP
                  RDIS:
                      TVIM2_SCL:
                               TVIM2
                  TVCIRCLE
                  TVBOX


 REVISION HISTORY: 
      Author: Erin Scott Sheldon  Umich 5/25/99
	
       
                                      

(See /host/bluemoon/usr2/idllib/sdss/allpro/display_fchart.pro)


ENDPLOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	ENDPLOT	

 PURPOSE:

	Closes and saves the current plotfile.  By default, the file
	is then spooled to the printer using the unix 'lpr -r'
	command. Keywords are available to name the plotfile and
	inhibit spooling.

	See also BEGPLOT and KILLPLOT.

 CATEGORY:

	Misc.

 CALLING SEQUENCE:

	ENDPLOT

	There are no user defined inputs.

 INPUTS:

	None.

 KEYWORD PARAMETERS:

	NOPRINT: Set to prevent spooling.

	P: Name (string) of printer to spool plotfile to.  'lpr -r
          -Pprintername' is used.

       SHELL: Set to use an intervening shell process for the
                'spawn, "lpr..."' call.  By default, the 
                /NOSHELL keyword to spawn is used.

 OUTPUTS:

	None.

 COMMON BLOCKS:

	PLOTFILE_COM:  See the documentation for BEGPLOT.

 EXAMPLE:

	See the documentation for BEGPLOT.

 COPYRIGHT NOTICE:

	Copyright 1993, The Regents of the University of California. This
	software was produced under U.S. Government contract (W-7405-ENG-36)
	by Los Alamos National Laboratory, which is operated by the
	University of California for the U.S. Department of Energy.
	The U.S. Government is licensed to use, reproduce, and distribute
	this software. Neither the Government nor the University makes
	any warranty, express or implied, or assumes any liability or
	responsibility for the use of this software.

 MODIFICATION HISTORY:

 	Based on ENDPLT by Phil Klingner, NIS-3, LANL.

	Modified and renamed ENDPLOT. Michael J. Carter, NIS-1, LANL,
	March, 1994.

       Added /noshell keyword in call to 'spawn' to speed up printing.
       Use the /shell keyword to 'endplot' to override. 

(See /host/bluemoon/usr2/idllib/sdss/allpro/endplot.pro)


EQ2SURVEY

[Previous Routine] [Next Routine] [List of Routines]

 NAME:
    EQ2SURVEY
       
 PURPOSE:
    Convert from ra, dec to lambda, eta (SDSS survey coordinates)

 CALLING SEQUENCE:
    eq2survey, ra, dec, lambda, eta

 INPUTS: 
    ra: Equatorial latitude in degrees 
    dec: Equatorial longitude in degrees

 OPTIONAL INPUTS:
    None

 KEYWORD PARAMETERS:
    None
       
 OUTPUTS: 
    lambda: Survey longitude in degrees
    eta: Survey latitude in degrees

 OPTIONAL OUTPUTS:
    None

 CALLED ROUTINES:
    ATBOUND
    ATBOUND2
 
 PROCEDURE: 
    
	

 REVISION HISTORY:
    Written: 5/15/2000  Erin Scott Sheldon
                        Taken from astrotools.
       
                                      

(See /host/bluemoon/usr2/idllib/sdss/allpro/eq2survey.pro)


ETA2STRIPENUM

[Previous Routine] [Next Routine] [List of Routines]

 NAME:
    ETA2STRIPENUM
       
 PURPOSE:
    Find which stripe goes with this eta.

 CALLING SEQUENCE:
    stripe = eta2stripenum(eta, southern=southern)

 INPUTS: 
    eta: SDSS survey longitude.

 OPTIONAL INPUTS:
    NONE

 KEYWORD PARAMETERS:
    /southern: This is a southern stripe
       
 OUTPUTS: 
    stripe

 OPTIONAL OUTPUTS:
    NONE

 CALLED ROUTINES:
    NTOSTR
 
 PROCEDURE: 
    
	

 REVISION HISTORY:
    14-NOV-2000 Taken from astrotools
       
                                      

(See /host/bluemoon/usr2/idllib/sdss/allpro/eta2stripenum.pro)


EXIST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   EXIST
 PURPOSE:
   A very simple check to see if a file exists...
 CALLING SEQEUNCE:
   tmp = Exist('STARS.DAT')
 INPUT:
   FILENAME  This is the filename or search spec. that should be checked.
 OUTPUT:
   TMP       The returned result is 1 is the file or files exist and 0 if
               the file of files do(es) not exist.
 OPTIONAL OUTPUT:
   COUNT     Number of occurances of the given search spec.
 EXAMPLE:
   if exist('tmp.tmp') then print,'Yes' else print,'No'
   if not exist('tmp.tmp') then print,'Create'
   if exist('*.hhh',count) then print,strn(count),' Header files available'
 HISTORY:
   27-JUL-1992 Header added to old routine  (E. Deutsch)
		

(See /host/bluemoon/usr2/idllib/sdss/allpro/exist.pro)


EXTRACT_GALAXIES

[Previous Routine] [Next Routine] [List of Routines]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 NAME: 
    EXTRACT_GALAXIES

 PURPOSE:
     Extracts a clean set of galaxies
 
 Inputs:  pstruct: input photo structure 
	   color_index: bandpass to select on:
          ostruct: output photo structure containing galaxies
          max_mag: maximum magnitude to use (default=24.0)
          no_objc_type:  don't use the photo objc_type to pick galaxies
	   silent: don't make plots

 Outputs: Plots flags for these objects....
	   indices: returns the indices of the galaxies in the original
			struct

 Author:  Phil Fischer
 Date: 1/14/99
 Altered to get galaxies: Erin Scott Sheldon
 Date: 2/19/99
 Added silent and indices options: Tim McKay
 Date: 6/10/99

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Help message
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(See /host/bluemoon/usr2/idllib/sdss/allpro/extract_galaxies.pro)


EXTRACT_STARS

[Previous Routine] [Next Routine] [List of Routines]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 NAME: 

    EXTRACT_STARS

 PURPOSE:
     Extracts a clean set of stars suitable for PSF determination
 
 Inputs:  pstruct: input photo structure 
	   clr: bandpass to select on:
          ostruct: output photo structure containing stars
          max_mag: maximum magnitude to use (default=20)
          indices: the indices of the stars.
	   sig_clip: Number of sigma for clipping large radius objects (default=3)
 Outputs: Plots flags for these objects....

 Author:  Phil Fischer
 Date: 1/14/99

 Modified: Tim McKay
 Date: 4/22/99  Changed the move flag cut to the objc level
		 Fixed indirection of the indices option

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Help message
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(See /host/bluemoon/usr2/idllib/sdss/allpro/extract_stars.pro)


FCHART

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
    FCHART
       
 PURPOSE: 

    Create a finding chart for the object in index.
	
 CALLING SEQUENCE: 

    fchart, pstruct, index, radius, clr, fchart, dir=dir, 
            silent=silent, objx=objx, objy=objy, nonoise=nonoise

 COMMENTS:  The wrapper obj_info is a very convenient way to use FCHART
            since it makes a nice display.

 INPUTS: 
    
    pstruct:  A photo structure.
              IMPORTANT NOTE: This MUST have objc_rowc as a continuously added
              added number, not restarted at the beginning of each frame.
              Such boundaries are artificial and make it difficult to make 
              finding charts centered on the object.  

              This is done automatically by READ_TSOBJ
    index:    The index of the object in the photo structure which needs
              a finding chart.
    radius:   The box which the object is in will have sides 2*radius
              unless radius is too big. (e.g. bigger that 2048 pixels)
    clr:      The color used to make the finding chart. This follows the
              photo convention: 0,1,2,3,4 -> u,g,r,i,z

 INPUT KEYWORD PARAMETERS:
         dir:  The directory to find the atlas images.
         clr:  The color used to make the finding chart. This follows the
               photo convention: 0,1,2,3,4 -> u,g,r,i,z
         silent: If silent is set, nothing is printed except some errors
         nonoise: if set, no noise is added to image.
         maxsize: maximum size for atlas images. Default is [500,500].  If 
               your images are clipped off (as with large galaxies) increase
               maxsize.
         
 OUTPUTS: 

    fchart:  The image of the finding chart. 

 OPTIONAL OUTPUTS: 
    objx: The x-position of the input object in pixels in image
               coordinates (as opposed to photo objc_rowc, etc)
    objy: Same for y.
    impos: Absolute position of left hand corner of image.

 CALLED ROUTINES: 

    GET_FAMILY
    GET_ATLAS
 
 PROCEDURE: 
  Create a finding chart around an input object from all the objects nearby.
  The trick is to only use the complete images, not the ones with pieces
  cut out of them.  This program uses the get_family procedure to figure
  out which are the good ones:

    orphans:  Those objects with no siblings or parents.
    child of a bad parent: A bad parent will have one child which is 
             a fainter version of itself.
    good parents: The clean parent image. (from which good children 
             are made)
    grandparents: Sometimes there is a grandparent, from which comes
             only one child.  This child has children of its own.
	
  From here, the atlas image  of each good neighbor is the proper color is 
  found and placed within the appropriate box.  
  Note this box may not center on the main object if it is less that 'radius'
  from either the edge of the frame in the column direction. This is also, 
  true if it is near either end of the series of frames read into pstruct.


 REVISION HISTORY: 
     Author  Erin Scott Sheldon UM 03/21/99
     Dave Johnston - was adding way too much noise
        to background in some cases , now it just adds a 
        trace amount of noise to background 
        sky rms sqrt(30)  5/15/99	
     Now allows objects with center outside image to 
     contribute light to the image. Object centers must
     be within maxsize/2.  14-NOV-2000
       
                                      

(See /host/bluemoon/usr2/idllib/sdss/allpro/fchart.pro)


FCHART_CIRC_RADEC

[Previous Routine] [Next Routine] [List of Routines]

 NAME: 
    FCHART_CIRC_RADEC
       
 PURPOSE: 
    Build a finding chart and (unless requested otherwise ) circle positions 
    in ra and dec arrays.
	

 CALLING SEQUENCE: 
    fchart_circ_radec, photostr, ra, dec, fchart, 
                      clr=clr, radius=radius, tol=tol,
                      maxsize=maxsize,  
                      nonoise=nonoise, 
                      nocirc=nocirc, 
                      circ_rad = circ_rad, 
                      circ_obj=circ_obj, 
                      nodisplay=nodisplay, psfile=psfile, 
                      silent=silent,
                      objx=objx, objy=objy, photoid=photoid, _extra=extra

 INPUTS: photostr:  A photo structure.  Must contain RUN and CAMCOL tags to
             find atlas directory (calls fetch_dir) Also must contain RA and
             DEC so that CIRC_RADEC can make a good mapping from row,col to
             ra and dec
         ra, dec:   The arrays of ra and dec positions to be circled.  Finding
             chart is made for object in photostr that most closely matches
             the _first_ ra and dec in list.  Note, if you set /nocirc, none
             of the objects in the list will be circled.

 OPTIONAL INPUTS:
         maxsize: maximum size for atlas images; sent to atlas images.  If 
                 your images are being clipped off, you should increase
                 maxsize. default = [500,500]
         clr:       Color to make finding chart.  [0,1,2,3,4]->[u,g,r,i,z]
                 default is clr=2
         radius:    Optional input.  Radius to make finding chart in pixels.
         tol:       Optional input tolerance (in arcsec) used to find nearest 
                    object to ra dec. This should be large to gaurantee it 
                    will find and object.  Default is 500 arcsec. Will search 
                    on first ra dec in list. 
         cird_rad:  array of radii used to make circle around objects in 
                    the list.  Default is size of finding chart/10.0 and 
                    consecutively smaller for each in list.
         circ_obj: If set, circle the object used to make finding chart.
         psfile:    Name of psfile in which to plot.
         photoid:   Can input photoid to make fchart from, else it will find
                    nearest match in ra,dec. If not input, can
                    be returned with this keyword. See below.
         _extra:    Extra plotting options.

 KEYWORD PARAMETERS:
         nonoise: keyword sent to fchart.  Set for no noise added to fchart.
         nodisplay:  If set, won't display the image.
         silent:   Shut off messages except errors.
         nocirc: If set, no circling is done.

 OPTIONAL OUTPUTS:
         fchart:  Return the image.
         objx, objy:  The position of object used to make finding chart.
         photoid:   If not input, returns id used to make finding chart

 CALLED ROUTINES:
                  (CLOSE_MATCH_RADEC)
                  FCHART
                  (DISPLAY_FCHART)
                  (CIRC_RADEC)
                  FETCH_DIR
                  (FETCH_RERUN)
 
 PROCEDURE: 
   if not input in photoid, match first ra and dec in structure to 
   the photostr.  Then make a finding chart and circle all the ra and dec.
	

 REVISION HISTORY:
	Author: Erin Scott Sheldon Umich 5/25/99
       
                                      

(See /host/bluemoon/usr2/idllib/sdss/allpro/fchart_circ_radec.pro)


FETCH_DIR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    FETCH_DIR

 PURPOSE:
    given run camcol and rerun it will retrun
    the directory dir on fsgi03 where this tsObj file lives
    and the directory atldir where the atlas images live
    if given the field it will output the tsObj file as well
    and the atlas file

 CALLING SEQUENCE:
   fetch_dir, run, camcol, rerun [, dir, atldir, file, atlfile,
              field=field, check=check, corrdir=corrdir]

 INPUTS:
    run, camcol, rerun: in integer form
 
 OUTPUTS:
    none

 OPTIONAL INPUTS:
    field: An integer field number.  If input, file and atlfile (tsObj and
           fpAtlas) file names can be returned
    check: If /check, then will make sure directory exists.

 OPTIONAL OUTPUTS:
    dir, atldir: the tsObj directory and fpAtlas directory (objcs)
    file, atlfile: filenames for input field number
    corrdir: the directory holding corrected shape files. Requires
       system variable !SDSS_SHAPECORR_DIR in SDSSIDL_SETUP.PRO
    corratldir:  ''

 NOTES 
    1) Variables !SDSS_DATA_DIR and !SDSS_SHAPECORR_DIR are set in
       sdssidl_setup.  You must have that procedure to run this one.
    2) If /check is set and a file or directory is not found, then
       it is set to ''

 EXAMPLE:
    IDL> fetch_dir,259,5,1,200,dir,file,field=203
    IDL> print,dir
    /usr/sdss/data01/imaging/259/1/calibChunks/5
    IDL> print,file
    /usr/sdss/data01/imaging/259/1/calibChunks/5/tsObj-000259-5-1-0203.fit

(See /host/bluemoon/usr2/idllib/sdss/allpro/fetch_dir.pro)


FETCH_FILE_LIST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 	fetch_file_list	

 PURPOSE:
	for use with read_tsObj
	will return the list of tsObj files in directory dir 
	(the new field-seperarted tsObj files) between start and start+nframe
       Can also have a front other than tsObj if so desired, but
       must have form front-run-camcol-rerun-field.extension

 CALLING SEQUENCE:
	fetch_file_list,dir, files, fnums [, start=start, nframes=nframes,
                    run=run, camcol=camcol, rerun=rerun,  
                    fieldmin=fieldmin, fieldmax=fieldmax, 
                    front=front, nchar=nchar]

 INPUTS:
	dir:  the full directory where the tsObj files live.
         Must be of the form: "..../run/rerun/calibChunks/camcol/" or
         fetch_file_list will fail.

 OPTIONAL INPUTS:
       start: the first field to consider (default is first)
	nframes: the total number of files to fetch (default is max possible)
       front:  The front string in the files.  Default is "tsObj"
       nchar:  The number of characters in the name.  
               Default is 25 for tsObj files.

 OUTPUTS:
	files: a string array of the file names (full path)
	fnums: a "long" array of the field numbers	
       run: the run 
	camcol: the camera collumn
	rerun: the rerun number
		(presumably you had to have known these three
		variables to get the directory 
		but you may not have had them handy
		so are output if you need them)

       fieldmin, fieldmax: first and last field numbers

 EXTERNAL CALLS:
      	none 
 METHOD:
	uses find_file function   
 EXAMPLE
	IDL> fetch_dir,run,camcol,rerun,dir
	IDL> fetch_file_list,dir,files,start=13,nf=20
	IDL> help,files   
   	FILES           STRING    = Array[100]
	IDL> print,files(0)
	/usr/sdss/data02/imaging/273/1/calibChunks/2/tsObj-000273-2-1-0011.fit


 NOTES

 HISTORY:  written by David Johnston -University of Chicago
       Physics Department October 9 1999
       11/13/99  Added "front" and "nchar" inputs  Erin Scott Sheldon
       2/20/2000 made start, nframes optional. defaults set.  E.S.S.
       Now requires strict directory format. Gets run/camcol/rerun from
       directory name. Checks for files with those numbers. 13-Nov-2000 E.S.S.

(See /host/bluemoon/usr2/idllib/sdss/allpro/fetch_file_list.pro)


FETCH_RERUN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    FETCH_RERUN

 PURPOSE:
    will get the newest rerun that exists on disk for run "run"
    does this by CD-ing to the directory from 
    '/usr/sdss/data01/imaging/'+string(run)+'/calibChunks/'
    this directory is symbolically linked to the newest rerun 
    directory. Then just spawn a pwd and look at the 
    directory name

 CALLING SEQUENCE:
    fetch_rerun, run, rerun

 INPUTS:
    run: the run in integer/long form.

 OUTPUTS:
    rerun: the rerun in integer form.

    NOTES: 1) Need !SDSS_DATA_DIR to be defined (see SDSSIDL_SETUP.PRO)
           2) If run directory does not exist, then -1 is returned.

(See /host/bluemoon/usr2/idllib/sdss/allpro/fetch_rerun.pro)


FIELD2STRING

[Previous Routine] [Next Routine] [List of Routines]

 NAME: 
    FIELD2STRING
       
 PURPOSE: 
    Function outputs a string containing field of a photo tsObj 
    file in the correct format.
	

 CALLING SEQUENCE: 
    result = field2string(field)
      
 INPUTS: 
    field
       
 OUTPUTS: 
    field string or '' if error.
 
 PROCEDURE: 
      field should have 4 characters padded with zero's if its
      not big enough.  e.g. if input 33, output is '0033'
	
 REVISION HISTORY:
     Author: Erin Scott Sheldon  Umich 5/25/99
                                      

(See /host/bluemoon/usr2/idllib/sdss/allpro/field2string.pro)


FINDABTHETA

[Previous Routine] [Next Routine] [List of Routines]

 NAME: 
    FINDABTHETA
       
 PURPOSE: 
    find the axis ratio and position angle of an object with
          e1 and e2 as ellipticity parameters.  Currently only
          works for unweighted or adaptively weighted moments.
	

 CALLING SEQUENCE: 
    findabtheta, e1, e2, aratio, posangle, verbose=verbose
      
                 

 INPUTS: 
    e1, e2: ellipticity parameters.

 INPUT KEYWORD PARAMETERS: 
         /verbose: print the output e1 and e2
         /lupton: if this is set, then use formulae for q and u

       
 OUTPUTS: 
    aratio: axis ratio
    posangle: position angle from the x-axis.

 PROCEDURE: 
	
	

 REVISION HISTORY:
	Author: Erin Scott Sheldon    UofM  5/??/99  
       
                                      

(See /host/bluemoon/usr2/idllib/sdss/allpro/findabtheta.pro)


FINDE

[Previous Routine] [Next Routine] [List of Routines]

 NAME: 
    finde
       
 PURPOSE: 
    Find the e1 and  for a perfectly elliptal object with the 
          given axis ratio.  e1_ad and e2_ad are for unweighted or adaptively
          weighted moments.  e1_lup and e2_lup are Robert Luptons q and u
          which are in SDSS PHOTO catalogs.
	

 CALLING SEQUENCE:
    
     finde, aratio, posangle, e1_ad, e2_ad, e1_lup, e2_lup, silent=silent
      
 INPUTS: 
    aratio:  The axis ratio of the object.
    posangle: The positon angle from the x-axis.

 INPUT KEYWORD PARAMETERS:
         /verbose: Print out the result.
       
 OUTPUTS: 
    e1_ad, e2_ad:  Ellipticity parameters in unweighted for adaptively
                   weighted moments.

 OPTIONAL OUTPUTS: 
    e1_lup, e2_lup:  q and u from PHOTO catalog.


 REVISION HISTORY:
	
   Author: Erin Scott Sheldon   U of M  5/25/99 
       
                                      

(See /host/bluemoon/usr2/idllib/sdss/allpro/finde.pro)


FIND_RADEC

[Previous Routine] [Next Routine] [List of Routines]

 NAME:
       FIND_RADEC
       
 PURPOSE:
	Find the run, camcol and field that contain the input ra and dec.
       More than one run may be returned if ra,dec is in overlap region
       between the runs.
 
 CALLING SEQUENCE:
       find_radec, ra, dec [, run, camcol, field, 
                   runstr=runstr, colstr=colstr, fstr=fstr, 
                   silent=silent]
                 
 INPUTS: 
       ra, dec: The positions in degrees.

 KEYWORD PARAMETERS:
       /silent: don't print run, camcol, field
       
 OUTPUTS: 
       run, camcol, field

 OPTIONAL OUTPUTS:
       runstr=runstr: run string with standard padded zeros
       colstr=colstr: column string
       fstr=fstr: field string with standard padded zeros.
       

 CALLED ROUTINES:
 
       EQ2SURVEY
       ETA2STRIPENUM
       (SDSSIDL_SETUP)
       MATCH
       MRDFITS
       DELVARX
       ADD_ARRVAL
       NTOSTR


 PROCEDURE: 
	Must have !RADEC_SEARCH_DIR and !SEARCH_RUNS, and !RUN_STATUS defined in
       SDSSIDL_SETUP.PRO  The directory contains the files created
       by FIELD_RANGE.PRO, which finds the lambda-eta range of each field.
       !SEARCH_RUNS is all the runs which have been run through FIELD_RANGE.
       These files contain structures for each field with the following
       tags: field, etamin, etamax, lambdamin, lambdamax. Assumes that
       fields are approximately square in lambda-eta.
       !RUN_STATUS has all the runs we know about on the current machine.

 REVISION HISTORY:
	Author: Erin Scott Sheldon  UofMich 10/15/99 
       Converged to survey coords. 9-OCT-2000 E.S.S.
                                      

(See /host/bluemoon/usr2/idllib/sdss/allpro/find_radec.pro)


FIND_RADEC_FCHART

[Previous Routine] [Next Routine] [List of Routines]

 NAME:
       FIND_RADEC_FCHART

 PURPOSE:
	Create a finding chart for the input coordinates.

 CALLING SEQUENCE:
       find_radec_fchart, ra, dec [, fchart, pstruct, 
                      clr=clr, radius=radius, maxsize=maxsize, tol=tol,
                      atldir=atldir,  
                      nonoise=nonoise,
                      nocirc=nocirc, 
                      circra=circra, circdec=circdec, 
                      nodisplay=nodisplay, psfile=psfile, 
                      usesao=usesao, silent=silent, 
                      photoid=photoid, objx=objx, objy=objy, 
                      _extra=extra ]

 INPUTS: 
       ra, dec:   position of interest in degrees.

 OPTIONAL INPUTS:
       clr:       bandpass of images from which to create finding chart.
                  Must be an integer [r,g,u,i,z] -> [0,1,2,3,4]
                  Default is red (2)
       radius:    Half length of the square finding chart in pixels.
       maxsize:   maximum size for atlas images; sent to atlas images.  If 
                  your images are being clipped off, you should increase
                  maxsize. default = [500,500]
       tol:       Tolerance for finding nearby object in arcseconds.  
                  Default is 100.
       circra, circdec:  Other positions to circle besides ra,dec
       runuse: find_radec may return more than one run. Set this value
            to an integer to choose which run.
       _extra:    Extra plotting keywords.

 KEYWORD PARAMETERS:
       nonoise:   Set for no noise in fchart.
       usesao:    Use sao to plot image.
         
 OPTIONAL OUTPUTS: 
       pstruct:   A photo structure containing all objects in the frame 
                  of ra,dec as well as the two frames before and after (if 
                  its the first or last frame then it uses next two or 
                  previous two.
       fchart:    The finding chart
       photoid:     Returns Id of nearest object.
       altdir: atlas directory

 CALLED ROUTINES:

       FIND_RADEC 
       TSOBJ_NAME
            RUN_DIR
       READ_PHOTO_COL
       FCHART_CIRC_RADEC
            CIRC_RADEC
       (SAO)

 PROCEDURE: 
	
	Use find_radec to get the run, camcol, and field of an object that
       is nearby to ra,dec and then read in the nearby objects.  Then create 
       a finding chart and circle the ra,dec postion.

 REVISION HISTORY:
	Author: Erin Scott Sheldon  UofMich 10/15/99  
       
                                      

(See /host/bluemoon/usr2/idllib/sdss/allpro/find_radec_fchart.pro)


FLAG_SELECT

[Previous Routine] [Next Routine] [List of Routines]

 NAME:
    FLAG_SELECT
 PURPOSE:
    Makes cuts based on flag structure. These cuts are strictly "anded" 
    together, so they must all be true for the object to survive.
 
 Inputs:  pstruct: a photo output structure (must have .flags tag...)
	   flag_struct: Premade flag structure. This will require any
		flags set to 'Y' and insist that any flag set to 'N' be
		off
	   colorindex: which color do you want to cut on...
	   objc: set if you want to select on objc flags
	   input_index: you can input an index, from an earlier selection
		for instance. If this has size(input_index)(0)=0 then
		the returned selection index will be -1

 Outputs: select_index: indices of selected objects....

 Author:  Tim McKay
 Date: 1/8/99
 Phil Fischer: 1/15/99
 Erin Scott Sheldon UM 2/5/00 Added flags2

(See /host/bluemoon/usr2/idllib/sdss/allpro/flag_select.pro)


FXPOSIT2

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FXPOSIT2
 PURPOSE:
	Return the unit number of a file positioned to the beginning
       of a particular extension.

 CALLING SEQUENCE:
	unit=FXPOSIT(FILE, EXT_NO, /READONLY)

 INPUT PARAMETERS:
	FILE	= FITS file name, scalar string
       EXT_NO  = Extension to be moved to, scalar nonnegative integer

 RETURNS:
       Unit number of file or -1 if an error is detected.

 OPTIONAL KEYWORD PARAMETER:
	READONLY - If this keyword is set and non-zero, then OPENR rather 
		than OPENU will be used to open the FITS file.

 COMMON BLOCKS:
	None.
 SIDE EFFECTS:
	Opens and returns the descriptor of a file.
 PROCEDURE:
	Each FITS header is read in and parsed, and the file pointer is moved
	to where the next FITS extension header until the desired
       extension is reached.
 PROCEDURE CALLS:
	FXPAR(), MRD_HREAD, MRD_SKIP
 MODIFICATION HISTORY:
	Derived from William Thompson's FXFINDEND routine.
       Modified by T.McGlynn, 5-October-1994.
	Modified by T.McGlynn, 25-Feb-1995 to handle compressed
          files.  Pipes cannot be accessed using FXHREAD so
          MRD_HREAD was written.
	W. Landsman 23-Apr-1997    Force the /bin/sh shell when uncompressing 
	W. Landsman 26-May-1997    Non-unix is not just VMS
	Converted to IDL V5.0   W. Landsman   September 1997

(See /host/bluemoon/usr2/idllib/sdss/allpro/fxposit2.pro)


GC2EQ

[Previous Routine] [Next Routine] [List of Routines]

 NAME:
    GC2EQ
       
 PURPOSE:
    convert from great circle to equatorial coordinates

 CALLING SEQUENCE:
    gc2eq, mu, nu, node, inc, ra, dec

 INPUTS: 
    mu, nu: great circle coords.
    node, inc: node and inclination of the stripe.
       
 OUTPUTS: