This page was created by the IDL library routine
make_html_help. For more information on
this routine, refer to the IDL Online Help Navigator
or type:
? make_html_help
at the IDL command line prompt.
Last modified: Thu Apr 10 13:43:10 2008.
NAME:
ADD_ARRVAL
PURPOSE:
Add an element to an 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.
REVISION HISTORY:
14-NOV-2000 Erin Scott Sheldon UofMich
(See pro/util//add_arrval.pro)
NAME:
ADD_LABELS
PURPOSE:
Add labels to an axis. Ticks are not added, so it is recommended
to only label existing ticks.
CALLING SEQUENCE:
add_labels, xtickv=xtickv, ytickv=ytickv, xaxis=xaxis, yaxis=yaxis
OPTIONAL INPUTS:
xtickv=xtickv: the x-values to label. See plotting keywords in idl online help.
ytickv=ytickv: the y-values to label.
ztickv=ztickv: the y-values to label.
xaxis=xaxix: which x-axis? See plotting keywords in idl online help.
yaxis=yaxis: which y-axis?
zaxis=zaxis: which z-axis?
KEYWORD PARAMETERS:
NONE
OUTPUTS:
Plots labels on current device.
OPTIONAL OUTPUTS:
NONE
CALLED ROUTINES:
AXIS
PROCEDURE:
run AXIS procedure, sending [XYZ]tickv and [XYZ]ticks keywords
REVISION HISTORY:
Creation:
7-FEB-2002, Erin Scott Sheldon UofMIch
(See pro/plotting//add_labels.pro)
NAME:
add_title
PURPOSE:
Add a title to a plot. Designed to create a single title for an
axis even when multiple plot regions are in use (e.g. with !p.multi
settings).
CATEGORY:
Plotting
CALLING SEQUENCE:
add_title, type, text, offset=, _extra=
INPUTS:
type: Title type. Currently supported:
'title','xtitle','ytitle'
KEYWORD PARAMETERS:
offset=: Offset of the text with respect to the default position.
_extra=: Extra plotting keywords
EXAMPLE:
!p.multi = [0,2,2]
.... bunch of plots....
add_title, 'ytitle', 'Rest Frame g-r'
MODIFICATION HISTORY:
Created from code in MPLOT.pro 2007-01-04, Erin Sheldon, NYU
(See pro/plotting//add_title.pro)
NAME:
aeta_lambda
PURPOSE:
Calculate the conformal time to redshift z in a flat universe given omegam.
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:
aeta = aeta_lambda(z, omegamat)
MODIFICATION HISTORY
Author: Erin Sheldon, UChicago
First documented, 1-August-2005.
(See pro/astro//aeta_lambda.pro)
NAME:
ALTER_TAGS()
PURPOSE:
Alter the tag definitions in a structure. A second structure is input and
tags from that structure that match the original struct are altered to the
new data type. The original struct is copied into the new using the
struct_assign builtin procedure with the /nozero option. Thus if the
data type is compatible with the old one, the type is converted and
copied in, otherwise they are left as defined.
CALLING SEQUENCE:
newstruct = alter_tags(struct, defstruct)
INPUTS:
struct: The original structure. May be an array.
defstruct: A struct defining the tags.
OUTPUTS:
A new structure with tags altered.
EXAMPLE:
; Convert a tag from int to float.
struct = {a:35, b:66}
newstruct = alter_tags(struct, {a:0.0})
print,newstruct.a
35.0000
MODIFICATION HISTORY:
Early 2006: Erin Sheldon, NYU
(See pro/struct//alter_tags.pro)
NAME:
ANGDIST
PURPOSE:
Calculate angular diameter distance between zmin and zmax in a lambda cosmology
CALLING SEQUENCE:
result = angdist(zmin, zmax, omega_m=, omega_l=, omega_k=, flat=, h=, npts=, Dl=)
INPUTS:
zmin, zmax: The min and max redshifts
OPTIONAL INPUTS:
omega_m, omega_l, omega_k: The omegas. Defaults (0.27, 0.73, 0.0)
flat: Default is 1 (true)
h: Default 1.0
npts: # points for Ez integration, default 5 good to 1.e-7
OUTPUTS:
Distance in MPC/h
REVISION HISTORY:
Author: Erin Scott Sheldon 2/24/99
Converted to lambda cosmology with full integration. Uses cosmology IDL class.
2007-04-28, Erin Sheldon, NYU
(See pro/astro//angdist.pro)
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 pro/astro//angdist_lambda.pro)
NAME:
APPLY_PIXEL_MASK
PURPOSE:
Test input clambda,ceta points against Ryan Scranton's SDSSPix masks. Calls
a version of Ryan's mask code, linked into IDL via a Dynamically Loadable
Module (DLM). Additional C modules were added to Ryan's code to check for
edges and holes.
CATEGORY:
SDSS specific routine.
CALLING SEQUENCE:
apply_pixel_mask, clambda, ceta, masked, unmasked, maskflags,
maskfile=, $
/basic, /simple, $
/bound, /combined, $
$
maxangle=, $
/twoquad, status=
INPUTS:
clambda, ceta: SDSS survey coordinates (corrected) to be tested against the
mask. These can be arrays. Use eq2csurvey to convert ra/dec
to clambda, ceta
OPTIONAL INPUTS:
maskFile=: Which mask file to use. The default is to use the "basic" masked
defined in the config file (see also keyword parameters).
maxAngle=: The maximum angle around each object. When this is given, then
edges will be checked for within this radius.
KEYWORD PARAMETERS:
FOR MASK EXPLANATION, see below
/basic: Use the "basic" mask defined in the config file.
/simple: Use the "simple" mask defined in the config file.
/bound: Use the "bound" mask.
/combined: Use the "combined" mask.
/twoquad: When the maxAngle are sent and and /twoquad is set, objects pass
the mask if two adjacent quadrants are unmasked.
OUTPUTS:
masked: Indices of points in the input list were masked out.
unmasked: Indices of points in the input list were not masked.
maskflags: The mask flags for each object.
FLAGS_MASKED = '1'X ; Central point masked, or quadrants masked
FLAGS_QUAD1_MASKED = '2'X ; Quadrant masked in simple test
FLAGS_QUAD2_MASKED = '4'X
FLAGS_QUAD3_MASKED = '8'X
FLAGS_QUAD4_MASKED = '10'X
FLAGS_QUAD1_MASKED_MONTE = '20'X ; Quadrant masked in monte-carlo test
FLAGS_QUAD2_MASKED_MONTE = '40'X
FLAGS_QUAD3_MASKED_MONTE = '80'X
FLAGS_QUAD4_MASKED_MONTE = '100'X
See PIXEL_MASKFLAGS_SELECT.PRO for examples of how to use these flags.
MASK EXPLANATION:
"_basic": This mask contains the rough geometry for the current data set.
It delineates the ends of the data in each stripe as well as any
gaps in the middle of stripes where data is missing from one or
both strips.
"_simple": The first level of additional complexity. This mask includes all
of the pixels in the "_basic" mask as well as smaller masks to
block out small areas lost to missing fields in otherwise
continuous data. As with the masks in "_basic", these masks are
all made by hand. In the dr3 implementation, this mask blocked
out an additional 17 square degrees compared to the area masked
in the "_basic" mask.
"_bound": The next level in complexity. This contains all of the pixels in
"_simple" as well as masks to remove areas around bright stars.
These bright star masks are the first ones included which are not
made by hand. In the dr3 implementation, this mask blocked out an
additional 100 square degrees compared to the area masked in the
"_simple" mask.
"_combined": The final level of complexity. This contains all of the pixels
in "_bound" as well as pixels removing areas where systematic
errors are likely to contaminate data. In the dr3
implementation,, 0 < reddening < 0.2, 0.85 < seeing < 1.4) ,
this mask blocked out an additional 1210 square degrees
compared to the area masked in the "_bound" mask.
RESTRICTIONS:
You must have compiled the code. See the README file in the base directory
of the SDSSIDL distribution.
EXAMPLE:
apply_pixel_mask, clambda, ceta, masked, unmasked, maskflags, /combined
MODIFICATION HISTORY:
Created: Erin Sheldon, UChicago, some time in 2003
Converted from call_external to DLM: E.S. Nov-2004
(See pro/sdsspix//apply_pixel_mask.pro)
NAME:
APPLY_SPHPOLY_MASK
PURPOSE:
Call sphpoly_completeness to get the completenss for a set of ra/dec points,
then return indices of those which pass the completeness cut.
CATEGORY:
SDSS routine.
CALLING SEQUENCE:
apply_sphpoly_mask, ra, dec, masked, unmasked,
/lameta,
maskfile=,
completeness=,
compcut=,
poly_id=,
poly_area=,
/silent=
INPUTS:
ra/dec: Scalar or arrays of points in double precision.
OPTIONAL INPUTS:
maskFile=: The mask file to use. Default is the sphpoly_mask_file entry in
config file.
compcut=: The completeness cut to use, default is > 0.0
KEYWORD PARAMETERS:
/lameta: The inputs are clambda/ceta instead of ra/dec
/silent: Don't print stuff
OUTPUTS:
masked, unmasked: indices of masked and unmasked objects.
OPTIONAL OUTPUTS:
poly_id: The polygon id for each object
poly_area: The polygon area for each object.
RESTRICTIONS:
You must have compiled the code. See the README file in the base directory
of the SDSSIDL distribution.
MODIFICATION HISTORY:
Created Erin Sheldon, UChicago, some time in 2003
(See pro/spherical_polygons//apply_sphpoly_mask.pro)
NAME: ARRAY_INTERSECT() PURPOSE: Pick the common elements from two arrays. Duplicates are removed. The type of the returned array is that of array1. CALLING SEQUENCE: intersection = array_intersect(array1, array2 [, nkeep]) INPUTS: array1, array2 OUTPUTS: intersection: The elements common to both arrays, with the type of array1. nkeep: number kept. MODIFICATION HISTORY: 30-Sept-2005, Created, Erin Sheldon, NYU
(See pro/util//array_intersect.pro)
NAME: ARRAY_UNION() PURPOSE: Return the union of elements in two arrays. Duplicates are removed. The type of the returned array is that of array1. CALLING SEQUENCE: union = array_union(array1, array2 [, nkeep]) INPUTS: array1, array2 OUTPUTS: union: All unique values from both arrays. nkeep: number kept. MODIFICATION HISTORY: 30-Sept-2005, Created, Erin Sheldon, NYU
(See pro/util//array_union.pro)
NAME:
ARRSCL
PURPOSE:
Rescale the range of an array.
CALLING SEQUENCE:
result = arrscl(arr, min, max, arrmin=, 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
OUTPUTS:
The rescaled array.
REVISION HISTORY:
Author: Erin Scott Sheldon UofMich 10/18/99
(See pro/util//arrscl.pro)
NAME:
BAYES_EVAL_POLY2D
PURPOSE:
Util for bayes_prob.pro
MODIFICATION HISTORY:
Creation: ??-??-?? Dave Johnston, UofChicago
Current version: 1.5
(See pro/probgal//bayes_eval_poly2d.pro)
NAME:
BAYES_PARS
PURPOSE:
Util for bayes_prob.pro
MODIFICATION HISTORY:
Creation: ??-??-?? Dave Johnston, UofChicago
Current version: 1.5
(See pro/probgal//bayes_pars.pro)
NAME:
BAYES_PROB
PURPOSE:
Calculate bayesian probabilities for an object being a galaxy
CALLING SEQUENCE:
bayes_prob, cat, probflags, probgal, rat, ls, lg, c, see, mag
MODIFICATION HISTORY:
Creation: ??-??-?? Dave Johnston, UofChicago
Current version: 1.5
(See pro/probgal//bayes_prob.pro)
NAME:
BAYES_PROB_NC
PURPOSE:
Util for bayes_prob.pro Create p from prob using number counts,m
MODIFICATION HISTORY:
Creation: ??-??-?? Dave Johnston, UofChicago
Current version: 1.5
(See pro/probgal//bayes_prob_nc.pro)
NAME:
BAYES_SET_COMMON
PURPOSE:
Set the common block used by the bayesian s/g routines
CATEGORY:
SDSS specific routine.
CALLING SEQUENCE:
bayes_set_common
MODIFICATION HISTORY:
??-??-2004 Ryan Scranton
Current version: 1.5
(See pro/probgal//bayes_set_common.pro)
NAME:
BEGPLOT
PURPOSE:
Redirect plotting to the 'PS' device. See also ENDPLOT.
CATEGORY:
Misc.
CALLING SEQUENCE:
BEGPLOT, plotfile, ...keywords
INPUTS:
None.
KEYWORD PARAMETERS:
These keywords are applicable to all graphics/display devices.
LAYOUT: Name of file containing keywords. See example below.
Note, pslayout is run automatically to set defaults.
DEVICE: Name of graphics device.
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 an Encapsulated PostScript (EPS) file
and inhibit printing:
BEGPLOT,'test.eps',/ENCAPSUATED
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.
Major rewrite. Use !pslayout system variable. Added parameters
to layout. Run setupplot if necessary.
3-Jul-2002 Erin S. Sheldon UofMich
No longer support printing; just out to file. E.S.S.
(See pro/plotting//begplot.pro)
NAME:
BINARY_SEARCH
CALLING SEQUENCE:
binary_search,arr,x,index [, /round ]
PURPOSE:
Perform a binary search on arr, an input array, for the closest match
to x.
Will give closest element of arr that is _smaller_ than x. Set /round to
gaurantee you get the closest overall element. -E.S.S.
Set /edgedefault to use endpoint if input x is gr arr[n-1] or x is lt arr[0]
-E.S.S.
Modification History
Author: Dave Johnston.
Added round keyword 04/29/00 Erin Scott Sheldon UofMich
Added edgedefault keyword 07-Mar-2001
(See pro/util//binary_search.pro)
NAME:
binner
PURPOSE:
Generic binning routine. Bins 1- or 2-d data sets and supports weighted
histograms and binning into groups with N elements, as well as the usual
fixed binsize. For 1-d it generates histograms, returning info about bin
edges and centers and allowing weighted histograms. For 2-d the data are
binned by x and the y values are averaged in each bin using a specified
method. NOTE for 2-d, bins containing no objects are not returned in the
result. The result is a structure containing the relevant information.
CATEGORY:
statistics
CALLING SEQUENCE:
binstruct = binner(x [, y, (all histogram keywords), weights=, method=, nperbin=, reverse_indices=, /add_index)
INPUTS:
x: Array of data.
y (optional): Optional y data. If y is sent, the data are binned in x
and statistics are also returned for the y data in each bin. Note in
this case bins with zero members are not included in the result.
OPTIONAL KEYWORD INPUTS:
_extra: All the inputs which can be sent to histogram, such as binsize,
min, max, etc get passed through the _extra argument. These will be
used when appropriate for the requested method.
method: Allowed values depend on 1-d or 2-d.
For 1-d:
'full': Calculate more statistics for each bin. This requires using
reverse indices from histogram, which is slower and uses more
memory. These default to the center of the bin when no data
is present.
xmean: the mean position in the bin
xmedian: the median position in the bin.
'weighted': if sent, a weighted histogram "whist" is also returned.
Weights must also be sent, and in fact sending weights without
sending method implies method='weighted'. When weighted is sent, this also
implies 'full' as described above.
'standard': just run histogram and return bin stats. DEFAULT
For 2-d:
'mean': Calculate all stats using standard mean, variance, etc. DEFAULT
'median': Use the median instead of the mean.
'sigmaclip': Use sigma clipping to find the mean. nsig=3.5, niter=4
'weighted': Calculate weighted statistics. Weights must be sent, and
sending weights without sending method implies method='weighted'.
weights: Weight for each point. Will be used for weighted histogram and
weighted statistics in the 2-d case. Inclusion of this keyword implies
method='weighted' if that keyword is not sent.
nperbin: Bin such that there this many points per bin. If this keyword is not
sent then equal sized bins are used according to the histogram keywords.
OUTPUTS:
binstruct: A structure containing statistics for the requested binning.
1-d:
method: the method used, 'full', 'weighted', or 'standard'
xlow: lower side of bin
xcenter: center of bin
xhigh: right size of bin
hist: the histogram
if method is 'full' or 'weighted'
xmean: mean of data in bin
xmedian: median of data in bin
If weighted:
whist: the weighted histogram, sum of weights in each bin
2-d:
'method': method for calculating statistics
xmean: mean if x data in bin
ymean: mean if y data in bin, calculated using 'method'
yerr: error on mean in bin
ysdev: standard deviation in bin
hist: histogram of data in the bins
if method is 'weighted':
whist: the weighted histogram, sum of weights in each bin
OPTIONAL OUTPUTS:
reverse_indices: from histogram. Will always be available for 2-d data,
but for 1-d it will only be available when the 'full' or 'weighted'
methods are used.
index_array: An array of pointers each of which points to
an array of indices for objects in the bin. Only can be returned in
the same situations where reverse_indices is present
RESTRICTIONS:
Requires IDL 5.6 or later for the locations keyword to histogram. Only
a restriction for the 1-d case when not binning by number.
EXAMPLE:
1-d:
bs = binner(x, min=0.1, max=20)
pplot, bs.xcenter, bs.hist, psym=10
bs = binner(x, method='weighted', weights=wts)
pplot, bs.xcenter, bs.whist, psym=10
2-d:
bs = binner(x, y, method='median')
pplot, bs.xmean, bs.ymean, yerr=bs.yerr, psym=8
bs = binner(x, y, method='weighted', weights=wts)
pplot, bs.xmean, bs.ymean, yerr=bs.yerr, psym=8
MODIFICATION HISTORY:
Creation: Conglomerated from many programs. 2007-04-04 Erin Sheldon, NYU
(See pro/statistics//binner.pro)
NAME: BOLO_MAG PURPOSE: compute bolometric magnitude of g,r,i mag and zeropoint is (5,n) CATEGORY: sdss routine CALLING SEQUENCE: bolo_mag,mag,sn,zeropoint,bflux,bsn,bmag,see,seew MODIFICATION HISTORY: Creation: 19-Nov-2002, Dave Johnston, UofChicago
(See pro/sdss//bolo_mag.pro)
NAME:
bootstrap
PURPOSE:
Create bootstrap samples and calculate statistics for input variables.
The input data are up to 8 equal length arrays where each element
represents information about the same event or object. For example they
could be the flux in different wavelenghts of some astronomical object,
or parameters of an event in a detector.
CATEGORY:
Statistics.
CALLING SEQUENCE:
struct = bootstrap(nsample, v1, ..., v8, /verbose)
INPUTS:
nsample: Number of bootstrap samples to perform.
v1..v8: Up to 8 data arrays of equal length. The number of 8 comes
from the IDL limit of 8 dimensions in an array.
KEYWORD PARAMETERS:
/verbose: Report progress.
OUTPUTS:
struct: A structure containing the mean and standard deviation of the
bootstrap data. For 2-d input these are arrays with lenght the number
of variables. For 2-d the covariance between variables is also returned.
EXAMPLE:
bs = bootstrap(1000, x, y)
MODIFICATION HISTORY:
Documented: 2007-04-24, Erin Sheldon, NYU
(See pro/statistics//bootstrap.pro)
NAME:
boot_hist
PURPOSE:
Create a histogram with bootstrapped errors.
CATEGORY:
statistics
CALLING SEQUENCE:
binstruct = boot_hist(nsample, data, weights=, indarray=, /silent,
bhist=, wbhist=wbhist,
_extra=histogram keywords)
INPUTS:
nsample: Number of bootstrap samples to create.
data: An array of data.
OPTIONAL INPUTS:
weights: Weights for each point.
_extra: Keywords sent to histogram such as binsize, min, max, etc.
Keywords special to the binner() program are also accepted.
KEYWORD PARAMETERS:
/silent: Do not print progress reports.
OUTPUTS:
binstruct: A structure with bin info, incliding bin centers, histogram
optional weighted histogram, and errors from bootstrapping.
OPTIONAL OUTPUTS:
bhist: The histogram bootstrap samples used.
wbhist: The weighted histogram bootstrap samples used.
MODIFICATION HISTORY:
2007-04-24, Documented, Erin Sheldon, NYU
(See pro/statistics//boot_hist.pro)
NAME:
boot_indices
PURPOSE:
Returns random indices between 0 and imax-1 drawn with replacement for use in bootstrapping.
If only imax is sent, then imax randoms are returned in this range.
If the nsample argument is sent and is not 1 then a [nsample,imax]
array is returned.
CATEGORY:
statistics.
CALLING SEQUENCE:
ind = boot_indices(imax, nsample=)
INPUTS:
imax: Randoms are returned with values from 0 to imax-1. By default
the returned array is also this length.
OPTIONAL INPUTS:
nsample: If not 1 an [nsample,imax] array is returned.
OUTPUTS:
Random indices from 0 to imax-1 drawn with replacement.
MODIFICATION HISTORY:
2007-04-24 Documented, Erin Sheldon, NYU
(See pro/statistics//boot_indices.pro)
NAME:
boot_samples
PURPOSE:
Create bootstrap data for input variables. The input data are up to
8 equal length arrays where each element represents information about
the same event or object. For example they could be the flux in different
wavelenghts of some astronomical object, or parameters of an event in a
detector. The output is the mean of each bootstrap sample, for each input
variable, in an [nsample, nvar] array, or 1-d for nvar=1.
CATEGORY:
Statistics.
CALLING SEQUENCE:
samples = boot_samples(nsample, v1, ..., v8, /verbose)
INPUTS:
nsample: Number of bootstrap samples to perform.
v1..v8: Up to 8 data arrays of equal length. The number of 8 comes
from the IDL limit of 8 dimensions in an array.
KEYWORD PARAMETERS:
/verbose: Report progress.
OUTPUTS:
samples: The mean of each bootstrap sample in a [nsample, nvar] array.
The reform() program is run to reduce [nsample,1] arrays.
EXAMPLE:
bs = bootstrap(1000, x, y)
MODIFICATION HISTORY:
Documented: 2007-04-24, Erin Sheldon, NYU
(See pro/statistics//boot_samples.pro)
NAME:
boot_stats
PURPOSE:
Calculate the statistics (mean, sdev, covariance) for a set of bootstrap samples.
This program does not create bootstrap samples, see boot_indices() and
boot_samples() for that. The input data are a 1-d array of bootstrap samples
or a 2-d [nsample, nvar] array with the second dimension representing the value
of different variables for each bootstrap sample.
CATEGORY:
statistics
CALLING SEQUENCE:
struct = boot_stats(data)
INPUTS:
data: A 1-d or 2-d array of bootstrap data. For 1-d this is just all the
bootstrap data for a single variable. For 2-d input it must be of the
shape [nsample, nvar]
OUTPUTS:
struct: A structure containing the mean and standard deviation of the
bootstrap data. For 2-d input these are arrays with lenght the number
of variables. For 2-d the covariance between variables is also returned.
EXAMPLE:
; We have variables x and y measured for a given event.
; First create the averages of these for various bootstrap samples.
nsample = 100
bsamples = boot_samples(nsample, x, y)
bs = boot_stats(bsamples)
MODIFICATION HISTORY:
Documented: 2006-04-24, Erin Sheldon, NYU
(See pro/statistics//boot_stats.pro)
NAME:
casid2photoid
PURPOSE:
Convert a set of CAS ids (skyserver ids) to a photoids.
CATEGORY:
SDSS
CALLING SEQUENCE:
pid = casid2photoid(casid)
INPUTS:
casid: A scalar or array of CAS ids.
OUTPUTS:
photoid(s). See the program photoid.pro
OPTIONAL OUTPUTS:
sky_version, first_field. Extra info kept in CAS ids not
kept in photoids.
MODIFICATION HISTORY:
Created: 2007-04-03. Erin Sheldon, NYU
(See pro/sdss//casid2photoid.pro)
NAME:
CASID_EXTRACT
PURPOSE:
Extract run,rerun,camcol,field,id (and sky, first_field)
from a casid (long64) from the cas (skyserver) or as created
by the casid.pro program.
CATEGORY:
SDSS specific routine
CALLING SEQUENCE:
casid_extract, super, run, rerun, camcol, field, id,
sky_version=, first_field=
INPUTS:
super: A super id
OUTPUTS:
run,rerun,camcol,field,id
OPTIONAL OUTPUTS:
sky_version, first_field
EXAMPLE:
superid = casid(run,rerun,camcol,field,id)
casid_extract, superid, run, rerun, camcol, field, id
MODIFICATION HISTORY:
Created: ?/?/? Ryan Scranton
(See pro/sdss//casid_extract.pro)
NAME:
CETA2STRIPENUM
PURPOSE:
Find which stripe goes with this eta.
CALLING SEQUENCE:
stripe = ceta2stripenum(ceta, /allowfan)
INPUTS:
ceta: Corrected SDSS survey longitude.
KEYWORD PARAMETERS:
/closest: In the southern stripes take the closest of stripes 76, 82, 86.
This allows for the fanning out of runs near the ends of stripes.
OUTPUTS:
stripe
REVISION HISTORY:
14-NOV-2000 Taken from astrotools. Works with modified corrected coords.
(See pro/sdss//ceta2stripenum.pro)
NAME:
circ_radec
PURPOSE:
Circles an ra and dec position on the current display. 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,
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.
INPUT KEYWORD PARAMETERS:
radius=: radius of the circle. Default is image size/10.0
pos_ang=, rmax=, rmin=: instead of just circle, overplot an ellipse
clr=: color index to make the mapping from.
order=: order=0 (default) means images was plotted 0,0 in bottom
left, order=1 is top left. Note objx,objy
is still given in the original coord. system. User must input
ny for the transformation.
ny=: number of pixels in the y-direction.
/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 pro/sdss//circ_radec.pro)
NAME: CLASSIFY_GALAXIES
PURPOSE:
Classifies galaxies based on morphology and color.
Can classify into spiral, or elliptical. Can also return single parameter
scaling from 0 to 1 with elliptical < Spiral.
CALLING SEQUENCE:
classify_galaxies,pstruct,classprob,plot=plot,view=view,
silent=silent,con=con,corrparams=corrparams,cut=cut
,cd=cd,ad=ad,urd=urd,wd=wd
INPUTS:
pstruct: photo structure of galaxy with tag for classification
KEYWORD PARAMETERS:
plot: set to plot Con vs. u-r, Asym vs. Con, Asym vs. u-r
view: set to view random images of any class
silent: set to view no output
con: returns concentration
corrparams: recalculates parameters that depend on k-correction
cut: set if desired different cut for spiral/elliptical division
default = .35
OUTPUTS:
prints number in each classification bin if keyword silent not set
returns classifications into tag .classification and .class
CALLED ROUTINES:
tfasym
view_galaxies
tag_names
aplot
fetch_dir
get_atlas
PROCEDURE:
Measures these parameters from photo outputs and atlas images.
u' - r'
Concentration=petror50/petror90
two-fold asymmetry - see tfasym.pro
Then they are scaled based on a clean sample that was scaled with
STANDARIZE() and adjusted to have a mean of .5 and a variance of .25
Scaled parameters are combined with a weighted mean by their errors
Flags are set in .classification and continuous parameter set in .class
and error in .classerr or can be output by program
NOTE:
To decipher classifications use:
make_clflag_struct
clflag_select
plot_clflags
print_clflags
Galaxy Structure needs these tags:
.classification
.petror50
.petror90
.petrocounts
.petrocountserr
.petrorad
.petroraderr
.reddening
.e1
.e2
.ixx
.iyy
.colc
.rowc
will be filled if tag is there:
.asymmetry
.asymmetryerr
.class
.classerr
if keyword set /corrparams and .z1d then tags filled:
.lum
.absmag
.kcorr
REVISION HISTORY: Judith Racusin 8/7/00
Uses c asym and gr to make a class probability
2/13/01 changed scaleing of params in version 3
changed from petro g-r to petro u-r
5/9/01 added errors and changed class
5/17/01 changed from tfasym3 to tfasym5,
now uses variable centers
6/13/02 changed cut from 0.45 to 0.35 to adjust for
new asyms from bug fixed in tfasym5
(See pro/classgal//classify_galaxies.pro)
NAME: CLFLAG_SELECT
PURPOSE:
Makes cuts based on classification flags using input classification structure.
These cuts are "anded" together, they must all be true for object to
survive.
CALLING SEQUENCE:
clflag_select,pstruct,clflag_struct,select_index
INPUTS:
pstruct: A photo output structure (must have classification tag).
clflag_struct: premade classification flag structure. This will require
any flags set to 'Y' and insist that any flag set to 'N' be off
OUTPUTS:
select_index: indices of selected objects
REVISION HISTORY: Judith Racusin 6/15/00, modified from flag_select by Tim Mckay
8/6/01 added bad_asymmetry and bad_concentration
(See pro/classgal//clflag_select.pro)
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 pro/util//close_match.pro)
NAME:
close_match_radec
PURPOSE:
this will find close matches between 2 sets of points (ra1,dec1)
and (ra2,dec2) (note ra1,ra2,dec1,dec2 are all arrays) in ra dec space.
CALLING SEQUENCE:
close_match_radec,ra1,dec1,ra2,dec2,m1,m2,ep,allow,miss1
INPUTS:
ra1,dec1: the ra dec of the first set
ra2,dec2: the ra dec of the second set
ep: this is the error which defines a close match. A pair is considered
a match if their spherical separation is <= ep.
allow: how many matches in the (ra2,dec2) space will you allow for
each (ra1,dec1)
OUTPUTS:
m1,m2: the indices of the matches in each space. That is
(ra1(m1),dec1(m1)) matches (ra2(m2),dec2(m2))
miss1: this gives the index of the things in x1 NOT found to match (optional)
OPTIONAL KEYWORD PARAMETERS:
none
NOTES:
It sorts the ra2 list so that it can do a binary search for each ra1.
It then carves out the sublist of ra2 where it is off by less than ep.
It then only searches that sublist for points where dec1 and dec2 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
Erin Scott Sheldon 08-Mar-2001
Made code human readable. Fixed bug where miss1 was not returned
when no matches found.
E.S.S. Fixed bug where some matches could be returned outside of the
requested distance cut. 10-June-2004
(See pro/astro//close_match_radec.pro)
NAME:
COMBINE_GRI
PURPOSE:
Combine g,r, and i fluxes and output new magnitudes for psfcounts
and counts_exp. Also, make a combined seeing from the three bandpasses.
Thanks Zelko for corrections on flux conversion
CATEGORY:
SDSS specific routine for galaxy probability calculations
CALLING SEQUENCE:
combine_gri,cat,mag,see,c,detnum,det=det,av=av
INPUTS:
cat: PHOTO structure containing adaptive moments, psfcounts, counts_exp
flags, flags2
MODIFICATION HISTORY:
Created: 29-APR-2003 Dave Johnston
Modified: 13-OCT-2003 Ryan Scranton; added model and cmodel switches
Modified: 5-APR-2004 Ryan Scranton; switched to flux-weighted combination
Current version: 1.5
(See pro/probgal//bayes_combine_gri.pro)
NAME: COMBINE_PTRLIST PURPOSE: Combine a ptrarr, each containg pointers to list of the same types of objects, into a normal idl variable array. The objects must be able to be replicated with the REPLICATE() function. The pointers are freed unless the /nofree keyword is sent. CATEGORY: Utility. CALLING SEQUENCE: output = combine_ptrlist(ptrlist, /nofree, status=) INPUTS: ptrlist: An array or scalar of pointers. KEYWORD PARAMETERS /nofree: If set, the data is copied rather than freed. OUTPUTS: The data from the ptrlist combined into a single IDL variable. OPTIONAL OUTPUTS: status=: 0 success, otherwise failure. SIDE EFFECTS: The pointers are freed. EXAMPLE: ptr[0] = ptr_new(struct1, /no_copy) ... ptr[n] = ptr_new(structn, /no_copy) data = combine_ptrlist(ptr) MODIFICATION HISTORY: Doc created 1-August-2005: Erin Sheldon, UChicago
(See pro/util//combine_ptrlist.pro)
NAME:
COMPUTE_BAYES_PROB
PURPOSE:
Compute Bayesian probability for SG separation cat. Must have psfcounts,
counts_exp, seeing (from adaptive moments). Outputs the galaxy
probability and fills in objc_prob_psf with 1-probgal if the tag exists.
Fills in objc_prob_flags if it exists.
CATEGORY:
SDSS specific routine
CALLING SEQUENCE:
compute_bayes_prob, cat, probgal, probflags
INPUTS:
cat: PHOTO structure containing tags psfcounts,
counts_exp, seeing (from adaptive moments)
OPTIONAL INPUTS:
NONE
KEYWORD PARAMETERS:
/byfield: split catalog by field
/noiter: don't iterate on the number counts
OUTPUTS:
probgal: Probability of being a galaxy: default is 10000. (so objc_prob_psf
will be -9999. by default)
probflags: diagnostic flags
OPTIONAL OUTPUTS:
NONE
COMMON BLOCKS:
NONE
SIDE EFFECTS:
cat.objc_prob_psf and cat.objc_prob_flags are filled in if they exist
RESTRICTIONS:
If the structure already contains cmodel_counts, then it needs thest tags:
CMODEL_COUNTS, CMODEL_COUNTSERR, PSFCOUNTS, PSFCOUNTSERR, M_RR_CC_PSF,
FLAGS, FLAGS2
Otherwise, cmodel_counts will be computed, in which case these tags are
required:
COUNTS_DEV, COUNTS_DEVERR, COUNTS_EXP, COUNTS_EXPERR, FRACPSF
If /byfield, then need RUN, RERUN, CAMCOL, FIELD, ID
PROCEDURE:
EXAMPLE:
MODIFICATION HISTORY:
Creation: Version 1.0 ??-??-?? Dave Johnston, UofChicago
Version 1.2 29-April-2003 DJ
Version 1.5 ??-??-2004 Ryan Scranton, Pitt
(See pro/probgal//compute_bayes_prob.pro)
NAME:
COMPUTE_ZEROPOINT
PURPOSE:
compute zeropoint,zpt, from from calib info a,b,c,k are from fcPCalib
file single 5-float X is airmass in fpField file single 5-float
UG,IZ model_colors 1d-arrays of anylength
CATEGORY:
SDSS specific routine
CALLING SEQUENCE:
compute_zeropoint,a,b,c,k,X,UG,IZ,zpt
MODIFICATION HISTORY:
Creation: 19-Nov-2002, Dave Johnston, UofChicago
(See pro/sdss//compute_zeropoint.pro)
NAME:
CONVERT2RD
CALLING SEQUENCE:
convert2rd,x,y,ra,dec,rac=rac,decc=decc
PURPOSE:
Convert from x-y to ra and dec
(See pro/astro//convert2rd.pro)
NAME:
CONVERT2XY
CALLING SEQUENCE:
convert2xy,ra,dec,xout,yout,rac=rac,decc=decc
PURPOSE:
Convert from ra and dec to x-y
(See pro/astro//convert2xy.pro)
NAME:
cosmology (IDL Class file)
PURPOSE:
Implements some common distance measurements in cosmology. Follows
conventions in Hogg astro-ph/9905116
CALLING SEQUENCE:
c=obj_new('cosmology')
METHODS:
DH(h=)
Hubble distance
Ez_inverse(z, omega_m=, omega_l=, omega_k=, flat=)
1.0/sqrt( omega_m*(1+z)^3 + omega_k*(1+z)^2 + omega_l )
Ezinv_integral(z1, z2, omega_m=, omega_l=, omega_k=, flat=, npts=)
Integral of 1/E(z) from z1 to z2
Dc(z1, z2, omega_m=, omega_l=, omega_k=, flat=, h=, npts=)
Comoving distance (line of sight) in Mpc/h
Dm(z1, z2, omega_m=, omega_l=, omega_k=, flat=, h=, npts=)
Comoving distance (transverse) between two events in Mpc/h
Da(z1, z2, omega_m=, omega_l=, omega_k=, flat=, h=, npts=, Dl=)
angular diameter distance. e.g. angular size = physical size/Da in Mpc/h
Dl(z1, z2, omega_m=, omega_l=, omega_k=, flat=, h=, npts=, Da=)
luminosity distance.
distmod(z, omega_m=, omega_l=, omega_k=, flat=, h=, npts=)
distance modulus. mag = absmag + distmod
velement(z, omega_m=, omega_l=, omega_k=, flat=, h=, npts=, /comoving)
volume element, optionally comoving in (Mpc/h)^3
volume(zmin, zmax, omega_m=, omega_l=, omega_k=, flat=, h=, npts=, vnpts=, /comoving)
volume between zmin,zmax optionally comoving in (Mpc/h)^3
genrandz(nrand, zmin, zmax, omega_m=, omega_l=, omega_k=, flat=, h=, npts=, /comoving)
Generate random redshifts uniformly in a volume specified by zmin, zmax
EXAMPLE:
c=obj_new('cosmology')
z=0.3
omega_m=0.2
; Calculate angular diameter distance from 0 to 0.3
da = c->Da(0.0, z, omega_m=omega_m)
RESTRICTIONS:
Requires gauleg, a C extension for calculating gauss-legendre weights. This
is easy to compile, just do ./configure and then make in the sdssidl base
directory
MODIFICATION HISTORY:
Created some time in 2006, Erin Sheldon, NYU
(See pro/astro//cosmology__define.pro)
NAME:
create_photomap
PURPOSE:
Map ra/dec to pixel coordinates.
Created:
2002, Erin Sheldon, UofMichigan
(See pro/sdss//create_photomap.pro)
NAME:
CSURVEY2EQ
PURPOSE:
Convert from corrected lambda, eta (SDSS survey coordinates) to ra, dec
The system is corrected so that the longitude eta ranges from
[-180.0, 180.0] and the latitude lambda ranges from [-90.0,90.0].
The standard lambda/eta both range from [-180.0,180.0] which doesn't
make sense. NOTE: lambda is often referred to as longitude but this
is incorrect since it has poles at [-90,90]
CALLING SEQUENCE:
csurvey2eq, clambda, ceta, ra, dec
INPUTS:
clambda: Survey longitude in degrees
ceta: Survey latitude in degrees
OUTPUTS:
ra: Equatorial latitude in degrees
dec: Equatorial longitude in degrees
REVISION HISTORY:
Written: 26-Sep-2002 Erin Scott Sheldon
(See pro/sdss//csurvey2eq.pro)
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 pro/plotting//dcenter.pro)
NAME:
ddir
PURPOSE:
Generate a directory name based upon input elements. Combined with dfile defines a generic naming scheme for directories and files.
CALLING SEQUENCE:
dir = ddir(pathlist, root=, file=)
OPTIONAL INPUTS:
pathlist: An array of path elements above the root.
root: The root directory. Default is the empty string.
OUTPUTS:
directory build up as the level elements combined with the root dir. These
are connected using the operating system's path separator. On UNIX:
root/level1/level2/....
OPTIONAL OUTPUTS:
filebase: The basic file element associated with this directory structure.
level1-level2-level3
This is used by dfile to build a file name. Note root is not includec.
NOTES:
If there are no inputs the empty string is returned.
EXAMPLE:
dir = ddir(root='~/project', ['output','sample01','split16'], filebase=filebase)
print,dir
~/project/output/sample01/split16
print,filebase
'output-sample01-split16
MODIFICATION HISTORY:
Created: 2007-04-22. Moved to main archive. Erin Sheldon, NYU
(See pro/files//ddir.pro)
NAME:
DEFSYMBOLS
OBSOLETE:
Note: this program is mostly obsoleted by the very nice textoidl() program.
PURPOSE:
Define symbols in true-type and vector type fonts. System variables
!TSYM AND !VSYM, structures, are created. !CSYM is also created and will
contain the common symbols. It will copy in symbols from !TSYM or !VSYM
depending on !p.font (1 or 0 for true-type, -1 for vector)
If you change font types be sure to rerun defsymbols
CATEGORY:
Plotting
CALLING SEQUENCE:
defsymbols
INPUTS:
None
SIDE EFFECTS:
System variables created:
!tsym: true-type fonts
!vsym: vector vonts
!csym: The fonts that are contained in both of the above font sets.
EXAMPLE:
; True type fonts
IDL> !p.font = 1
IDL> defsymbols
IDL> x=findgen(100)/10
IDL> alpha = 1./9
IDL> y = sin(alpha*x)
IDL> plot,x,y,xtitle='x',ytitle='sin('+!csym.alpha+'*x)',charsize=2
; vector fonts
IDL> !p.font = -1
; repeate above code
MODIFICATION HISTORY:
??-??-????: Erin Sheldon, UChicago
(See pro/plotting//defsymbols.pro)
NAME:
DELVARX
PURPOSE:
Make input variables undefined. Similar to intrinsic DELVAR, but
works at any calling level (e.g. within procedures)
This is a factor of 40 times faster than the astronomy
library version of delvarx.
CALLING SEQUENCE:
delvarx, v1, v2, ..., v16
INPUTS:
v1,v2,..... any idl variable
REVISION HISTORY:
Created 23-Apr-2001, Erin Scott Sheldon UofMich
(See pro/util//delvarx.pro)
NAME:
dfile
PURPOSE:
Create a generic filename based upon the directory structure. Combined with ddir defines a generic naming scheme for directories and files.
CALLING SEQUENCE:
file = dfile(pathlist, root=, prefix=, postfix=, extension=)
INPUTS:
OPTIONAL INPUTS:
pathlist: An array of path elements above the root.
root: The root directory. Default is the empty string ''
prefix: A prefix added to the front of the file name. Default ''
postfix: A postfix added to the end of the file name. Default ''
extension: A file extension. Default ''
KEYWORDS:
/nodir: Don't add the directory to the file name.
OUTPUTS:
file: A generic file name. Directory elements are connected with the path
separator for the current operating system. The file name contains the
same elements separted by dashes '-'. On UNIX this looks like:
root/level1/..../levelN/prefix-level1-...-levelN-postfix.ext
OPTIONAL OUTPUTS:
dir: Set to a named variable to return the directory for this file.
NOTES:
If there are no inputs the empty string is returned.
EXAMPLE:
file = dfile(root='~/project', ['output','sample10','split16'],
prefix='proj', postfix='02', ext='.dat')
print,file
~/project/output/sample01/split16/proj-output-sample10-split16-02.dat
MODIFICATION HISTORY:
Created: 2007-04-22. Moved to main archive. Erin Sheldon, NYU
(See pro/files//dfile.pro)
NAME: DISPLAY_EXISTS PURPOSE: Test if there is an X display. Works on *nix systems with the sh shell. Note: if no display exists, but you log into a remote machine with X-forwarding, then this program will incorrecly think the display exists. This result in a crash if a window, for example, is created. CALLING SEQUENCE: if display_exists() then ..... else .... RESTRICTIONS: Only works on *nix systems. EXAMPLE: if display_exists() then window,1 MODIFICATION HISTORY: ??-??-2003 Erin Sheldon UChicago 27-Oct-2004 Forced use of sh shell. Tom Downes UChicago
(See pro/plotting//display_exists.pro)
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. Output
inmages, .jpg, .png, or .ps if requested. Gif no longer supported
by idl.
CALLING SEQUENCE:
INPUTS: fchart: The finding chart
object: The photo object struct 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:
order=: Order to draw images. default is order=0 is 0,0 at bottom
left. for order=1, 0,0 is top left.
/box: Draw a box instead of a circle.
/jpeg: Write a jpeg from display.
/png: Write a png from display.
/ps: If set a postscript files are created for the requested items.
fnamepng: name of png file. Default fchart.png
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
Changed order in title: run-rerun-camcol-field-id
Fixed circle color problem.
02-Jul-2002
(See pro/sdss//display_fchart.pro)
NAME:
doc_method
PURPOSE:
Display the documentation for a method of an IDL class. This requires that
the method has documention surrounded by
;docstart::classname::methodname
;docend::classname::methodname
CATEGORY:
IDL Classes,objects
CALLING SEQUENCE:
doc_method, methodname, /class
INPUTS:
methodname: Format: classname::methodname
KEYWORD PARAMETERS:
/class: Display the doc for the class. This is equivalent to
doc_library, 'classname__define'
RESTRICTIONS:
The method doc must be formatted properly with text surrounded by
;docstart::classname::methodname
;docend::classname::methodname
EXAMPLE:
doc_method, 'postgres::query
MODIFICATION HISTORY:
Created: 2006, Erin Sheldon, NYU
(See pro/util//doc_method.pro)
NAME:
ENDPLOT
PURPOSE:
Closes and saves the current plotfile and returns to 'X'. See also BEGPLOT.
CALLING SEQUENCE:
endplot, /trim_bbox, /landfix, /setup, /help
KEYWORD PARAMETERS:
/landfix:
fix the landscape so its not flipped (which is the only way IDL writes
landscape mode)
/trim_bbox:
trim the bounding box on encapsulated ps files. Requires that the
external program "epstool" is installed. This must be the later mature
version that accepts --bbox, etc as options.
http://www.cs.wisc.edu/~ghost/gsview/epstool.htm
/setup:
run setupplot after closing device. If !pslayout.runsetup is true then
this will be run automatically.
/help:
print this doc
COMMON BLOCKS:
PLOTFILE_COM: See the documentation for BEGPLOT.
EXAMPLE:
begplot, 'test.ps'
plot, .....
endplot
MODIFICATION HISTORY:
Originally based on ENDPLOT by Michael J. Carter. Almost complete rewrite
Erin Sheldon, March 2001.
(See pro/plotting//endplot.pro)
NAME:
EQ2CSURVEY
PURPOSE:
Convert from ra, dec to the corrected clambda, ceta
SDSS survey coordinate system. It is corrected so that the
longitude eta ranges from [-180.0, 180.0] and the latitude
lambda ranges from [-90.0,90.0]. The standard lambda/eta
both range from [-180.0,180.0] which doesn't make sense.
NOTE: lambda is often referred to as longitude but this
is incorrect since it has poles at [-90,90]
CALLING SEQUENCE:
eq2csurvey, ra, dec, clambda, ceta
INPUTS:
ra: Equatorial latitude in degrees
dec: Equatorial longitude in degrees
OUTPUTS:
clambda: Corrected Survey longitude (actually lattitude) in degrees
ceta: Corrected Survey latitude (actually logitude) in degrees
REVISION HISTORY:
Written: 26-Sep-2002 Erin Scott Sheldon
(See pro/sdss//eq2csurvey.pro)
NAME:
EQ2GC
PURPOSE:
convert from equatorial to great circle coordinates
CALLING SEQUENCE:
eq2gc, ra, dec, node, inc, mu, nu
INPUTS:
ra, dec: equatorial
node, inc: node and inclination of the stripe.
OUTPUTS:
mu, nu: great circle coords
PROCEDURE:
Taken from astrotools
REVISION HISTORY:
14-NOV-2000 Erin Scott Sheldon UofMich Taken from astrotools
(See pro/sdss//eq2gc.pro)
NAME:
EQ2SURVEY
PURPOSE:
Convert from ra, dec to lambda, eta (SDSS survey coordinates)
Use of these coordinates are not recommended because they do
not form a meaningful system. See the documentation for eq2csurvey.
CALLING SEQUENCE:
eq2survey, ra, dec, lambda, eta
INPUTS:
ra: Equatorial latitude in degrees
dec: Equatorial longitude in degrees
OUTPUTS:
lambda: Survey longitude in degrees
eta: Survey latitude in degrees
REVISION HISTORY:
Written: 5/15/2000 Erin Scott Sheldon
Taken from astrotools.
(See pro/sdss//eq2survey.pro)
NAME:
errfill
PURPOSE:
Fill in the region x, y, y+/-yerr, which is the allowed range around x,y
given the errors yerr. The plot and data coordinates must have already
been created as required by the polyfill procedure.
CATEGORY:
Plotting
CALLING SEQUENCE:
errfill, x, y, yerr, _extra=
INPUTS:
x, y, yerr: points and error bars. Must all be the same length.
OPTIONAL INPUTS:
_extra: extra plotting keywords, such as color, /line_fill, pattern, etc.
see POLYFILL for more details.
EXAMPLE:
plot, x, y
errfill, x, y, yerr, color=!red
MODIFICATION HISTORY:
Created, 2007-01-23 Erin Sheldon, NYU
(See pro/plotting//errfill.pro)
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 pro/sdss//eta2stripenum.pro)
NAME:
EXTRACT_TAGS()
PURPOSE:
Extract the specified tags from input structure and return in a new
struct ordered as requested.
CALLING SEQUENCE:
newstruct = extract_tags(oldstruct, tagnames)
INPUTS:
oldstruct: the original structure
tagnames: the names of tags to keep.
OUTPUTS:
newstruct: the new structure with requested tags. Tags are in the order
requested.
CALLED ROUTINES:
MATCH
PROCEDURE:
REVISION HISTORY:
Created: 2007-08-03, Erin Sheldon, NYU
(See pro/struct//extract_tags.pro)
NAME:
FCHART
PURPOSE:
Create a finding chart for an SDSS object.
CALLING SEQUENCE:
fchart, pstruct, index, radius, clr, fchart, dir=dir,
/shift2r,
objx=objx, objy=objy, impos=impos, silent=silent,
nonoise=nonoise, useind=useind
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 certain tags, such as
rowc,colc,field,id,parent,nchild
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.
/shift2r: Perform sub-pixel shifts based on astrometry to align the
atlas images with the r-band. For some reason, only
integer shifts were stored in the atlas images. This slows
things down only a small amount.
/silent: If silent is set, nothing is printed except some errors
/nonoise: if set, no noise is added to image.
maxsize: deprecated
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 [colc,rowc]
objy: Same for y.
impos: Absolute position of left hand corner of image as defined
by this equation:
impos[0] = colc
impos[1] = rowc + 1361.*(field - fieldmin)
CALLED ROUTINES:
GET_FAMILY
GET_ATLAS
PROCEDURE:
Create a finding chart around an input object from all the objects nearby.
The trick is to use atlas images of objects in such a way that flux is
only added once. I choose nchild == 0 to do this.
From here, the atlas image of each good neighbor is the proper color is
found and placed within the appropriate box. The registration is determined
by comparing positions in the different colors.
Note the 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. 14-NOV-2000
30-Aug-2002: Better way to calculate positions: just use r-band
positions and translate the other bands to r-band using the
bottom-left corners of the atlas images.
11-Sep-2002:
-Fixed bug where light from some objects was added
twice if the objects spanned more than one field.
-Fixed bug where some objects were not being used.
-- E.S.S.
-Added optional sub-pixel shifting, so can get better alignment with
the r-band (for color images..)
23-Feb-2005: Use new read_atlas routine. E.S.S.
(See pro/sdss//fchart.pro)
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, radarcsec=radarcsec, $
radarcmin=radarcmin,$
tol=tol, $
linestyle=linestyle,$
nonoise=nonoise, $
circ_rad = circ_rad, $
circ_color=circ_color,$
circ_obj=circ_obj, $
nodisplay=nodisplay, psfile=psfile, $
silent=silent, $
objx=objx, objy=objy, photoid=photoid, $
nocirc = nocirc, $
pos_ang=pos_ang, rmax=rmax, rmin=rmin,$
_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:
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.
radarcsec: radius in arcseconds (takes precedence over radius)
radarcmin: radius in arcminutes (takes precedence over radarcsec)
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 for the
first and 1/20. for the rest
circ_color: colors to use for circles. Default is all white or
black depending on device
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.
pos_ang, rmax, rmin: instead of just circle, overplot an ellipse
_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
Added radarcsec and radarcmin keyword parameters. 02-Jul-2002
(See pro/sdss//fchart_circ_radec.pro)
NAME:
FEXIST
PURPOSE:
Check if a file exists. This now uses built-in function file_test()
for versions of IDL >= 5.4 For efficiency the user should use that
function if possible. Otherwise a test using the openr function is
used. In that case directories cannot be checked.
CALLING SEQUENCE:
file_exists=fexist(file, _extra=_extra)
INPUTS:
file: A full path filename.
OPTIONAL INPUTS:
_extra: For IDL >= 5.4 these are the options to the file_test() function
KEYWORD PARAMETERS:
NONE
OUTPUTS:
1 or 0: 1 means the file exists, 0 means the file does not exist.
OPTIONAL OUTPUTS:
NONE
EXAMPLE:
outfile='test.dat'
;; don't overwrite existing file
if fexist(file) then outfile = 'some other name'
openw, lun, file, /get_lun
....etc.
CALLED ROUTINES:
FILE_TEST (IDL >= 5.4)
OPENR (IDL < 5.4 )
FREE_LUN (IDL < 5.4 )
REVISION HISTORY:
07-DEC-2000 Creation. Erin Scott Sheldon
01-MAR-2003 Added use of FILE_TEST function
(See pro/files//fexist.pro)
NAME:
FIELD2STRING
PURPOSE:
Function outputs a string containing field of a photo tsObj
file in the correct format: width of 4 with zero padding.
CALLING SEQUENCE:
result = field2string(field)
INPUTS:
field number (May be an array)
REVISION HISTORY:
Author: Erin Scott Sheldon Umich 5/25/99
Now just use a format string. 2006-10-07, Erin Sheldon, NYU
(See pro/sdss//field2string.pro)
NAME:
FIELD_INDICES
PURPOSE:
Takes arrays of run,rerun,camcol,field and finds the number of uniq hashs
(ie run-rerun-camcol-field congomerates) and returns the reverse_index (see
IDL "histogram" function docs) so that they can be grouped together easily
it also returns an index and a structure with {run,rerun,camcol,field}
such that the array str(index).run is equal to run etc. This attemps to be
clever and do things quickly and with minimal memory use
CATEGORY:
SDSS specific routine.
CALLING SEQUENCE:
field_indices, run, rerun, camcol, field, num, rev, index, str, h
INPUTS:
run,rerun,camcol,field: in integer form
OUTPUTS:
num: the number of uniq field combos
rev: the reverse indices of histogram
index: described above, same number of elements as run,rerun...
str: array of num structures with run,rerun,camcol,field
h: the histogram it self
MODIFICATION HISTORY:
April 05 2003 Dave Johnston
(See pro/sdss//field_indices.pro)
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
and lupton 1/r weighting
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 pro/astro//findabtheta.pro)
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 pro/astro//finde.pro)
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,
/first, /silent, /astrans]
INPUTS:
ra, dec: The positions in degrees.
KEYWORD PARAMETERS:
/first: just find the first run that matches
silent=: silent=1: don't print run, camcol, field
silent>1: don't print anything.
/astrans: call find_radec_astrans to find run. Slower but more accurate
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.
PROCEDURE:
Must have The configuration variables RADEC_SEARCH_DIR, SEARCH_RUNS,
and the RUN_STATUS info must be defined. 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, cetamin, cetamax, clambdamin, clambdamax. 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 pro/sdss//find_radec.pro)
NAME:
FIND_RADEC_ASTRANS
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. Uses astrans file; more accurate than find_radec
without /astrans keyword, but slower
CALLING SEQUENCE:
find_radec_astrans, ra, dec [, run, camcol, field,
runstr=runstr, colstr=colstr, fstr=fstr,
/first, /silent]
INPUTS:
ra, dec: The positions in degrees.
KEYWORD PARAMETERS:
/first: just find the first run that matches
/silent: silent=1: don't print run, camcol, field
silent>1: don't print anything.
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)
sdss_read()
PROCEDURE:
REVISION HISTORY:
Created: 15-AUG-2002 Erin Sheldon UofMich
(See pro/sdss//find_radec_astrans.pro)
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, radarcsec=radarcsec, radarcmin=radarcmin, $
tol=tol, $
nonoise=nonoise, $
nocirc=nocirc, $
circ_rad=circ_rad,$
circ_color=circ_color,$
nodisplay=nodisplay, psfile=psfile, $
silent=silent, $
photoid=photoid, $
objx=objx, objy=objy, $
linestyle=linestyle,$
_extra=extra, runuse=runuse, astrans=astrans
INPUTS:
ra, dec: position of interest in degrees. If is an array, then
search is based on first element only.
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.
radarcsec: radius in arcseconds (takes precedence over radius)
radarcmin: radius in arcminutes (takes precedence over radarcsec)
tol: Tolerance for finding nearby object in arcseconds.
Default is 100.
cird_rad: array of radii used to make circle around objects in
the list. Default is size of finding chart/10.0 for the
first and 1/20. for the rest
circ_color: colors to use for circles. Default is all white or
black depending on device
psfile: make ps file with this name
linestyle: linestyles for circles. Default is all 0 (solid line)
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:
/nodisplay: don't display, just make fchart and return
/nonoise: Set for no noise in fchart.
/nocirc: don't draw circles
/astrans: use direct astrans method
OPTIONAL OUTPUTS:
fchart: The finding chart
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.
altdir: atlas directory used to make fchart
photoid: Returns Id of nearest object.
objx,objy: x,y positon of object used to make fchart
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
Added radarcsec and radarcmin keyword parameters. 02-Jul-2002
(See pro/sdss//find_radec_fchart.pro)
NAME:
flag_select()
PURPOSE:
Check the bits in a set of input flags. The flags, flag type, and
a structure describing the flags to check are input. The flags can
be ANDED or OR-ED together. The indices of the input that match
the selection criteria is returned, or -1 if none.
CALLING SEQUENCE:
si = sdss_flag_select(flags, flagtype, select_struct, [nkeep,
/orflags, input_index=]
INPUTS:
flags: A set of flags. May be an array.
flagtype: The flag type. Currently supported flags may be listed
using the
IDL> sf->print_flagtypes
method, but is most likely at least
OBJECT1, OBJECT2, PRIMTARGET, SECTARGET, STATUS
select_struct: A structure with flag names and select criteria. The
available flags can be listed with the method:
IDL> sf->print_allflags
The select criteria are
'y', 'n', or 'd' (yes it is set, no it isn't set, don't care)
e.g For OBJECT1 flags:
IDL> fs = {child: 'y', satur: 'n'}
The flag names for a given flag type may be gotten:
IDL> fnames=sf->flagnames(flagtype)
or
IDL> sf->print_allflags
OPTIONAL INPUTS:
/orflags: OR the flags. Default is to AND them.
input_index=: A beginning index to restrict the search.
OPTIONAL OUTPUTS:
nkeep: The number that matched the selection criteria.
EXAMPLES:
IDL> fst = {galaxy_red: 'Y'}
IDL> si = sdss_flag_select(st.primtarget, 'primtarget', fst}
IDL> fst = {child: 'y', satur: 'n'}
IDL> si = sdss_flag_select(st.flags[2], 'object1', fst)
; Choose either lrg or main sample galaxies usign the /orflags option.
IDL> fst = {galaxy_red: 'Y', galaxy: 'Y'}
IDL> si = sdss_flag_select(st.primtarget, 'primtarget', fst, /orflags}
MODIFICATION HISTORY:
Created: Mid-2005 Erin Sheldon Uchicago
(See pro/sdss//sdss_flag_select.pro)
NAME: flux2lup PURPOSE: Convert flux to SDSS luptitudes; this has different conventions than nmgy2lups which gives the expected result for the princeton redux. CATEGORY: SDSS specific routine CALLING SEQUENCE: flux2lup, flux, mag, fluxerr, magerr,b=b INPUTS: flux: flux array. Can be either full 5-bandpass array or single. OPTIONAL INPUTS: fluxerr: err in flux. If there then magerr will be returned. b=b: If single bandpass, must be specified with b=0, 1, 2, 3, or 4 OUTPUTS: mag: mags in luptitudes OPTIONAL OUTPUTS: magerr: only returned if fluxerr is sent. MODIFICATION HISTORY: ??-??-?? Dave Johnston. Translation of Zeljko's SM code
(See pro/sdss//flux2lup.pro)
NAME: fshift PURPOSE: Routine to shift an image by non-integer values CALLING SEQUENCE: results = fshift(image,delx,dely) INPUTS: image - 2D image to be shifted delx - shift in x (same direction as IDL SHIFT function) dely - shift in y OUTPUTS: shifted image is returned as the function results HISTORY: version 2 D. Lindler May, 1992 - rewritten for IDL version 2 19-may-1992 JKF/ACC - move to GHRS DAF.
(See pro/util//fshift.pro)
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 pro/fits//fxposit2.pro)
NAME:
GC2CSURVEY
PURPOSE:
convert from SDSS great circle to corrected SDSS survey coordinates
CALLING SEQUENCE:
gc2csurvey, mu, nu, node, inc, clambda, ceta
INPUTS:
mu, nu: great circle coords.
node, inc: node and inclination of the stripe.
OUTPUTS:
clambda, ceta: survey coords.
REVISION HISTORY:
26-Sep2002 Erin Scott Sheldon UofChicago
(See pro/sdss//gc2csurvey.pro)
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:
ra,dec: equatorial coords.
PROCEDURE:
Taken from astrotools
REVISION HISTORY:
14-NOV-2000 Erin Scott Sheldon UofMich Taken from astrotools
(See pro/sdss//gc2eq.pro)
NAME:
GC2SURVEY
PURPOSE:
convert from SDSS great circle to SDSS survey coordinates
CALLING SEQUENCE:
gc2survey, mu, nu, node, inc, lambda, eta
INPUTS:
mu, nu: great circle coords.
node, inc: node and inclination of the stripe.
OUTPUTS:
lambda, eta: survye coords.
CALLED ROUTINES:
GC2EQ
GC2SURVEY
PROCEDURE:
Call gc2eq, then eq2survey
REVISION HISTORY:
26-Sep-2002 Erin Scott Sheldon
(See pro/sdss//gc2survey.pro)
NAME:
GENRAND
PURPOSE:
Generate random numbers from an input probability function.
CALLING SEQUENCE:
genrand, prob, xvals , nrand, [, rand, /cumulative, /double, /quadratic,
plt=plt, bin=bin])
INPUTS:
prob: input probablility function.
xvals: abscissae
nrand: How many points to generate from the probability function.
KEYWORD PARAMETERS:
method=method: method=0 (default) use integral technique
method=1 use 2-d cut technique
cumulative: tells the program that prob is the cumulative
probablility. Using this option saves processing time.
Note for method=1 this is not applicable.
/double: use double precision?
/quadratic: use quadratic interpolation? Ignored for idl versions
less than 5.4
/plt: plot histogram if requested
bin: how to bin the histogram (irrelevent if not /plt )
OUTPUTS:
rand: an array of random numbers generated from prob. size nrand
PROCEDURE:
Method=0 (default)
Generates random numbers from the input distribution by inverting
the cumulative probability function. Performs interpolation
using the interpol function.
Method=1
Generates random numbers from the input distribution by generating x,y
values uniformly and keeping those that lie beneath the
probability distribution
REVISION HISTORY:
Author: Erin Scott Sheldon UofM 1/??/99
March 2003: Use interpolation. Introduced method=1 E.S.S.
(See pro/statistics//genrand.pro)
NAME:
GENRAND2D
PURPOSE:
Generate random numbers from a 2d probability function.
CALLING SEQUENCE:
genrand2d, prob, xvals, yvals, nrand, xrand, yrand, $
double=double, nxbins=nxbins, nybins=nybins, /plt
INPUTS:
prob: input probablility function.
xvals, yvals: x-y values corresponding to the surface prob z values
nrand: How many points to generate from the probability function.
KEYWORD PARAMETERS:
/double: Return double precision?
/plt: make a plot of the generated data and input distribution
nxbins=nxbins, nybins=nybins: number of bins to use in plot
OUTPUTS:
xrand, yrand: arrays of random numbers generated from prob
PROCEDURE:
Generates random numbers from the input distribution by generating x,y,z
values uniformly and keeping those that lie beneath the probability
surface.
REVISION HISTORY:
Author: Erin Scott Sheldon UofChicago 02-Mar-2003
(See pro/statistics//genrand2d.pro)
NAME: get_consecutive PURPOSE: Return indices for first/last pairs of consecutive integers. The same index is returned for first/last if integer is isolated. CALLING SEQUENCE: get_consecutive, numbers, first, last INPUTS: numbers: A sorted array of numbers. OUTPUTS: first,last: Arrays containing indices to first/last of integers. MODIFICATION HISTORY: Created 2005, Erin Sheldon, UChicago
(See pro/util//get_consecutive.pro)
NAME:
GET_FAMILY
PURPOSE:
retrieves atlas images for an object and any other objects
associated with it in a blend.
Inputs: pstruct: the photo output structure. Must use sarahtags.
index: the object's index in pstruct
Optional inputs: dir: directory of atlas images
field: field of the object.
run: run object is from
camcol: camera column of object (1-6)
maxsize: maximum size for images. [500,500] is default.
prompt: prompting for prompt=1
nodisplay: no display if nodisplay =1
silent: will run silently unless bad images or missing
images are found
Outputs: parent: the array containing the index of the parent
children: the array containing the indices of the children
siblings: the array containing the indices of the siblings
im: the atlas image
Examples:
View the family of an object and return family.
IDL> struct = sdss_read('tsobj', run, camcol, field=field)
IDL> index = 33
IDL> get_family, struct, index, parent, children, siblings
Author: Sarah Monk
Dave Johnston : only look in a vicinity of the original object
not the whole structure. Speeds it up considerably.
(See pro/sdss//get_family.pro)
NAME:
hdr2struct
PURPOSE:
Convert a string array with the format of a FITS header
into a single structure
CALLING SEQUENCE:
struct = hdr2struct(hdr)
INPUTS:
hdr: FITS-(like) header (array of strings)
OUTPUTS:
struct: Single structure with keyword(s) and comment(s)
OPTIONAL INPUTS:
COMMENTS:
Only passes back anonymous structures as it appends as it works
through all the header keywords. Use struct_append to make an
array from an array of headers.
PROCEDURES CALLED:
headfits()
REVISION HISTORY:
17-Jul-2001 Written by Burles
(See pro/fits//hdr2struct.pro)
NAME:
HIST2D
PURPOSE:
like the IDL built in function hist_2d
but better since it can accept floats
output histogram is a longarray(nxbins,nybins)
uses only the relevent data in range
Dave Johnston
added return of reverse_indices April 1 2003
Erin Sheldon, UofChicago. Added calculation of mean in x and y direction
30-Jul-2003
(See pro/statistics//hist2d.pro)
NAME:
histogram_2d
PURPOSE:
takes two dimentional data x,y and makes a histogram,
hist,with hist_2d. hist is a structure that also contains
the scaling parameters so one can display
it with the right x,y, scale etc.
CALLING SEQUENCE:
-syntax hist=histogram_2d(x,y,hist,nxbins,nybins,xrange=,yrange=,silent=silent)
INPUTS:
x ,y : the two one-dimentional arrays that you want histogrammed
OUTPUTS:
hist : the histogram structure contains 3 fields
.map (the 2D array) , .xrange, .yrange (the two ranges)
these ranges permit mapping from the data to the histogram map
and vice versa. also contains the mean x and mean y (xbins,ybins)
KEYWORDS:
xrange,yrange : the range to include data from
these are output and saved in the hist structure
the default is min, max
if these are flipped like [12,3]
it will use 3 as min and 12 as max and then flip the histogram
nxbins, nybins : the number of bins for each dimention
silent : speak no evil
EXTERNAL CALLS:
none
METHOD:
uses hist2d rather than the built in
IDL routine hist_2d because it has to work with floating
point numbers as well
EXAMPLE:
IDL> histogram2d,radius,mag,hist,[0,6],[24,14],250,250
IDL> tvim2,hist.map,range=[0,100],xrange=hist.xrange,yrange=hist.yrange
NOTES
HISTORY: written by David Johnston -University of Chicago
Physics Department 1999
Erin Sheldon, UofChicago. Added calculation of mean in x and y direction
30-Jul-2003
Returns bin ranges and bin middles as well as mean in each bin from
data. July 2006 Erin Sheldon , NYU
(See pro/statistics//histogram_2d.pro)
NAME:
histogram_points
PURPOSE:
Return as set of points which when plotted show a histogram representation
of the input x-y points. This is equivalent to psym=10 for normal
"horizontal" histograms. This procedure also allows "vertical" histograms
which can be plotted against the y-axis.
CATEGORY:
Plotting
CALLING SEQUENCE:
histogram_points, x, y, xp, yp, type=
INPUTS:
x, y: The x and y points. These could be the result of a call to
histogram.
OPTIONAL INPUTS:
type: The type of histogram, either 'horizontal' or 'vertical'. Default
is 'horizontal'
OUTPUTS:
xp, yp: The points for plotting.
EXAMPLE:
; two-dimensional histogram. Plot the image and also project along
; each axis and show 1-d histogram.
hist2d, x, y, hist, xbins=xbins, ybins=ybins
xr = [min(xbins), max(xbins)]
yr = [min(ybins), max(ybins)]
implot, hist, xrange=xr, yrange=yr
hx = total(hist,2)
hy = total(hist,1)
histogram_points, xbins, hx, xp, yp
yp = yp/max(yp)*max(ybins)/5.0
oplot, xp, yp
histogram_points, ybins, hy, xp, yp
xp = xp/max(xp)*max(xbins)/5.0
oplot, xp, yp
MODIFICATION HISTORY:
??-??-?? Erin Sheldon, NYU
(See pro/plotting//histogram_points.pro)
NAME:
htm_bin2fits
PURPOSE:
Convert a binary output file created by htm_match into a FITS file.
CALLING SEQUENCE:
htm_bin2fits, file [, outfile, /remove]
INPUTS:
file: The path to a binary file.
OPTIONAL INPUTS:
outfile: The name of the output fits file. If not entered,
the file is set to file+'.fits'
KEYWORD PARAMETERS:
/remove: Remove the old binary file after converting.
MODIFICATION HISTORY:
Created: 2006-08-15 Erin Sheldon, NYU
(See pro/htm//htm_bin2fits.pro)
NAME:
HTM_MATCH
PURPOSE:
Match two sets of ra/dec points using the Heierarchical
Triangular Mesh code. This is an IDL wrapper for htmmatchc
IDL DLM, and uses the DLM htm_index when these are not sent.
This is very efficient for large search angles and large lists.
May seem slow otherwise due to overhead creating htm indices.
Currently returns all matches within the search radius.
CATEGORY:
Astronomy.
CALLING SEQUENCE:
htm_match, ra1, dec1, ra2, dec2, angle, m1, m2, distance12, $
maxmatch=, $
htmid2=, htmrev2=, $
minid=, maxid=, $
depth=,
file=,
status=
INPUTS:
ra1,dec1,ra2,dec2: ra,dec lists. Must be double precision.
angle: The search angle in radians. May be a scalar or an
array same length as ra1,dec1.
KEYWORD PARAMETERS:
maxmatch=: The maximum number of allowed matches per point. Defaults
to 100,000,000
depth=: the depht of the HTM tree. Defaults to 10.
htmid2=: the htm indexes for the second list. If not sent
they are generated internally.
htmrev2=: The result of
h=histogram(htmid2-min(htmid20), min=0, rev=htmrev2)
If not sent will be created internally.
minid=, maxid=: If htmrev2 is sent with these, there is no need
to calculate htmid2.
file=: A file into which will be written the indices and distances.
When this keyword is sent, no arrays are returned. This is
useful when the match data will not fit into memory.
The file is an unformatted binary file. It can be read with
htm_readbin() and converted to a FITS file with htm_bin2fits
OUTPUTS:
m1,m2: The indices of matches in list 1 and 2.
distance12: The distance between matches in radians.
OPTIONAL OUTPUTS:
status=: 0 is all well, 2 is no matches, 1 (or something else)
is failure.
RESTRICTIONS:
The C++ DLM htmmatchc must be compiled and in your IDL_DLM_PATH
EXAMPLE:
MODIFICATION HISTORY:
Working version: 19-April-2006 Erin Sheldon NYU
(See pro/htm//htm_match.pro)
NAME: htm_readbin PURPOSE: Read a binary output file created by htm_match into a structure. CALLING SEQUENCE: struct = htm_readbin(file, status=) INPUTS: file: The path to a binary file. OPTIONAL OUTPUTS: status: The status: 0 is success. MODIFICATION HISTORY: Created: 2006-08-15 Erin Sheldon, NYU
(See pro/htm//htm_readbin.pro)
NAME:
ID2STRING
PURPOSE:
Function outputs a string containing id of a photo object
in the correct format: length 5 with zero padding.
CALLING SEQUENCE:
result = id2string(id)
INPUTS:
id: may be an array.
REVISION HISTORY:
Author: Erin Scott Sheldon UChicago 25-Feb-2004
Now just use a format string. 2006-10-07, Erin Sheldon, NYU
(See pro/sdss//id2string.pro)
NAME:
idlstruct2fits
PURPOSE:
Convert idlstruct files back and forth from fits files.
CATEGORY:
File I/O
CALLING SEQUENCE:
idlstruct2fits, infiles, outfiles, /reverse, status=
INPUTS:
infiles: idlstruct file name(s).
outfiles: fits file name(s).
KEYWORD PARAMETERS:
/reverse: The infiles are actually a list of fits filenames
and outfiles are a set of idlstruct file names.
OPTIONAL OUTPUTS:
status: 0 for success.
MODIFICATION HISTORY:
Created: 2005, ErinSheldon, UChicago
(See pro/idlstruct_files//idlstruct2fits.pro)
NAME:
IDLSTRUCT_HCLEAN()
PURPOSE:
Remove internal tags from an idlstruct header.
nrows, data_format, byte_order, idlstruct_version,
field_names, field_types, field_descriptions, field_lengthts
field_input_formats
CALLING SEQUENCE:
newhdr = idlstruct_hclean(hdr, status=)
INPUTS:
hdr: An idlstruct header, as read by read_idlheader()
OUTPUTS:
The cleaned header, or -1 of all tags removed.
OPTIONAL OUTPUTS:
status: 0 for success.
MODIFICATION HISTORY:
Created 02-Jul-2004 Erin Sheldon, UofChicago
(See pro/idlstruct_files//idlstruct_hclean.pro)
NAME:
IMPLOT_SETUP
PURPOSE:
Given an image, generate position vectors and xrange/yrange vectors which
can be sent to plot
CATEGORY:
plotting
CALLING SEQUENCE:
implot_setup, image, xsize, ysize, px, py, xrange, yrange, /center
INPUTS:
image: image, dimenstions of which are used to generate display info
KEYWORD PARAMETERS:
/center: center the image
OUTPUTS:
xsize,ysize: size of the image in device units
px,py: position vectors in device units
xrange,yrange: can be sent to xrange/yrange keywords in plot
EXAMPLE:
;; in X-windows
implot_setup, image, xsize, ysize, px, py, xrng, yrng, /center
tv, congrid(image, xsize, ysize),px[0],py[0]
pos = [px[0], py[0], px[1], py[1]]
plot, [0,0], [0,0], xstyle=5, ystyle=5, $
title=title, $
xrange=xrng, yrange=yrng, position=pos,$
/noerase, /device, /nodata
MODIFICATION HISTORY:
2005 Erin Sheldon, NYU
(See pro/plotting//implot_setup.pro)
NAME:
INTFUNC
PURPOSE:
Make a cumulative integral function. Basically just tabulate
the integral up to each xi
CALLING SEQUENCE:
intfunc,f, x [, intfi, plot=plot]
INPUTS:
f: the function
x: the abcissae
KEYWORD PARAMETERS:
/plot: make a plot of the output function
OUTPUTS:
the integrated function.
CALLED ROUTINES:
INT_TABULATED
REVISION HISTORY:
Author: Erin Scott Sheldon UofM 1/??/99
(See pro/util//intfunc.pro)
NAME:
KMAP
CALLING SEQUENCE:
kmap,xin,yin,xout,yout,kx,ky
PURPOSE:
this maps (xin,yin) to (xout,yout)
with the transformation kx,ky
that were presumably found with polywarp
the formula is (summation over i,j)
xout=(kx)ij * xin^j * yin^i
yout=(ky)ij * xin^j * yin^i
hence the two matrices kx and ky hold all the
transformation coefficients
(See pro/util//kmap.pro)
NAME:
KMAP_INV
CALLING SEQUENCE:
kmap_inv,x2,y2,x,y,kx,ky,kxi=kxi,kyi=kyi,npoints=npoints
PURPOSE:
this find the inverse map for kx and ky (any order)
and applies it to x2,y2 to output x,y
note that kx,ky does not in general have an inverse
this procedure only works when the the map kx,ky is
approximately a nonsingular linear transformation
ie. the higher order terms do not dominate the map
it works by first linearizing the map
and finding the inverse matrix and using this to generate
the approximate inverse map range (ie. the domain for kx,ky)
using this range it maps test points to the x2,y2 neighborhood
with kx,ky and uses polwarp on their image under the map kx,ky
to find the right tranformation from x2,y2 to x,y
it then applies this to x2,y2 to get x,y
it then checks for accuracy
then it returns kxi,kyi so that kmap can be used with these
for the inverse map in the future
npoints is the number of points used to find the transformation
if absent it will be set to the smaller of size(x2) or 10,000
(See pro/util//kmap_inv.pro)
NAME: LOGLABELS PURPOSE: Generate nice labels for a log plot. CATEGORY: Plotting CALLING SEQUENCE: This is used with the [xyz]tickformat keyword to plotting routines. e.g. plot, x, y, /xlog, xtickf='loglabels' MODIFICATION HISTORY: Written by Erin Sheldon UofChicago
(See pro/plotting//loglabels.pro)
NAME:
LUMDIST
PURPOSE:
calculate luminosity distance
Currently only works for lambda = 0 universe. See angdist_lambda.
CALLING SEQUENCE:
result = lumdist(z, h=h, omegamat=omegamat, verbose=verbose, $
plot=plot,oplot=oplot)
INPUTS:
z: redshift
OPTIONAL INPUTS:
h: hubble parameter default 1.
omegamat: omega matter default 1.
OUTPUTS:
dist in Mpc.
REVISION HISTORY: Erin Scott Sheldon 2/24/99
(See pro/astro//lumdist.pro)
NAME: lup2flux PURPOSE: convert SDSS luptitudes to flux; this has different conventions than lups2nmgy which gives the expected result for the princeton redux. CATEGORY: SDSS specific routine CALLING SEQUENCE: lup2flux, mag, flux, magerr, fluxerr, b=b INPUTS: mag: magnitude array. Can be either full 5-bandpass array or single. OPTIONAL INPUTS: magerr: err in mags. If there then fluxerr will be returned. b=b: If single bandpass, must be specified with b=0, 1, 2, 3, or 4 OUTPUTS: flux: Linear flux OPTIONAL OUTPUTS: fluxerr: only returned if err is sent. MODIFICATION HISTORY: ??-??-?? Dave Johnston. Translation of Zeljko's SM code
(See pro/sdss//lup2flux.pro)
NAME:
lups2nmgy
PURPOSE:
Convert asinh mags, or luptitudes, to nanomaggies.
CATEGORY:
SDSS
CALLING SEQUENCE:
nmgy = lups2nmgy(lups, lups_err=, band=, ivar=)
INPUTS:
lups: Asinh mags, or luptitudes. May be a scalar or array. If
a [nband,n] array and nband is not 5 then the band= argument
must be sent to specify the bands present.
OPTIONAL INPUTS:
lups_err: The mag errors.
band: The bandpasses present. Default [0,1,2,3,4]
OUTPUTS:
Nanomaggies.
OPTIONAL OUTPUTS:
ivar: Inverse variance of nanomaggies. If lups_err is sent
then ivar may be returned through a named variable.
MODIFICATION HISTORY:
2007-04-?? Erin Sheldon, NYU.
(See pro/sdss//lups2nmgy.pro)
NAME:
makegauss
PURPOSE:
make an array with values set to a gaussian. Assumes center of
pixel is (0,0), same as the adaptive moment code. Note, SDSS
convention is that bottom-left corner is (0,0)
Dave J. My changes E.S.S.
(See pro/util//makegauss.pro)
NAME:
MAKE_CLFLAG_STRUCT
PURPOSE:
Sets up parameter structure for galaxy classification flag selection.
CALLING SEQUENCE:
make_clflag_struct,clflag_struct
INPUTS:
clflag_struct: classification flag structure
REVISION HISTORY: Judith Racusin 6/15/00, modified from make_flag_struct by Tim Mckay
(See pro/classgal//make_clflag_struct.pro)
NAME:
MAKE_CMODEL_COUNTS
PURPOSE:
Create model magnitudes by combining the exponential fit with the
devaucoleur fit using cflux = fracpsf*devflux + (1.0-fracpdf)*expflux
CATEGORY:
SDSS specific routine
CALLING SEQUENCE:
make_cmodel_counts, cat, cmodel, cmodelerr
INPUTS:
cat: must contain these tags:
COUNTS_DEV, COUNTS_DEVERR
COUNTS_EXP, COUNTS_EXPERR
FRACPSF
FLAGS
OUTPUTS:
cmodel, cmodelerr: combined model mags and error
PROCEDURE:
cflux = fracpsf*devflux + (1.0-fracpdf)*expflux
MODIFICATION HISTORY:
??-??-??: Ryan Scranton Pitt
02-Apr-2004: Added /defaults keyword. For bad measurements, just copy in
the default -9999. for measurements and errors.
(See pro/sdss//make_cmodel_counts.pro)
NAME: make_color_flag PURPOSE: takes the str from search color_space and sets the flag depending on whether the object lies in that region of color space (and size-mag space) flag values are anded together they range from 0 to 15 (four different bits may be set depending on whether that object is in each region) objects in all four regions have flag=15 CALLING SEQUENCE: -syntax make_color_flag,cat,str,flag, psfcounts=psfcounts,petrocounts=petrocounts INPUTS: cat : the sdss photo output structure str : the structure output by search_color_space OUTPUTS: flag : the flag arrays, each obejct has a nember 0 to 15 KEYWORDS: psf : if set will use psfcounts rather than the default fibercounts petro : if set will use petrocounts rather than the default fibercounts EXTERNAL CALLS: none METHOD: just extract the value in each region of str.map and sum them see search_color_space for details EXAMPLE NOTES HISTORY: written by David Johnston -University of Chicago Physics Department 1999
(See pro/sdss//make_color_flag.pro)
NAME: MAKE_DEVAUC PURPOSE: Dave Johnston's code. My Changes. E.S.S. This code makes de Vaucouleurs intensity profile, used for elliptal galaxies
(See pro/util//make_devauc.pro)
NAME:
make_exp
PURPOSE:
make an array with values set to an ellitical exponential.
(See pro/util//make_exp.pro)
NAME: MAKE_GAUSSIAN PURPOSE: make an array with a gaussian in it
(See pro/util//make_gaussian.pro)
NAME:
make_rainbow()
PURPOSE:
Return a set of N colors equally spaced along the rainbow. By default
the colors start at the blue end. For X the colors range from a dark
violet to red. For PS they range from black to red. The order of colors
may be reversed with the corresponding keyword.
CALLING SEQUENCE:
colors = make_rainbow(number_of_colors, /reverse)
INPUTS:
number_of_colors: The number of colors to be returned.
KEYWORD PARAMETERS:
/reverse: Normally the colors start from the blue end. If /reverse is
set then they start from the red end.
OUTPUTS:
The colors.
EXAMPLE:
col = make_rainbow(25)
for i=0L, 24 do oplot, x[i,*], y[i,*], color=col[i]
MODIFICATION HISTORY:
Created: 2007-01-23, Erin Sheldon, NYU
(See pro/plotting//make_rainbow.pro)
NAME:
MARKXY
PURPOSE:
Mark the specified x,y point on the current device using one of the
pre-defined marks. These include a cross with a user-defined hole at
the center, a circle, an ellipse, or a box. The details can be all
specified with a mark structure, or by specifying each separately.
CATEGORY:
Plotting
CALLING SEQUENCE:
markxy, markstruct -OR- radius, x, y,
mark_type=,
/cross, hole_fraction=,
/box,
/circle,
/ellipse, axis_ratio=, pos_angle=,
color=, linestyle=, _extra=
INPUTS:
Either of the following formats:
markstruct: a structure defining the mark. Can contain the following:
x, y, radius, mark_type, hole_fraction, axis_ratio, pos_angle,
color, linestyle
radius, x, y: The basics for the mark, with other info being specified
through keywords. These can all be set with a markstruct as well.
OPTIONAL INPUTS:
/cross: Use a cross for the mark (default).
hole_fraction: The size of the hole in the cross as a percentage. Default
is 1/3
/box: Mark the position with a box
/circle: Mark the position with a circle
/ellipse: Mark the position with a ellipse
axis_ratio: axis ratio of ellipse. Default 1.
pos_angle: position angle of ellipse. default is 0.
color=, linestyle=: Style for drawing marks.
_extra: extra stuff sent to plot routine.
EXAMPLES:
IDL> markxy, radius, x, y, /box
IDL> markstruct = {x: 2.5, y: 2.6, type:'circle', color:!red}
IDL> markxy, markstruct
MODIFICATION HISTORY:
Created: sometime in 2005. Documented, andded to archive, 23-Sep-2005.
Erin Sheldon, Uchicago/NYU
(See pro/plotting//markxy.pro)
NAME:
mark_radec
PURPOSE:
Marks an ra and dec position on the current display using the input
mapping structure. The default mark is a cross centered on the
position, with a hole at the center
CALLING SEQUENCE:
mark_radec, mapStruct, radius, ra, dec
INPUTS: mapStruct: Structure containing the info needed to map ra/dec to x-y
position. The map structure is created using the CREATE_PHOTOMAP
procedure. procedure.
radius: radius of the mark in data coordinates.
ra, dec: the ra and dec to be circled.
INPUT KEYWORD PARAMETERS:
/cross: use a cross to mark the ra/dec.
hole_fraction: leave a central hole in the cross with this fraction
of radius.
/box: use a box instead of a circle. radius will be side of box.
/ellipse: use an ellipse. Largest side of ellipse is set to radius.
axis_ratio: The axis ratio of the ellipse
pos_angle: position angle of ellipse in degrees.
order=: order=0 (default) means images was plotted 0,0 in bottom
left, order=1 is top left. Note objx,objy
is still given in the original coord. system. User must input
ny for the transformation.
ny=: number of pixels in the y-direction.
/silent: Shut off the messages except errors.
OUTPUTS: A mark is drawn on the current device.
EXAMPLE:
map_order = 1
create_photomap, $
map_order, $
pstruct.ra, pstruct.dec, pstruct.rowc[2], pstruct.colc[2], mapStruct
;.....plot some image
xoffset = objx - pstruct[id].colc[2]
yoffset = objy - pstruct[id].rowc[2]
mark_radec, mapStruct, ra, dec, 30.0, $
/cross, holeradius = 10.0, $
xoffset=xoffset, yoffset=yoffset
CALLED ROUTINES:
CREATE_PHOTOMAP
TVCIRCLE
TVBOX
PLOT_CROSS
REVISION HISTORY:
Author: Erin Scott Sheldon UChicago 18-Oct-2004
(See pro/sdss//mark_radec.pro)
NAME:
match_dup
PURPOSE:
Find the matching elements of two arrays of integers (arr1 and arr2),
each of which may have duplicates. Unlike the match.pro program,
match arrays (match1 and match2) may not correspond directly
due to the possibility of duplicates. However, one can use the
reverse_indices arrays to find that correspondence (if /SORT is not set)
CALLING SEQUENCE:
match_dup, arr1, arr2, match1, match2, $
numlist1=, h1=, reverse_indices1=, $
numlist2=, h2=, reverse_indices2=, $
/SORT
INPUTS:
arr1: integer array which may contain duplicates.
arr2: integer array which may contain duplicates.
KEYWORD PARAMETERS:
/sort: use a sorting algorithm to find matches instead of histogram.
This is generally slower (~factor of 2), but may be better for sparse
arrays containing large integers, which may cause memory
problems for histogram. numlist, h, and rev_arr are not available
when this keywod is set.
OUTPUTS:
match1: match indices for first array.
match2: match indices for second array.
OPTIONAL OUTPUTS:
** these only returned if n_elements(arr1) gt 1 and
** n_elements(arr2) gt 1, and the /SORT keyword is not set
numlist1: Total num. of matches for each unique element that
matched
h1: the histogram of arr1 in intersection(arr1,arr2)
reverse_indices1=reverse_indices1: the reverse indices from the
histogram function on arr1
** same for arr2
CALLED ROUTINES:
histogram
match
uniq
REVISION HISTORY:
29-May-2002: Erin Scott Sheldon UofMich in IDL v5.2
(See pro/util//match_dup.pro)
NAME:
match_multi
PURPOSE:
Find the elements of an array of integers (arr2, which may contain
duplicates) which have a match in another array (arr1, which may not
contain duplicates).
CALLING SEQUENCE:
match_multi, arr1, arr2, match2, numlist=, hist=, $
match1=, dupmatch1=, reverse_indices=
INPUTS:
arr1: integer array containing unique integers
arr2: integer array which may contain duplicates.
OUTPUTS:
match2: match indices. The indices of the second list that have matches
in the first.
OPTIONAL OUTPUTS:
numlist: the number that matched each element in arr1
hist: the histogram of arr2, for numbers 0 to max(arr1)
reverse_indices: the reverse indices from the histogram function on arr2
match1: The array of match indices from array 1. This may not be the same
length as the match array for array 2. See dupmatch1 for that.
dupmatch1: An array of matches from array 1 that correspond direclty
to all matches from array2. E.g.
arr1 = [0,2,3,5,6]
arr2 = [2,3,3,4,5,6,6,7]
match_multi, arr1, arr2, m2, match1=m1, dupmatch1=dm1
1 0
2 1
2 2
3 4
4 5
4 6
CALLED ROUTINES:
histogram
PROCEDURE:
see code
REVISION HISTORY:
Jun-18-2002: Erin Scott Sheldon UofMich
Adapted from the old match2rand program
(See pro/util//match_multi.pro)
NAME:
methods
PURPOSE:
Display a list of methods for the input IDL class.
CALLING SEQUENCE:
methods, classname, grepfor=
INPUTS:
classname: The class name in string form.
OPTIONAL INPUTS:
grepfor: A string to grep for in the list of methods.
Only lines that match the patter will be displayed.
EXAMPLE:
IDL> methods, 'postgres'
MODIFICATION HISTORY:
Created: 2006, Erin Sheldon, NYU
(See pro/files//methods.pro)
NAME:
mfact
PURPOSE:
find the factorial of each element in an array.
CALLING SEQUENCE:
result = mfact(array)
INPUTS:
array (of numbers)
OUTPUTS:
farray: the array of factorials.
REVISION HISTORY:
Author: Erin Scott Sheldon UofM 5/??/98
(See pro/util//mfact.pro)
NAME: MKSTR PURPOSE: Make a string of a give length. Default is an empty string, but a value can be sent. Can optionally make string arrays. CATEGORY: String manipulation. CALLING SEQUENCE: str = mkstr(len [, d1, ..., d8, val=) INPUTS: len: The length of of the string. OPTIONAL INPUTS: d1...d8: The size of up to 8 dimensions (IDL's limit). KEYWORD PARAMETERS: val=: The value of each string element. By default it is a space ' '. OUTPUTS: The string. MODIFICATION HISTORY: Created 24-May-2005. Author Erin Sheldon UofChicago
(See pro/util//mkstr.pro)
NAME:
MOM2SEEING
PURPOSE:
Take the adaptive moments of the psf and convert this a "seeing" value
or FWHM assumes the psf is Gaussian
CALLING SEQUENCE:
mom2seeing, mom, seeing
MODIFICATION HISTORY:
Creation: ??-??-?? Dave Johnston, UofChicago
(See pro/astro//mom2seeing.pro)
NAME:
MRDFITS3
PURPOSE:
Read all standard FITS data types into arrays or structures.
EXPLANATION:
Further information on MRDFITS is available at
http://idlastro.gsfc.nasa.gov/mrdfits.html
CALLING SEQUENCE:
Result = MRDFITS3( fileunit,[Extension, Oldextension, Header],
/deja_vu,
/FSCALE , /DSCALE , /USE_COLNUM, /NO_TDIM,
RANGE=[a,b], Columns=[a,b,...]), error_action=x
INPUTS:
Fileunit = Unit of opened file. Position in file will be saved
after call.
Extension= Extension number to be read, 0 for primary array.
Assumed 0 if not specified.
Oldextension= the previous extension position.
OUTPUTS:
Result = FITS data array or structure constructed from
the designated extension. The format of result depends
upon the type of FITS data read.
Non-group primary array or IMAGE extension:
A simple multidimensional array is returned with the
dimensions given in the NAXISn keywords.
Grouped image data with PCOUNT=0.
As above but with GCOUNT treated as NAXIS(n+1).
Grouped image data with PCOUNT>0.
The data is returned as an array of structures. Each
structure has two elements. The first is a one-dimensional
array of the group parameters, the second is a multidimensional
array as given by the NAXIS2-n keywords.
ASCII and BINARY tables.
The data is returned as a structure with one column for
each field in the table. The names of the columns are
normally taken from the TTYPE keywords (but see USE_COLNUM).
Bit field columns
are stored in byte arrays of the minimum necessary
length. Column names are truncated to 15 characters
if longer, spaces are removed, and invalid characters
are replaced by underscores.
Columns specified as variable length columns are stored
with a dimension equal to the largest actual dimension
used. Extra values in rows are filled with 0's or blanks.
If the size of the variable length column is not
a constant, then an additional column is created
giving the size used in the current row. If the length
of each element of a variable length column is 0 then
the column is deleted.
For FITS files with more than 127 columns, data in the first
64 elements of the structure are stored in the primary
structure, the next 64 as a substructure of the 65th
element, the next 64 as a substructure of the 66th element
and so forth.
OPTIONAL OUTPUT:
Header = String array containing the header from the FITS extenion.
OPTIONAL INPUT KEYWORDS:
DEJA_VU: if set, mrdfits3 reads into the previously defined
struct. Saves much time when mrdfits3 is called repeatedly
to read from files that all have the same structure.
FSCALE - If present and non-zero then scale data to float
numbers for arrays and columns which have either
non-zero offset or non-unity scale.
If scaling parameters are applied, then the corresponding
FITS scaling keywords will be modified.
DSCALE - As with FSCALE except that the resulting data is
stored in doubles.
SILENT - Suppress informative messages.
RANGE - A scalar or two element vector giving the start
and end rows to be retrieved. For ASCII and BINARY
tables this specifies the row number. For GROUPed data
this will specify the groups. For array images, this
refers to the last non-unity index in the array. E.g.,
for a 3 D image with NAXIS* values = [100,100,1], the
range may be specified as 0:99, since the last axis
is suppressed. Note that the range uses IDL indexing
So that the first row is row 0.
If only a single value, x, is given in the range,
the range is assumed to be [0,x-1].
USE_COLNUM - When creating column names for binary and ASCII tables
MRDFITS attempts to use the appropriate TTYPE keyword
values. If USE_COLNUM is specified and non-zero then
column names will be generated as 'C1, C2, ... 'Cn'
for the number of columns in the table.
STRUCTYP - The structyp keyword specifies the name to be used
for the structure defined when reading ASCII or binary
tables. Generally users will not be able to conveniently
combine data from multiple files unless the STRUCTYP
parameter is specified. An error will occur if the
user specifies the same value for the STRUCTYP keyword
in calls to MRDFITS in the same IDL session for extensions
which have different structures.
NO_TDIM - Disable processing of TDIM keywords. If NO_TDIM
is specified MRDFITS will ignore TDIM keywords in
binary tables.
TEMPDIR - The tempdir keyword allows the user to specify
the directory where temporary files may be created.
This directory should be both in the IDL path
and writable by the user.
COLUMNS - This keyword allows the user to specify that only a
subset of columns is to be returned. The columns
may be specified either as number 1,... n or by
name. (If USE_COLNUM is specified this should be C1,...Cn)
The use of this keyword will not save time or internal
memory since the extraction of specified columns
is done after all columns have been retrieved from the
FITS file.
ERROR_ACTION - Set the on_error action to this value (defaults
to 2).
EXAMPLE:
Read a FITS primary array:
a = mrdfits('TEST.FITS') or
a = mrdfits('TEST.FITS', 0, header)
The second example also retrieves header information.
Read rows 10-100 of the second extension of a FITS file.
a = mrdfits('TEST.FITS', 2, header, range=[10,100])
Read a table and ask that any scalings be applied and the
scaled data be converted to doubles. Use simple column names,
suppress outputs.
a = mrdfits('TEST.FITS', 1, /dscale, /use_colnum, /silent)
RESTRICTIONS:
(1) Cannot handle data in non-standard FITS formats.
(2) Doesn't do anything with BLANK or NULL values or
NaN's. They are just read in. They may be scaled
if scaling is applied.
NOTES:
This multiple format FITS reader is designed to provide a
single, simple interface to reading all common types of FITS data.
MRDFITS DOES NOT scale data by default. The FSCALE or DSCALE
parameters must be used.
PROCEDURES USED:
The following procedures are contained in the main MRDFITS program.
MRD_IMAGE -- Generate array/structure for images.
MRD_READ_IMAGE -- Read image data.
MRD_ASCII -- Generate structure for ASCII tables.
MRD_READ_ASCII -- Read an ASCII table.
MRD_TABLE -- Generate structure for Binary tables.
MRD_READ_TABLE -- Read binary table info.
MRD_READ_HEAP -- Read variable length record info.
MRD_SCALE -- Apply scaling to data.
MRD_COLUMNS -- Extract columns.
Other ASTRON Library routines used:
FXPAR(), FXADDPAR, IEEE_TO_HOST, FXPOSIT, IS_IEEE_BIG()
MRD_STRUCT(), MRD_SKIP
MODIfICATION HISTORY:
V1.0 November 9, 1994 ---- Initial release.
Creator: Thomas A. McGlynn
V1.1 January 20, 1995 T.A. McGlynn
Fixed bug in variable length records.
Added TDIM support -- new routine mrd_tdim in MRD_TABLE.
V1.2
Added support for dynamic decompression of files.
Fixed further bugs in variable length record handling.
V1.2a
Added NO_TDIM keyword to turn off TDIM processing for
those who don't want it.
Bug fixes: Handle one row tables correctly, use BZERO rather than
BOFFSET. Fix error in scaling of images.
V1.2b
Changed MRD_HREAD to handle null characters in headers.
V2.0 April 1, 1996
-Handles FITS tables with an arbitrary number of columns.
-Substantial changes to MRD_STRUCT to allow the use of
substructures when more than 127 columns are desired.
-All references to table columns are now made through the
functions MRD_GETC and MRD_PUTC. See description above.
-Use of SILENT will now eliminate compilation messages for
temporary functions.
-Bugs in handling of variable length columns with either
a single row in the table or a maximum of a single element
in the column fixed.
-Added support for DCOMPLEX numbers in binary tables (M formats) for
IDL versions above 4.0.
-Created regression test procedure to check in new versions.
-Added error_action parameter to allow user to specify
on_error action. This should allow better interaction with
new CHECK facility. ON_ERROR statements deleted from
most called routines.
- Modified MRDFITS to read in headers containing null characters
with a warning message printed.
V2.0a April 16, 1996
- Added IS_IEEE_BIG() checks (and routine) so that we don't
worry about IEEE to host conversions if the machine's native
format is IEEE Big-endian.
V2.1 August 24, 1996
- Use resolve_routine for dynamically defined functions
for versions > 4.0
- Fix some processing in random groups format.
- Handle cases where the data segment is--legally--null.
In this case MRDFITS returns a scalar 0.
- Fix bugs with the values for BSCALE and BZERO (and PSCAL and
PZERO) parameters set by MRDFITS.
V2.1a April 24, 1997 Handle binary tables with zero length columns
V2.1b May 13,1997 Remove whitespace from replicate structure definition
V2.1c May 28,1997 Less strict parsing of XTENSION keyword
V2.1d June 16, 1997 Fixed problem for >32767 entries introduced 24-Apr
V2.1e Aug 12, 1997 Fixed problem handling double complex arrays
V2.1f Oct 22, 1997 IDL reserved words can't be structure tag names
Converted to IDL V5.0 W. Landsman 2-Nov-1997
Modified by Phil Fisher from MRDFITS
Modified by Dave Johnston from MRDFITS2
Changed all sub-programs to end in *3 so they will not conflict
with new versions. Erin Scott Sheldon
(See pro/fits//mrdfits3.pro)
NAME:
MRDFITS_MULTI
PURPOSE:
Read binary tables from multiple FITS files using mrdfits. Return
a single structure containing all data.
CALLING SEQUENCE:
struct = mrdfits_multi(files, $
extension=, $
/diff, $
columns=, $
/unsigned=, $
/compress, $
count=, $
/silent, $
error_action=, $
status=)
INPUTS:
files: A set of fits file names.
OPTIONAL INPUTS:
extension=: the extension to read from each file. Default is 1.
columns: The columns to read.
KEYWORD PARAMETERS:
/diff: This informs that the structures from each file may be different. A
slower but safer method is used that defines the output structure
based upon the first file and just copies the matching tags
afterward.
/unsigned,/compress, /silent, error_action=, status=: See mrdfits
OUTPUTS:
Combined structure.
OPTIONAL OUTPUTS:
count: the total count of rows read.
MODIFICATION HISTORY:
Author: Erin Sheldon, NYU
Documented: 2006-July-21. E.S.
(See pro/fits//mrdfits_multi.pro)
NAME:
MRDFITS__DEFINE
PURPOSE:
Read all standard FITS data types into arrays or structures. This is a
version that is methods so we can access some of the routines outside of
mrdfits.
EXPLANATION:
Further information on MRDFITS is available at
http://idlastro.gsfc.nasa.gov/mrdfits.html
CALLING SEQUENCE:
Result = MRDFITS( Filename/FileUnit,[Extension, Header],
/FSCALE , /DSCALE , /UNSIGNED,
ALIAS=strarr[2,n], /USE_COLNUM,
/NO_TDIM, ROWS = [a,b,...], $
/POINTER_VAR, /FIXED_VAR,
RANGE=[a,b], COLUMNS=[a,b,...]), ERROR_ACTION=x,
COMPRESS=comp_prog, STATUS=status, /VERSION )
INPUTS:
Filename = String containing the name of the file to be read or
file number of an open unit. If a unit is specified
if will be left open positioned to read the next HDU.
Note that the file name may be of the form
name.gz or name.Z on UNIX systems. If so
the file will be dynamically decompressed.
FiluUnit = An integer file unit which has already been
opened for input. Data will be read from this
unit and the unit will be left pointing immediately
after the HDU that is read. Thus to read a compressed
file with many HDU's a user might do something like:
lun=fxposit(filename, 3) ; Skip the first three HDU's
repeat begin
thisHDU = mrdfits(lun, 0, hdr, status=status)
... process the HDU ...
endrep until status lt 0
Extension= Extension number to be read, 0 for primary array.
Assumed 0 if not specified.
If a unit rather than a filename
is specified in the first argument, this is
the number of HDU's to skip from the current position.
OUTPUTS:
Result = FITS data array or structure constructed from
the designated extension. The format of result depends
upon the type of FITS data read.
Non-group primary array or IMAGE extension:
A simple multidimensional array is returned with the
dimensions given in the NAXISn keywords.
Grouped image data with PCOUNT=0.
As above but with GCOUNT treated as NAXIS(n+1).
Grouped image data with PCOUNT>0.
The data is returned as an array of structures. Each
structure has two elements. The first is a one-dimensional
array of the group parameters, the second is a multidimensional
array as given by the NAXIS2-n keywords.
ASCII and BINARY tables.
The data is returned as a structure with one column for
each field in the table. The names of the columns are
normally taken from the TTYPE keywords (but see USE_COLNUM).
Bit field columns
are stored in byte arrays of the minimum necessary
length. Spaces and invalid characters are replaced by
underscores, and other invalid tag names are converted using
the IDL_VALIDNAME(/CONVERT_ALL) function.
Columns specified as variable length columns are stored
with a dimension equal to the largest actual dimension
used. Extra values in rows are filled with 0's or blanks.
If the size of the variable length column is not
a constant, then an additional column is created giving the
size used in the current row. This additional column will
have a tag name of the form L#_"colname" where # is the column
number and colname is the column name of the variable length
column. If the length of each element of a variable length
column is 0 then the column is deleted.
OPTIONAL OUTPUT:
Header = String array containing the header from the FITS extension.
OPTIONAL INPUT KEYWORDS:
ALIAS The keyword allows the user to specify the column names
to be created when reading FITS data. The value of
this keyword should be a 2xn string array. The first
value of each pair of strings should be the desired
tag name for the IDL column. The second should be
the FITS TTYPE value. Note that there are restrictions
on valid tag names. The order of the ALIAS keyword
is compatible with MWRFITS.
COLUMNS - This keyword allows the user to specify that only a
subset of columns is to be returned. The columns
may be specified either as number 1,... n or by
name or some combination of these two.
If USE_COLNUM is specified names should be C1,...Cn.
The use of this keyword will not save time or internal
memory since the extraction of specified columns
is done after all columns have been retrieved from the
FITS file.
COMPRESS - This keyword allows the user to specify a
decompression program to use to decompress a file that
will not be automatically recognized based upon
the file name.
/DSCALE - As with FSCALE except that the resulting data is
stored in doubles.
ERROR_ACTION - Set the on_error action to this value (defaults
to 2).
/FIXED_VAR- Translate variable length columns into fixed length columns
and provide a length column for truly varying columns.
This was only behavior prior to V2.5 for MRDFITS and remains
the default (see /POINTER_VAR)
/FSCALE - If present and non-zero then scale data to float
numbers for arrays and columns which have either
non-zero offset or non-unity scale.
If scaling parameters are applied, then the corresponding
FITS scaling keywords will be modified.
NO_TDIM - Disable processing of TDIM keywords. If NO_TDIM
is specified MRDFITS will ignore TDIM keywords in
binary tables.
/POINTER_VAR- Use pointer arrays for variable length columns.
In addition to changing the format in which
variable length arrays are stored, if the pointer_var
keyword is set to any value other than 1 this also disables
the deletion of variable length columns. (See /FIXED_VAR)
Note that because pointers may be present in the output
structure, the user is responsible for memory management
when deleting or reassigning the structure (e.g. use HEAP_FREE
first).
RANGE - A scalar or two element vector giving the start
and end rows to be retrieved. For ASCII and BINARY
tables this specifies the row number. For GROUPed data
this will specify the groups. For array images, this
refers to the last non-unity index in the array. E.g.,
for a 3 D image with NAXIS* values = [100,100,1], the
range may be specified as 0:99, since the last axis
is suppressed. Note that the range uses IDL indexing
So that the first row is row 0.
If only a single value, x, is given in the range,
the range is assumed to be [0,x-1].
ROWS - A scalar or vector specifying a specific row or rows to read
(first row is 0). For example to read rows 0,
12 and 23 only, set ROWS=[0,12,23]. Valid for images, ASCII
and binary tables, but not GROUPed data. For images
the row numbers refer to the last non-unity index in the array.
Cannot be used at the same time as the RANGE keyword
/SILENT - Suppress informative messages.
STRUCTYP - The structyp keyword specifies the name to be used
for the structure defined when reading ASCII or binary
tables. Generally users will not be able to conveniently
combine data from multiple files unless the STRUCTYP
parameter is specified. An error will occur if the
user specifies the same value for the STRUCTYP keyword
in calls to MRDFITS in the same IDL session for extensions
which have different structures.
/UNSIGNED - For integer data with appropriate zero points and scales
read the data into unsigned integer arrays.
/USE_COLNUM - When creating column names for binary and ASCII tables
MRDFITS attempts to use the appropriate TTYPE keyword
values. If USE_COLNUM is specified and non-zero then
column names will be generated as 'C1, C2, ... 'Cn'
for the number of columns in the table.
/VERSION Print the current version number
OPTIONAL OUTPUT KEYWORDS:
STATUS - A integer status indicating success or failure of
the request. A status of >=0 indicates a successful read.
Currently
0 -> successful completion
-1 -> error
-2 -> end of file
EXAMPLES:
(1) Read a FITS primary array:
a = mrdfits('TEST.FITS') or
a = mrdfits('TEST.FITS', 0, header)
The second example also retrieves header information.
(2) Read rows 10-100 of the second extension of a FITS file.
a = mrdfits('TEST.FITS', 2, header, range=[10,100])
(3) Read a table and ask that any scalings be applied and the
scaled data be converted to doubles. Use simple column names,
suppress outputs.
a = mrdfits('TEST.FITS', 1, /dscale, /use_colnum, /silent)
(4) Read rows 3, 34 and 52 of a binary table and request that
variable length columns be stored as a pointer variable in the
output structure
a = mrdfits('TEST.FITS',1,rows=[3,34,52],/POINTER)
RESTRICTIONS:
(1) Cannot handle data in non-standard FITS formats.
(2) Doesn't do anything with BLANK or NULL values or
NaN's. They are just read in. They may be scaled
if scaling is applied.
NOTES:
This multiple format FITS reader is designed to provide a
single, simple interface to reading all common types of FITS data.
MRDFITS DOES NOT scale data by default. The FSCALE or DSCALE
parameters must be used.
As of version 2.5 MRDFITS support 64 bit integer data types.
These are not standard FITS. 64 bit data also requires
IDL version 5.2 or greater.
PROCEDURES USED:
The following procedures are contained in the main MRDFITS program.
MRD_IMAGE -- Generate array/structure for images.
MRD_READ_IMAGE -- Read image data.
MRD_ASCII -- Generate structure for ASCII tables.
MRD_READ_ASCII -- Read an ASCII table.
MRD_TABLE -- Generate structure for Binary tables.
MRD_READ_TABLE -- Read binary table info.
MRD_READ_HEAP -- Read variable length record info.
MRD_SCALE -- Apply scaling to data.
MRD_COLUMNS -- Extract columns.
Other ASTRON Library routines used
FXPAR(), FXADDPAR, IEEE_TO_HOST, FXPOSIT, FXMOVE(), IS_IEEE_BIG()
MRD_STRUCT(), MRD_SKIP
MODIfICATION HISTORY:
V1.0 November 9, 1994 ---- Initial release.
Creator: Thomas A. McGlynn
V1.1 January 20, 1995 T.A. McGlynn
Fixed bug in variable length records.
Added TDIM support -- new routine mrd_tdim in MRD_TABLE.
V1.2
Added support for dynamic decompression of files.
Fixed further bugs in variable length record handling.
V1.2a
Added NO_TDIM keyword to turn off TDIM processing for
those who don't want it.
Bug fixes: Handle one row tables correctly, use BZERO rather than
BOFFSET. Fix error in scaling of images.
V1.2b
Changed MRD_HREAD to handle null characters in headers.
V2.0 April 1, 1996
-Handles FITS tables with an arbitrary number of columns.
-Substantial changes to MRD_STRUCT to allow the use of
substructures when more than 127 columns are desired.
-All references to table columns are now made through the
functions MRD_GETC and MRD_PUTC. See description above.
-Use of SILENT will now eliminate compilation messages for
temporary functions.
-Bugs in handling of variable length columns with either
a single row in the table or a maximum of a single element
in the column fixed.
-Added support for DCOMPLEX numbers in binary tables (M formats) for
IDL versions above 4.0.
-Created regression test procedure to check in new versions.
-Added error_action parameter to allow user to specify
on_error action. This should allow better interaction with
new CHECK facility. ON_ERROR statements deleted from
most called routines.
- Modified MRDFITS to read in headers containing null characters
with a warning message printed.
V2.0a April 16, 1996
- Added IS_IEEE_BIG() checks (and routine) so that we don't
worry about IEEE to host conversions if the machine's native
format is IEEE Big-endian.
V2.1 August 24, 1996
- Use resolve_routine for dynamically defined functions
for versions > 4.0
- Fix some processing in random groups format.
- Handle cases where the data segment is--legally--null.
In this case MRDFITS returns a scalar 0.
- Fix bugs with the values for BSCALE and BZERO (and PSCAL and
PZERO) parameters set by MRDFITS.
V2.1a April 24, 1997 Handle binary tables with zero length columns
V2.1b May 13,1997 Remove whitespace from replicate structure definition
V2.1c May 28,1997 Less strict parsing of XTENSION keyword
V2.1d June 16, 1997 Fixed problem for >32767 entries introduced 24-Apr
V2.1e Aug 12, 1997 Fixed problem handling double complex arrays
V2.1f Oct 22, 1997 IDL reserved words can't be structure tag names
Converted to IDL V5.0 W. Landsman 2-Nov-1997
V2.1g Nov 24, 1997 Handle XTENSION keywords with extra blanks.
V2.1h Jul 26, 1998 More flexible parsing of TFORM characters
V2.2 Dec 14, 1998 Allow fields with longer names for
later versions of IDL.
Fix handling of arrays in scaling routines.
Allow >128 fields in structures for IDL >4.0
Use more efficient structure copying for
IDL>5.0
V2.2b June 17, 1999 Fix bug in handling case where
all variable length columns are deleted
because they are empty.
V2.3 March 7, 2000 Allow user to supply file handle rather
than file name.
Added status field.
Now needs FXMOVE routine
V2.3b April 4, 2000
Added compress option (from D. Palmer)
V2.4 July 4, 2000 Added STATUS=-1 for "File access error" (Zarro/GSFC)
V2.4a May 2, 2001 Trim binary format string (W. Landsman)
V2.5 December 5, 2001 Add unsigned, alias, 64 bit integers. version, $
/pointer_val, /fixed_var.
V2.5a Fix problem when both the first and the last character
in a TTYPEnn value are invalid structure tag characters
V2.6 February 15, 2002 Fix error in handling unsigned numbers, $
and 64 bit unsigneds. (Thanks to Stephane Beland)
V2.6a September 2, 2002 Fix possible conflicting data structure for
variable length arrays (W. Landsman)
V2.7 July, 2003 Added Rows keyword (W. Landsman)
V2.7a September 2003 Convert dimensions to long64 to handle huge files
V2.8 October 2003 Use IDL_VALIDNAME() function to ensure valid tag names
Removed OLD_STRUCT and TEMPDIR keywords W. Landsman
V2.9 February 2004 Added internal MRD_FXPAR procedure for faster
processing of binary table headers E. Sheldon
V2.9a March 2004 Restore ability to read empty binary table W. Landsman
Swallow binary tables with more columns than given in TFIELDS
V2.9b Fix to ensure order of TFORMn doesn't matter
V2.9c Check if extra degenerate NAXISn keyword are present W.L. Oct 2004
V2.9d Propagate /SILENT to MRD_HREAD, more LONG64 casting W. L. Dec 2004
V2.9e Add typarr[good] to fix a problem reading zero-length columns
A.Csillaghy, csillag@ssl.berkeley.edu (RHESSI)
V2.9f Fix problem with string variable binary tables, possible math
overflow on non-IEEE machines WL Feb. 2005
V2.9g Fix problem when setting /USE_COLNUM WL Feb. 2005
(See pro/fits//mrdfits__define.pro)
Name:
multiplot
Purpose:
Create multiple plots with simple control over the gaps between plots.
By default, the gap is zero but this can be set with the
gap= keyword, or xgap=, ygap= for individual control over different axes.
You can also place a single title along the x, y and top axes of the
matrix of plots using the mtitle, mxtitle and mytitle keywords.
It is good for data with one or two shared axes and retains all the
versatility of the plot commands (e.g. all keywords and log scaling).
The plots are connected with the shared axes, which saves space by
omitting redundant ticklabels and titles. Multiplot does this by
setting !p.position, !x.tickname and !y.tickname automatically.
A call (multiplot,/reset) restores original values.
CALLING SEQUENCE:
multiplot, pmulti,
gap=, xgap=, ygap=,
/square,
/doxaxis, /doyaxis,
mTitle=, mTitSize=, mTitOffset=,
mxTitle=, mxTitSize=, mxTitOffset=,
myTitle=, myTitSize=, myTitOffset=,
xtickformat=, ytickformat=
/default, /reset, /rowmajor, /initialize
INPUTS:
pmulti: Optional input. [Nx,Ny] array describing the shape of the
matrix of plots. This is equivalent to the 2nd and 3rd elements
of !p.multi. Or you can send all 5 elements of the !p.multi.
KEYWORD INPUTS:
gap=: Set the gap between plots in normalized units. Default is 0.
This input overrides the xgap and ygap inputs.
xgap=: Gap between plots in the x direction. Default 0. To set both
x and y gap to the same value just use the gap keyword.
ygap=: Gap between plots in the y direction. Default 0. To set both
x and y gap to the same value just use the gap keyword.
mTitle: A single title to go across the top of the matrix of plots,
as opposed to the plot over single plots you generate with the
plot command for example.
mTitSize: The font size of the top title. Default is 1.25*!p.charsize
mTitOffset: Offset of the title in the y-direction.
mxTitle, mxTitSize, mxTitOffset: same as above but for the x-axis title
myTitle, myTitSize, myTitOffset: same as above but for the y-axis title
xtickformat, ytickformat: Set the default tick formats when the ticks
are plotted. This allows the user to avoid sending this to each
plotting command which can have unexpected results if that axis
was not to get tick labels in a given point in the matrix.
KEYWORDS SWITCHES:
/square: Force the axis ratio of each plot to be square. Note if
xgap and ygap are set to different values, this axis ratio will
not be preserved. It will be preserved if gap= is used.
/doxaxis: Put axis labels, etc on the axis. Default is to place labels
only on the left side and bottom sides of the plot matrix, but may
be useful when some cells are empty; for example the x-axis of
a 2x2 grid when only 3 total plots will be created.
/doyaxis: Put axis labels, etc on the yxis. Default is to place labels
only on the left side and bottom sides of the plot matrix, but may
be useful when some cells are empty; for example the x-axis of
a 2x2 grid when only 3 total plots will be created.
/rowmajor: Like setting 5th element of !p.multi to 1.
/reset: Set plotting parameters to their saved values from before
multiplot was initially called.
/default: Set plotting parameters to IDL defaults. This is useful
when the saved parameters get in a whacky state.
/initialize: Just do the initialization. This is what happends when
you first call multiplot anyway.
EXAMPLES:
; Make an array of plots [4,3] with a gap of 0.1 (in norm. coords.)
; and overall titles along the x and y axes as given. Force the
; plots to be square.
erase & multiplot, [4,3], /square, gap=0.1, mXtitle='R', mYtitle='F(R)'
for i=0,4*3-1 do begin
plot, struct[i].x, struct[i].y, psym=4
multiplot
endfor
multiplot,/reset
Side Effects:
Multiplot sets a number of system variables: !p.position, !p.multi,
!x.tickname, !y.tickname, !P.noerase---but all can be reset with
the call: multiplot,/reset
Things can get out of wack if your program crashes in the middle of
making a matrix of plots, and often /reset will not fix it. In those
cases, calling multiplot,/default will often fix the problem.
Restrictions:
1. If you use !p.multi as the method of telling how many plots
are present, you have to set !p.multi at the beginning each time you
use multiplot or call multiplot with the /reset keyword.
2. There is no way to make plots of different sizes; each plot
covers the same area on the screen or paper.
Modification history:
write, 21-23 Mar 94, Fred Knight (knight@ll.mit.edu)
alter plot command that sets !x.window, etc. per suggestion of
Mark Hadfield (hadfield@storm.greta.cri.nz), 7 Apr 94, FKK
add a /default keyword restore IDL's default values of system vars,
7 Apr 94, FKK
modify two more sys vars !x(y).tickformat to suppress user-formatted
ticknames, per suggestion of Mark Hadfield (qv), 8 Apr 94, FKK
Converted to IDL V5.0 W. Landsman September 1997
2001-03-20 Added /square keyword
Work in device coordinates so we can force aspect ratio to be square
if requested. Erin Scott Sheldon UMichigan
2007-06-18
Can now place titles on the overall x and y axes, as well as a
top title using these new keywords.
mTitle=, mTitSize=, mTitOffset=,
mxTitle=, mxTitSize=, mxTitOffset=,
myTitle=, myTitSize=, myTitOffset=,
Can also control overall tick formats. Useful because can just call
multiplot initially and set this, while calling on each call to
the plotting program will have unexpected results if the ticks
are not to be labelled for that place in the matrix.
xtickformat, ytickformat
Erin Sheldon, NYU
2007-08-28:
Can now add gaps between the plots with these keywords:
gap=, xgap=, ygap=
where the values are in normalized coordinates. Erin Sheldon, NYU
(See pro/plotting//multiplot.pro)
NAME:
munu2rowcol
PURPOSE:
convert from great circle coordinates to row/col, ignoring higher
order terms in the transformation. Good to .1 pixels or so
CALLING SEQUENCE:
munu2rowcol, trans, field, mu, nu, row, col, ri=, /nonlinear, status=
INPUTS:
trans: the astrans file for this run,camcol,bandpass. Use
READ_ASTRANS to get the astrans file.
field: the field
mu,nu: great circle coordinates
Optional Inputs:
ri=: the r-i color used in color term of transform
/nonlinear: use a non-linear transform.
OUTPUTS:
row,col: row/col in the bandpass of the trans structure
OPTIONAL OUTPUTS:
status: 1 for success, 0 for failure
REVISION HISTORY:
15-AUG-2002 Creation. Erin Scott Sheldon UofMich
(See pro/sdss//munu2rowcol.pro)
NAME:
nmgy2lups
PURPOSE:
Convert flux in nanomaggies to asinh mags, or luptitudes.
CATEGORY:
SDSS
CALLING SEQUENCE:
lups = nmgy2lups(nmgy, ivar=, band=, lups_err=)
INPUTS:
nmgy: Flux in nanomaggies. May be a scalar or array. If
a [nband,n] array and nband is not 5 then the band= argument
must be sent to specify the bands present. There some ambiguity
when the input is an array of 5 and band is not sent. The code
assumes this is 5-band input for a single object.
OPTIONAL INPUTS:
ivar: The inverse variance of the flux, same shape as nmgy.
band: The bandpasses present. Default [0,1,2,3,4]
OUTPUTS:
Asinh mags, or luptitudes.
OPTIONAL OUTPUTS:
lups_err: If ivar is sent then lups_err may be returned through
a named variable.
EXAMPLE:
st = pgsql_query('select * from datasweep limit 1000')
lups = nmgy2lups(st.modelflux)
MODIFICATION HISTORY:
2007-04-?? Erin Sheldon, NYU. Got much from Blanton's maggies2lups
but added some extra functionality, error handling, and units of
nanomaggies.
(See pro/sdss//nmgy2lups.pro)
NAME:
ntostr
PURPOSE:
Convert a number to a string. Cuts off white spaces.
CALLING SEQUENCE:
result = ntostr(num, format=)
INPUTS:
num: the object to be converted. May be an array.
OPTIONAL INPUTS:
format= The format to send to the string() function. This is the
most natural way to format the output.
EXAMPLES:
IDL> print,ntostr(3.528162895)
3.52816
IDL> print,ntostr(3.528162895,format='(F10.2)')
3.53
IDL> print,ntostr([3.528162895,421.3812166],format='(F10.2)')
3.53 421.38
IDL> print,ntostr([32,157231],format='(I20.5)')
00032 157231
REVISION HISTORY:
Author: Erin Scott Sheldon UofM 6/1/99
Added format keyword. Some time in 2002, ESS, UChicago
(See pro/util//ntostr.pro)
NAME:
OBJ_INFO
PURPOSE:
For a list of objects (index) make color-color diagrams, size
vs brightness plot, find its family, and make its own
FINDING CHART.
WARNING: write_gif will not work if plot window is minimized. i.e. you
won't have good gifs when you are done if it is minimized.
CALLING SEQUENCE: obj_info, pstruct, index, clr, dir=dir, radius=radius,
gif=gif, ps=ps, outdir=outdir,fchart=fchart, all=all,
noprompt=noprompt, silent=silent, nodisplay=nodisplay,
hideradec=hideradec
INPUTS: pstruct: photo structure.
IMPORTANT NOTE: This MUST have objc_rowc as a continuously 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_PHOTO_COL.
index: The objects for which to get info.
clr: The color to use when making the fchart.
INPUT KEYWORD PARAMETERS:
dir: The directory holding the atlas images.
radius: The finding chart for each object will have sides
2*radius unless radius is too big. (e.g. radius > 2048)
radarcsec: radius in arcseconds (takes precedence over radius)
radarcmin: radius in arcminutes (takes precedence over radarcsec)
gif: Set gif keyword to print gifs of all images in cwd.
ps: Set ps keyword to print postscripts of all images.
outdir: Where to put the output files
all: If all is set, then all objects (not just stars)
are used for the locus of the color-color plots
noprompt: If noprompt is set, then there is no prompting
silent: If silent is set, there will be no messages except
for some errors.
hideradec: If set it will not include ra dec on anything
for example if you are showing unpublished results
at a conference and want to be descreet.
hist: Will hand this to plot_colors to use 2D histograms
instead of scatter plots. Good for large catalogs.
radrange: range on petrorads to plot. handed to plot_colors
OUTPUTS: Files: (only output if /gif or /ps is used)
a) The following files are created in the cwd for each object:
Obj-run-rerun-colorcamcol-field-id-type.extension
examples:
Obj-000259-1-3-0248-0234-atlas.gif
Obj-000259-1-3-0248-0234-atlas.ps
Obj-000259-1-3-0248-0234-colors.gif
Obj-000259-1-3-0248-0234-colors.ps
Obj-000259-1-3-0248-0234-fchart.gif
Obj-000259-1-3-0248-0234-fchart.ps
b) If index contains more that one object then a color-color plot is
made with all of them in it. It uses the entire pstruct
to make the locus
The file name is:
Obj-000259-1-3-0248-0234-colors-multi.gif
with the info refering to the FIRST object in the list
OPTIONAL OUTPUTS: fchart: The image of the fchart may be returned.
CALLED ROUTINES: EXTRACT_STARS:
MAKE_FLAG_STRUCT
FLAG_SELECT
PLOT_COLORS
BEGPLOT
ENDPLOT
GET_FAMILY:
GET_ATLAS (calls many pros)
FCHART
DISPLAY_FCHART
SUBROUTINES: OBJ_PROMPT_USER, OBJ_DISPLAY_FCHART
EXAMPLES: This will work on sdss3 if typed exactly:
(Until we move the data)
IDL> file='/sdss3/data4/run109/tsObj-000109-3-0-0011.fit'
IDL> read_photo_col, file, pstruct, struct_typ='all', nframes=20
IDL> dir='/sdss3/data4/run109/'
IDL> r=2
IDL> index = 1002
IDL> obj_info, pstruct, index, r, dir=dir
Lets say you have a program that selects quasars. It returns the
indices of the quasars. Also, you want to generate all the ps and gif
files at once without any keyboard prompting:
IDL> findqso, pstruct, index
IDL> obj_info, pstruct, index, r, dir=dir, /noprompt, /ps, /gif
If you only want to make the ps files:
IDL> obj_info, pstruct, index, r, dir=dir, /noprompt, /nodisplay, /ps
REVISION HISTORY:
Author: Erin Scott Sheldon UMich 03/21/99
David Johnston - changed filename formats to what is described
above. Fixed some bugs with the 'sky' program 5/12/99
E.S.S. Made obj_display_fchart in to stand alone proc.
display_fchart.pro
E.S.S.:
Changed order in names/titles: run-rerun-camcol-field-id
Addec radarcsec keyword.
Added outdir keyword 02-Jul-2002
(See pro/sdss//obj_info.pro)
NAME:
PARSE_CONFIG
PURPOSE:
Parse simple 2 column "option value" config file. Each is read in as a
string. Everything to the right of a comment character # is ignored,
as are empty lines. The outputs are string arrays for the keywords
and values. A optional output 'struct' is a structure with each keyword
value pair as tag and value in the structure.
CALLING SEQUENCE:
parse_config, config_file, keywords, values
INPUTS:
config_file: full path to file
OUTPUTS:
keywords: the names of the config variables
values: values of config variables
OPTIONAL OUTPUTS:
status=: 0 if success
MODIFICATION HISTORY:
??-??-2002 Erin Sheldon UofMichigan
02-Apr-2004: Allow comments, empty lines
(See pro/util//parse_config.pro)
NAME:
path_join
PURPOSE:
Join path elements using the default path separator, such as directory and filenames.
CALLING SEQUENCE:
f = path_join(path1, path2) ; e.g. directory, path
INPUTS:
path1, path2: Path elements. The first must be a scaler. For example:
path1 could be a directory and path2 a filename. Each element can contain
path elements. path2 May be an array.
OUTPUTS:
New path with all paths joined.
EXAMPLE:
On UNIX:
IDL> print,path_join('/blah/stuff', 'tmp/things.txt')
/blah/stuff/tmp/things.txt
MODIFICATION HISTORY:
Moved to main archive: 2007-04-22, Erin Sheldon, NYU
(See pro/files//path_join.pro)
NAME:
PHOTOID
PURPOSE:
Create unique super id from run,rerun,camcol,field,id
CATEGORY:
SDSS Specific routine.
CALLING SEQUENCE:
superid = photoid(run,rerun,camcol,field,id)
OR
superid = photoid(struct)
INPUTS:
run,rerun,camcol,field,id (may be arrays)
OR
struct: must contain the above (may be array of structs)
OUTPUTS:
A superid is returned
PROCEDURE:
super = id + field*10^6 + camcol*10^11 + rerun*ten^12 + run*ten^15
MODIFICATION HISTORY:
Created ??-??-2002 Erin Sheldon UofMichigan
Copyright (C) 2005 Erin Sheldon, NYU. erin dot sheldon at gmail dot com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
(See pro/sdss//photoid.pro)
NAME:
photoid2casid
PURPOSE:
Convert a set of photoids to CAS ids (skyserver ids)
CATEGORY:
SDSS
CALLING SEQUENCE:
cid = photoid2casid(pid)
INPUTS:
pid: A scalar or array of photoids as created by the photoid.pro
program.
OPTIONAL OUTPUTS:
sky_version, first_field. Extra info kept in CAS ids not
kept in photoids. See the casid() program for more info.
OUTPUTS:
casid(s).
MODIFICATION HISTORY:
Created: 2007-04-03. Erin Sheldon, NYU
(See pro/sdss//photoid2casid.pro)
NAME: PHOTOID_EXTRACT PURPOSE: Extract run,rerun,camcol,field,id from a superid (Ulong64) created with the photoid.pro function. CATEGORY: SDSS specific routine CALLING SEQUENCE: photoid_extract, super, run, rerun, camcol, field, id INPUTS: super: A super id created using the photoid.pro function OUTPUTS: run,rerun,camcol,field,id EXAMPLE: superid = photoid(run,rerun,camcol,field,id) photoid_extract, superid, run, rerun, camcol, field, id MODIFICATION HISTORY: Created: 5/30/2003 Erin Sheldon UofChicago
(See pro/sdss//photoid_extract.pro)
NAME:
PHOTOMAP
PURPOSE:
map ra and dec to row and col. The map centers on the first
ra-dec position in the lists.
NOTE: If clr is not given, then the program uses
RED (clr=2) to find the map.
CALLING SEQUENCE:
photomap, pstruct, order, ra, dec, row, col
INPUTS:
pstruct: a photo structure. Should cover ra and dec.
order: order of polynomial to fit
ra: the ra positions to trasform in degrees.
dec: the dec positions to transform in degrees.
OPTIONAL INPUTS: clr: The index to use for mapping.
OUTPUTS: row, col: mapped ra and dec positions.
CALLED ROUTINES:
CONVERT2XY
POLYWARP
KMAP
REVISION HISTORY:
Erin Scott Sheldon U of Michigan 7/8/99
(See pro/sdss//photomap.pro)
NAME:
PHOTO_MATCH
PURPOSE:
Match to lists of photo objects by their run, rerun, camcol, field,
and rerun. This uniquely defines each object.
CALLING SEQUENCE:
photo_match, run1, rerun1, camcol1, field1, id1, $
run2, rerun2, camcol2, field2, id2, $
matches1, matches2,
count=count, /silent
INPUTS:
run1, rerun1, camcol1, field1, id1: unique info for object list #1
run2, rerun2, camcol2, field2, id2: unique info for object list #2
OPTIONAL INPUTS:
None.
KEYWORD PARAMETERS:
/silent: don't print out removal of duplicates
OUTPUTS:
matches1, matches2: match indices for each list.
OPTIONAL OUTPUTS:
count: number of matches
CALLED ROUTINES:
MATCH
PROCEDURE:
Match two photo lists putting their run,rerun,camcol,field,id
into one super index which is a 64 bit number encoding these
to a unique number . Then a regular "sort match" can be run
this is therefore a n_log(n) algorithm. Duplicates are
removed before matching.
REVISION HISTORY:
Dave Johnston 11/12/99 UChicago
Remove Duplicates: Erin S. Sheldon ?? UofMich
David Johnston: fixed bug that limited runs to 1844 by taking away
an uneeded digit from camcol ,added check for values that are too big
the bug would probably never cause a mismatch even for run > 1844.
added a check for things out of range. 04/07/2003
(See pro/sdss//photo_match.pro)
NAME:
PIXEL_MASKFLAGS_SELECT
PURPOSE:
Select objects based on their SDSSPIX flags.
CATEGORY:
SDSS routine.
CALLING SEQUENCE:
pixel_maskflags_select, maskflags, keep, nkeep, /noedges, /twoquad,
out=out, nout=nout
INPUTS:
maskflags: The maskflags for a set of objects, as output by the
sdsspix_mask DLM
KEYWORD PARAMETERS:
/noedges: No edges can be hit.
/twoquad: Its ok if two adjacent quadrants don't hit an edge.
OUTPUTS:
keep=: The indices which pass the mask.
nkeep=: The number that passed.
OPTIONAL OUTPUTS:
out=: The indices of objects that were masked.
nout=: The number that were masked.
MODIFICATION HISTORY:
Created: Erin Sheldon, UofChicago, sometime in 2003.
(See pro/sdsspix//pixel_maskflags_select.pro)
NAME:
ploth
PURPOSE: like plotting points but makes a two dimentional
histogram first and displays that as an image with tvim2
and returns a histogram structure
CALLING SEQUENCE:
ploth,x,y,hist,median=3
INPUTS:
x ,y : the two one-dimentional arrays that you want histogrammed
OUTPUTS:
hist : the histogram structure contains 3 fields
.map (the 2D array) , .xrange, .yrange (the two ranges)
these ranges permit mapping from the data to the histogram map
and vice versa
KEYWORDS:
xrange,yrange : the range to include data from
these are output and saved in the hist structure
the default is min, max
if these are flipped like [12,3]
it will use 3 as min and 12 as max and then flip the histogram
nxbins, nybins : the number of bins for each dimention
range : the display range given to tvim2
default is to go around the mean by three sigma
uses sigma clipping algorithm
log, sqrt : use log or square root scaling
median : do a median filter smoothing on a square this size
should be an odd integer
smooth : so boxcar average smoothing on a square this size
should be an odd integer
g_smooth : do gaussian smoothing with a gaussian of fwhm
of this amount. Should be a float > 1.0.
silent : speak no evil
EXTERNAL CALLS:
histogram_2d
tvim2
make_gaussian
METHOD: call histogram_2d which calls hist_2d (a built in IDL routine)
EXAMPLE
NOTES
if median,smooth or g_smooth are set the resultant hist.map
will be smoothed upon output, though if log or sqrt are set they
hist.map will NOT be scaled as it is displayed
HISTORY: written by David Johnston -University of Chicago
Physics Department 1999
(See pro/plotting//ploth.pro)
NAME:
PLOTHIST
PURPOSE:
Plot the histogram of an array with the corresponding abcissa. This is an
enhanced version of the original Landsman program from the Goddard
library. Enhancements include weighting of points, aspect ratio control,
bootstrapping for errors, and allowing all histogram keywords.
CALLING SEQUENCE:
plothist, array, weights=,
peak=, norm=, aspect=, /error, nboot=,
/noplot, /overplot,
/fill, fcolor=, /fline, forientation=, fpattern=, fspacing=
xhist=, yhist=, reverse_indices=
...plotting keywords...histogram keywords]
INPUTS:
array: data to histogram and plot.
OPTIONAL INPUTS:
histogram keywords: See docs on histogram on it bins data.
E.g. binsize, nbin, min, max, etc.
weights: Weights for each point. Plotted histogram will be total of weights
rather than simple counts in bins.
peak: Peak value for plotted histogram.
norm: normalization of histogram (intergration is simple rectangle
integration)
aspect: Aspect ratio of the plot.
/error: Plot poisson error bars for unweighted histograms.
nboot: Bootstrap the histogram to get errors using this number of samples.
Is most useful for weighted histograms.
/noplot: Don't plot, just get the bin statistics.
/overplot: overplot on current plot.
/fill: Fill the histogram. See below for fill keywords.
extra plotting keywords: See docs on plot
OPTIONAL OUTPUTS:
xhist - X vector used in making the plot
yhist - Y vector used in making the plot
reverse_indices: See docs for the histogram program.
bstruct: Lots of statistics for the bins.
The following keywords take effect only if the FILL keyword is set:
fcolor - color to use for filling the histogram
/fline - if set, will use lines rather than solid color for fill (see
the LINE_FILL keyword in the POLYFILL routine)
forientation - angle of lines for fill (see the ORIENTATION keyword
in the POLYFILL routine)
fpattern - the pattern to use for the fill (see the PATTERN keyword
in the POLYFILL routine)
fspacing - the spacing of the lines to use in the fill (see the SPACING
keyword in the POLYFILL routine)
EXAMPLES:
IDL> a = randomn(seed,1000)
IDL> plothist,a, binsize = 0.1
IDL> plothist, a, nbin=25, norm=1.0
MODIFICATION HISTORY:
Written W. Landsman January, 1991
Add inherited keywords W. Landsman March, 1994
Use ROUND instead of NINT W. Landsman August, 1995
Add NoPlot and Overplot keywords. J.Wm.Parker July, 1997
Add Peak keyword. J.Wm.Parker Jan, 1998
Add FILL,FCOLOR,FLINE,FPATTERN,FSPACING keywords. J.Wm.Parker Jan, 1998
Converted to IDL V5.0 W. Landsman 21-Jan-1998
Allowed min/max to be sent. Erin Scott Sheldon UofMich Jun-07-2001
Added norm= keyword Erin Scott Sheldon UChicago 17-Oct-2002
Now uses bin centers rather than the leading edge of the bin.
Erin Scott Sheldon UChicago 25-Nov-2003
Big rewrite using the binner.pro and pplot.pro functions. Now
allows weighted histograms and all histogram keywords. Also
allows pplot keywords such as aspect for aspect ratio.
Erin Sheldon, NYU, 2007-04-07
Allow bootstrapping using the nboot keyword. Calls boot_hist.pro in
this case. 2007-04-24 Erin Sheldon, NYU
(See pro/plotting//plothist.pro)
NAME:
plotposition
PURPOSE:
Return the normalized plot position. If !p.position is set it is
returned. Otherwise a dummy plot is generated in the current
device and the coordinates of that are returned. Note, if using
!p.multi the following plot must be overplotted without an erase
or the next (incorrect) cell will be used. Flags will have 2^0
added in this case. The result is an array
[ px0, py0, px1, py1 ]
CATEGORY:
plotting
CALLING SEQUENCE:
pos = plotposition(flags=flags)
EXAMPLE:
MODIFICATION HISTORY:
Created: 2007-01-03, Erin Sheldon, NYU
(See pro/plotting//plotposition.pro)
NAME:
PLOT_1COLOR
PURPOSE:
make color-color plot from sloan colors. Plot one set of data
from obj_struct. Over plot, if requested, from oplot_str
CALLING SEQUENCE:
oplot_colors, obj_struct, color, oplot_str=oplot_str,
index=index, size=size, carr=carr, opcarr=opcarr
INPUTS:
obj_struct: photo objc structure.
color: indicates which colors to plot.
color = 1 for g-r vs u-g
color = 2 for r-i vs g-r
color = 3 for i-z vs r-i
oplot_str: (optional) struct to overplot
index: (optional) indexes on obj_struct to use in plotting
size: (optional) if set, oplot_colors also plots size v
brightness
OUTPUTS:
carr: (optional) output struct containing colors for obj_struct
opcarr: (optional) output struct containing colors for oplot_str
OPTIONAL OUTPUT ARRAYS:
carr: (optional) output struct containing colors
for obj_struct
opcarr: (optional) output struct containing colors
for oplot_str
INPUT KEYWORD PARAMETERS:
PROCEDURE:
REVISION HISTORY:
Authro: Erin Sheldon UM 2/6/99
(See pro/sdss//plot_1color.pro)
NAME: plot_box PURPOSE: Plot a box with input set of coords. CALLING SEQUENCE: plot_box, minx, maxx, miny, maxy, /polyfill, _extra=_extra MODIFICATION HISTORY: Created: 2000, Erin Sheldon, UofMichigan
(See pro/plotting//plot_box.pro)
NAME: PLOT_CLFLAG
PURPOSE:
Plots classification flags for a set of objects.
CALLING SEQUENCE:
plot_clflags,pstruct,index,log=log
INPUTS:
pstruct: a photo output structure (must have .classification tag)
REVISION HISTORY: Judith Racusin 6/15/00, modified from plot_flags by Tim Mckay
(See pro/classgal//plot_clflags.pro)
NAME:
PLOT_COLORS
PURPOSE:
make color-color plots from sloan colors. Plot one set of data
from obj_struct. Over plot, if requested, from oplot_str.
DEFAULTS are COUNTS_MODEL for colors, PETRORAD vs. PETROCOUNTS for
size vs mag plots. PLOT_COLORS will search for other arrays if
these are not present. If the keywords /fibercounts or /psfcounts
are given, then these arrays are used (if present) for both
colors and magnitude.
NOTE: For stars, COUNTS_MODEL is closer to psfcounts than petrocounts or
fibercounts. Also, COUNTS_MODEL give the best colors for galaxies.
Thus, it is best for showing both stars and galaxies on the same
color-color diagrams. That is why it is the default. If you are
just plotting stars and quasars, then PSFCOUNTS may be the way
to go; set the /psfcounts keyword.
CALLING SEQUENCE:
plot_colors, obj_struct, oplot_str=oplot_str,index=index, size=size,
carr=carr,opcarr=opcarr, psfcounts=psfcounts, fibercounts=fibercounts,
psym=psym,title=title,hist=hist,radrange=radrange,
oplot_clr=oplot_clr, _extra=_extra
INPUTS: obj_struct: photo objc structure.
OPTIONAL INPUTS:
index: indexes on obj_struct to use in plotting
oplot_str: struct to overplot
oplot_clr: The color of the overplotted symbols. If this is set,
the procedure simpctable is called, which sets certain
system variables (the value of these depends on the device and
if the device is X, the number of colors available):
!black
!white
!red
!green
!blue
!yellow
!cyan or !lightblue
!magenta
Therefore, if you don't want to remember the numbers, just
call simpctable before calling plot_colors, and use
oplot_clr=!magenta
or whatever. You can get back to black and white with loadct,0
Note that the background will always be set to black and the
axes white, and these are reversed when you send to postscript.
WARNING: doesn't work well with the /hist keyword
radrange: the range on petrorad to plot
psym: The over plotting symbol. Default is a cross-hair.
title=title: title for upper left hand plot (g-r) vs (u-g)
_extra=_extra any extra plotting stuff.
INPUT KEYWORD PARAMETERS:
/size: if set, oplot_colors also plots size v
brightness. DEFAULT is PETROCOUNTS vs. PETRORAD
/psfcounts: If set, use psfcounts for colors and magnitude
/fibercounts: if set, use fibercounts for colors and magnitude
NOTE: Defaults are 1. COUNTS_MODEL for colors
2. PETROCOUNTS for magnitude if /size
/hist: use 2D histograms instead of scatter plots , displays them
with tvim2
OPTIONAL OUTPUT ARRAYS:
carr: (optional) output struct containing colors for obj_struct
opcarr: (optional) output struct containing colors for oplot_str
PROCEDURE:
REVISION HISTORY: Tim Mckay UM
Erin Sheldon UM 2/6/99 added over-plotting, comments
Dave Johnston UC 5/15/99 made DEFAULT over-plot symbol
to be crosshairs
Dave Johnston 7/23/99 added 2D histogram option instead of
scatter plots. This is good for speed and also
appearance. Added radrange as a keyword
this is the range in petrorad to plot.
Erin Sheldon Made plots square
Erin Sheldon 05/04/00 Added color overplotting. Improved
error handling by checking for existence of
magnitude arrays and size arrays with subroutine
PLOT_COLORS_CHECK_TAGS. Improved memory
usage.
(See pro/sdss//plot_colors.pro)
NAME:
plot_cross
PURPOSE:
Plot a cross with input size and center.
CALLING SEQUENCE:
plot_cross, radius, x, y, hole_fraction=, _extra=
INPUTS:
radius: rad in data units.
x,y: pos in data units.
OPTIONAL INPUTS:
hole_fraction: Place a hole at the center of the cross
this fraction of "radius" in size. Default zero.
MODIFICATION HISTORY:
Created: 2000, Erin Sheldon, UofMichigan
(See pro/plotting//plot_cross.pro)
NAME:
PLOT_ELLIPSE
PURPOSE:
Draw an ellipse on the current graphics device.
CALLING SEQUENCE:
plot_ellipse, radius, x, y, axis_ratio=, pos_angle=, /device,
npoints=, _extra=
REVISION HISTORY:
Converted tvellipse to be more powerful and intuitive.
Erin Sheldon UChicago 18-Oct-2004
(See pro/plotting//plot_ellipse.pro)
NAME:
plot_ne_arrows
PURPOSE:
Plot a north and east arrow, with tails back to
back, in the upper right corner of the current plot device.
CALLING SEQUENCE:
plot_ne_arrows, angle, fracsize=, offset_frac=, order=
INPUTS:
angle: Angle on the device in radians.
OPTIONAL INPUTS:
fracsize: Size of arrows relative to plot region. Default 0.1
offset_frac: Offset from side of plot region relative to
size of arrows.
order: Is image flipped?
MODIFICATION HISTORY:
Created: 2003, Erin Sheldon, UChicago
(See pro/plotting//plot_ne_arrows.pro)
NAME:
POSTGRES (IDL Class file)
PURPOSE:
An IDL class file wrapping the pgsql_query() function, which provides
an interface to the postgres database.
CALLING SEQUENCE:
pg = obj_new('postgres', connect_info=)
OPTIONAL INPUTS:
connect_info: This is stored at initialization so can be used later
without sending. Useful if not using the database listed in the
PGDATABASE environment variable for example.
METHODS:
All the functionality comes from the pgsql_query() function. This
class provides some wrapper methods for complex but often-used queries.
Use:
methods,'postgres'
to list the methods and
doc_method,'postgres::methodname'
to see the full documentation for each. Use
doc_method,'postgres',/class (or doc_library,'postgres__define')
to see this doc.
The most useful methods:
::query()
Send a query and return the results.
::struct2table: Stuff a structure into a postgres table, creating a
new table if necessary.
::tables()
Return a list of tables in the database.
::table_exists()
Return 1 if the table exists, 0 if not.
::describe
Print a description of a table or, if no arguments, short descriptions
of all tables.
::table_indexes
Print index information for a table.
::status_val()
Return the query status value given the name
::status_name()
Return status name given the value
::tablerows()
Postgres does not store the number of rows for a table, it counts them
each time you run select count(*) from table.... If this info has been
stored in a table called tablename_meta it is retrieved, otherwise an
error is given and execution is stopped.
RESTRICTIONS:
MODIFICATION HISTORY:
Created: Mid-2005, Erin Sheldon, Uchicago
(See pro/postgres//postgres__define.pro)
NAME:
PPLOT
PURPOSE:
A complete replacement for plot and ploterr that allows plotting of error bars in x and y as well as a user defined axis ratio.
CALLING SEQUENCE:
pplot, x, y, xerror=, yerror=, aspect=, /center,
errcolor=, errstyle=, errthick=, /nohat, hatlength=, nskip=,
_extra='
INPUTS:
x, y: x and y vectors. The same restrictions as the builtin plot program.
Note if y is not sent, then plot, x is run and error bars are ignored.
KEYWORD PARAMETERS:
xerror: Error bars on x
yerror: Error bars on y
aspect: Aspect ratio xsize/ysize. I know many people will expect this to
be reversed, but this is historical from the APLOT program.
/center: Re-center the display after applying aspect ratio.
; These deal with the style of errors bars. This stuff stolen from the
; Goddard ploterror program.
errcolor: Color for error bars. Unlike ploterror, defaults to same color as
the points.
errstyle: Line style for error bars.
errthick: Line thickness for error bars.
/nohat: Don't use a hat on the error bar.
hatlength: Lenght of hat. Defaults to !d.(x|y)_vsize/100.0
nskip: Integer specifying the error bars to be plotted. For example,
if NSKIP = 2 then every other error bar is plotted; if NSKIP=3
then every third error bar is plotted. Default is to plot
every error bar (NSKIP = 1)
EXAMPLES:
pplot, x, y, aspect=1.0
pplot, x, y, yerror=yerr
pplot, x, y, xerror=xerr, yerror=yerr, errcolor=greenid
MODIFICATION HISTORY:
Created: 11-May-2006, Erin Sheldon, NYU. An amalgomation of
many procedures, including ploterror.pro (Goddard) and aplot.pro (ES)
designed to do all in one in an intuitive way.
(See pro/plotting//pplot.pro)
NAME: PRINT_CLFLAG
PURPOSE:
Prints classification flags for a single object
CALLING SEQUENCE:
print_clflags,pstruct,index
INPUTS:
pstruct: a photo output structure (must have .classification tag)
index: index of object of interest
REVISION HISTORY: Judith Racusin 6/15/00, modified from print_flags by Tim Mckay
(See pro/classgal//print_clflags.pro)
NAME:
PRO2HTML
PURPOSE:
Convert an IDL .pro file into a pretty HTML document, with EMACS-like
color coding.
CALLING SEQUENCE:
pro2html, pro_file, html_file, signature=
INPUTS:
pro_file: the full path of the IDL .pro file
html_file: the full path name of the output html file
OPTIONAL INPUTS:
signature: Some text to put at the end.
PROCEDURE:
Look for reserved IDL words, comments, and strings and color-code them,
converting html senstive characters into codes. You can change the color
coding by changing the style definitions in the header.
REVISION HISTORY:
Created: 18-NOV-2000 Erin Scott Sheldon UofMich
Inspired by the emacs htmlize.el, moved over to using styles
for a more compact and stable result. E.S. NYU 2006-July-15
(See pro/util//pro2html.pro)
NAME:
prompt_kbrd
PURPOSE:
Prompt the user for an input key. Wrapper for get_kbrd() that only prompts
if the display type is 'X'.
CALLING SEQUENCE:
key = prompt_kbrd('optional prompt string',format=)
OPTIONAL INPUTS:
prompt_string: Optional string to display while waiting for input.
format: a format for printing the string.
EXAMPLE:
key = prompt_kbrd('Hit a key')
MODIFICATION HISTORY:
Created: 2005, Erin Sheldon, Uchicago
(See pro/util//prompt_kbrd.pro)
NAME: PSLANDFIX PURPOSE: Fix the upside-down landscape that IDL generates. CALLING SEQEUNCE: pro pslandfix,[filename] INPUT: FILENAME Name the idl PostScript file to fix. Default is 'idl.ps' OUTPUT: Fixed PosctScript file NOTES: none HISTORY: 10-AUG-95 Version 1 written E. Deutsch
(See pro/plotting//pslandfix.pro)
NAME:
PSLAYOUT
PURPOSE:
Set up the system variable !PSLAYOUT which contains information for
setting up the X, Z, or PS devices. The user, if not satisfied with these
settings, should copy pslayout into their code directory and make the
required modifications.
CATEGORY:
Plotting routine
CALLING SEQUENCE:
pslayout
SIDE EFFECTS:
The !PSLAYOUT variable is created if not already in existence. If in
existence, it will NOT be modified.
MODIFICATION HISTORY:
Creation: ??-??-2001 Erin Sheldon UofMichigan
(See pro/plotting//pslayout.pro)
NAME:
ptime
PURPOSE:
print a time interval in a nice format if days,hours,minuties,seconds.
CALLING SEQUENCE:
ptime, t [, num, tstr=, command=, savetime=]
INPUTS:
t: a time in seconds.
OPTIONAL INPUTS:
num: number of places to keep in seconds. Default is 4,
which includes any decimal places.
KEYWORD PARAMETERS:
command=: An execution string to be timed.
/savetime: if this is set, then t is set to the current systime(1)
and returned without printing
OPTIONAL OUTPUTS:
tstr: a string containing the time in hr min sec format.
EXAMPLES:
IDL> tm=systime(1)
IDL> run_some_command
IDL> ptime, systime(1)-tm
Time: 5 min 35.2000 sec
IDL> ptime, command='some_command'
Time: 3.0079839 seconds
REVISION HISTORY:
Author: Erin Scott Sheldon UofM 7/8/99
(See pro/util//ptime.pro)
ROUTINE: put_clr_scl
USEAGE: PUT_CLR_SCL,x1,y1,range[,inc,ysize=ysize,charsize=charsize]
PURPOSE: Draws a numbered color scale
INPUT:
x1,y1 device coordinates of lower left hand corner of color bar
range array which contains full range of physical values,
The number scale limits are computed fron min(range) and
max(range).
inc increment step of the number scale in physical units
OPTIONAL KEYWORD INPUT:
charsize character size on number scale. Defaults to !p.charsize.
ysize vertical size of color bar in device units.
invert used to invert the color scale.
nolabels Used to inhibit labels.
AUTHOR: Paul Ricchiazzi oct92
Earth Space Research Group, UCSB
MODIFIED: Jeff Bloch From put_color_scale to handle
inverted color scales indicated by
the new keyword INVERT. Also default
character size taken from !p.charsize.
10/13/95 1.4
(See pro/plotting//put_clr_scl.pro)
NAME:
qu2e
PURPOSE:
Convert Robert Luptons q and u shape parameters to ellipticity
parameters as measured by unweighted moments and Gary Bernstein's
adaptive moments.
CALLING SEQUENCE:
qu2e, q, u, e1, e2
INPUTS:
q: Shape parameter corresponding to 'e1'
u: Shape parameter corresponding to 'e2'
OUTPUTS:
e1 and e2. ellipticity parameters.
PROCEDURE:
Robert's scheme uses a 1/r weighting scheme for measuring
(ixx - iyy)/(ixx + iyy) and 2ixy/(ixx + iyy)
For his method, these are equal to:
q = ( 1-r )/( 1+r )*cos(2*theta)
u = ( 1-r )/( 1+r )*sin(2*theta)
Where r=axis ratio of object and theta=position angle from x axis
For unweighted and adaptive schemes, the formulae the same with
r -> r^2
REVISION HISTORY:
Author: Erin Scott Sheldon UofM 6/1/99
(See pro/astro//qu2e.pro)
NAME:
radec2rowcol
PURPOSE:
convert from equatorial coordinates to row/col, ignoring higher
order terms in the transformation. Good to .1 pixels or so. For this
crude program, you need to read in the transformation file and know
the sdss field to do the transformation.
CALLING SEQUENCE:
radec2rowcol, trans, node, inc, field, ra, dec, row, col, status=
INPUTS:
trans: the astrans file for this run,camcol,bandpass. Use
sdss_read() to get the astrans file.
field: the field
ra,dec: equatorial coordinates
Optional Inputs:
ri=: the r-i color used in color term of transform
/nonlinear: use a non-linear transform.
OUTPUTS:
row,col: row/col in the bandpass of the trans structure
OPTIONAL OUTPUTS:
status: 1 for success, 0 for failure
PROCEDURE:
We know the ra/dec are in field 562 of run 756
run=756
rerun=44
camcol=3
field = 562
band=2
trans=sdss_read('astrans',run,camcol,band=band,node=node,inc=inc)
radec2rowcol, trans, node, inc, field, ra, dec, row, col
REVISION HISTORY:
15-AUG-2002 Creation. Erin Scott Sheldon UofMich
(See pro/sdss//eq2rowcol.pro)
NAME:
RADECSTR
PURPOSE:
Wrapper for radec. Returns string versions of ra and dec.
CALLING SEQUENCE: radecstr, ra, dec, rastr, decstr
INPUTS: ra, dec in degrees.
OUTPUTS: rastr, decstr. Strings containing ra and dec.
CALLED ROUTINES: radec
EXAMPLE:
REVISION HISTORY: Erin Scott Sheldon U of Mich. 3/28/99
Dave Johnston changed h m s to colons and added
a little more accuracy to last digits
of arcseconds ,since the seconds of ra needs 3
digits after the decimal to be accurate to
subarcsecond level
Dave Johnston made it output the negative sign on dec
on the "degrees" part even if it is -0
(See pro/astro//radecstr.pro)
NAME:
RADEC_MATCH
CALLING SEQUENCE:
radec_match.pro,m1,m2,newmatch
INPUTS:
m1: first match structure
m2: second match structure
OUTPUTS: newmatch: combined structure, merged on (ra,dec)
INPUT KEYWORDS:
angdiff: angular difference (in ") to allow
PROCEDURE: Merges the two matched structures into a single list
by matching in ra,dec for the whole thing.
REVISION HISTORY:
Tim McKay UM 6/23/98 Created
(See pro/astro//radec_match.pro)
NAME: RAINBOW_RGB() PURPOSE: Produce rgb colors based on hue. Wrapper for COLOR_CONVERT so the user only has to supply the hue, although luminance and saturation can optionally be sent. CALLING SEQUENCE: color = rainbow_rgb(hue, luminance=luminance, sataturation=saturation) INPUTS: hue: hue on the color wheel: [0,360] from red-green-blue and back. OPTIONAL INPUTS: luminance=: In [0,1] saturation: In [0,1] KEYWORD PARAMETERS: OUTPUTS: The corresponding rgb color which can be sent to IDL plotting routines. EXAMPLE: color = rainbow_rgb(125) oplot, data, color=color MODIFICATION HISTORY: Created: ??-July-2005. Erin Sheldon, UChicago
(See pro/plotting//rainbow_rgb.pro)
NAME:
RD2XY
PURPOSE:
Compute an X and Y position given the RA and DEC and an astrometry
structure from a FITS header. A tangent (gnomonic) projection is
computed directly; other projections are computed using WCSXY2SPH.
AD2XY is meant to be used internal to other procedures. For
interactive purposes, use ADXY.
CALLING SEQUENCE:
AD2XY, a ,d, astr, x, y
INPUTS:
A - R.A. in DEGREES, scalar or vector
D - Dec. in DEGREES, scalar or vector
ASTR - astrometry structure, output from EXTAST procedure containing:
.CD - 2 x 2 array containing the astrometry parameters CD1_1 CD1_2
in DEGREES/PIXEL CD2_1 CD2_2
.CDELT - 2 element vector giving increment at reference point in
DEGREES/PIXEL
.CRPIX - 2 element vector giving X and Y coordinates of reference pixel
(def = NAXIS/2)
.CRVAL - 2 element vector giving R.A. and DEC of reference pixel
in DEGREES
.CTYPE - 2 element vector giving projection types
OUTPUTS:
X - row position in pixels, scalar or vector
Y - column position in pixels, scalar or vector
REVISION HISTORY:
Converted to IDL by B. Boothman, SASC Tech, 4/21/86
Use astrometry structure, W. Landsman Jan. 1994
Do computation correctly in degrees W. Landsman Dec. 1994
Only pass 2 CRVAL values to WCSSPH2XY W. Landsman June 1995
Don't subscript CTYPE W. Landsman August 1995
Changed to RD2XY forces tangent projection David Johnston 1998
(See pro/astro//rd2xy.pro)
NAME:
RDIS
PURPOSE:
Wrapper for tvim2. One can zoom, rescale, flip across x or y, or
rotate by 180 degrees.
CALLING SEQUENCE:
imdis, image [, pls,
sigmahigh=sigmahigh, sigmalow=sigmalow,$
xmn=xmn, xmx=xmx, ymn=ymn, ymx=ymx, $
low=low, high=high, $
log=log, zoom=zoom, full=full, $
flipx=flipx, flipy=flipy, rot=rot, $
silent=silent, _extra=extra]
INPUTS:
image: image to be displayed
OPTIONAL INPUTS:
pls: the plot structure. If not input, rdis_setup is called.
You can call rdis_setup yourself and set the equilavent of
the keywords in the structure:
xmn, xmx, ymn, ymx, low, high
INPUT KEYWORD PARAMETERS:
THESE OVERIDE PLS
xmn, xmx, ymn, ymx: range of x and y values of image to display.
these can be set in pls.
low, high: low and high of image.
full: show the full image.
rot: rotate image
silent: be quiet.
PROCEDURE:
REVISION HISTORY:
Tim McKay UM 1/29/97
Erin Scott Sheldon made pls optional input
Cleaned up, added comments. 11/24/99
(See pro/plotting//rdis.pro)
NAME:
RDIS_SETUP
PURPOSE:
Set up a parameter structure for rdis
CALLING SEQUENCE:
rdis_setup
INPUTS:
OUTPUTS:
lot_struct: a structure containing all the parameters needed
to run rdis
OPTIONAL OUTPUT ARRAYS:
INPUT KEYWORD PARAMETERS:
PROCEDURE: This just creates a little structure useful for image display
REVISION HISTORY:
Tim McKay UM 1/8/98
Tim McKay UM 3/7/98
Added check for environment variables
EXTRACT_CONFIG, and EXTRACT_PAR
Tim McKay UM 4/27/98
Altered from rextract_setup
(See pro/plotting//rdis_setup.pro)
NAME:
READ_ATLAS
PURPOSE:
Read atlas images specified by SDSS run,rerun,camcol,field,id,
or from a structure containing that info. This is a wrapper for the rdAtlas
procedure which reads from input file name and id (type rdAtlas at a prompt
to see the syntax). That program is more efficient but you must feed it
the atlas image file name.
CATEGORY:
SDSS specific routine
CALLING SEQUENCE:
read_atlas, objStruct -OR- run, camcol, field, id, rerun=,
image=,
atlas_struct=,
imu=, img=, imr=, imi=, imz=,
clr=,
index=,
dir=,
col0=, row0=, dcol=, drow=, ncol=, nrow=,
atlas_struct=,
status=,
/silent
INPUTS: The user can either input the
run,rerun,camcol,field,id: Unique SDSS identifier
OR
objStruct: a photo structure containig the id information.
OPTIONAL KEYWORD INPUTS:
clr: The bandpass to read. Will be returned in the image keyword.
must be a scalar.
dir: directory of atlas images. THIS IS OPTIONAL, since this
information can be generated from the id info and the config
variable DATA_DIR
index: Index for when input structure is an array. Defaults to zero,
the first element in struct.
OUTPUT KEYWORDS:
image:
An array containing the image(s). If clr= is sent, just that
bandpass is returned through this keyword. Otherwise, If one of
the imr=imr type arguments is not sent and atlas_struct is not
present, then all images are copied into this argument as a
[5,nx,ny] array.
atlas_struct:
A structure with all images and statistics.
imu=, img=, imr=, imi=, imz=:
The images for individual bandpasses. Just set these equal to a
named variable to return the image you need.
row0=, col0=: objc_rowc, objc_colc position of bottom left corner
of atlas cutout in the original image.
dcol=, drow=: positional difference between each band and the r-band
nrow=, ncol=: number of columns, rows in each image.
status= The exit status. 0 is good, anything else is bad
KEYWORD PARAMETERS:
/silent: will run silently unless bad images or missing
images are found
RESTRICTIONS:
The C-function rdAtlas must be compiled, and the DLM directory must be in
the user's $IDL_DLM_PATH. Also, the directory configuration variable
DATA_DIR
must be set and the runs must be visible from there with the usual
directory structure. If not, then the directory can be sent with the
dir=dir keyword.
EXAMPLE:
- Read an r-band atlas image into memory
IDL> read_atlas, run, rerun, camcol, field, id, imr=imr
- Read using a structure; get all images in atlas_struct
IDL> read_atlas, objStruct, atlas_struct=as
MODIFICATION HISTORY:
Created: 17-Nov-2004 from old get_atlas. Erin Sheldon, UChicago.
(See pro/sdss//read_atlas.pro)
NAME:
READ_IDLHEADER
PURPOSE:
Read the header from a ".st" (idl structure) file. The result is a
structure containing the NROWS, FORMAT keywords and the field names, types
and descriptions, as well as any other keyword-value pairs the user has
added. Strings are returned as strings, all others are returned as double
precision floating point. Arrays are allows for numbers.
CATEGORY:
File I/O
CALLING SEQUENCE:
hstruct = read_idlheader(filename/unit)'
INPUTS:
filename or unit: Name of the file to be read, or the logical unit of an
open file.
OUTPUTS:
A structure containing the NROWS, FORMAT keywords and the field names, types
and descriptions. Possible also user added keyword-value pairs (which may
be arrays for numbers).
EXAMPLE:
file = 'test.st'
hstruct = read_idlheader(file)
MODIFICATION HISTORY:
Created 02-Jul-2004 Erin Sheldon, UofChicago
(See pro/idlstruct_files//read_idlheader.pro)
NAME:
READ_IDLSTRUCT
PURPOSE:
Read from the standardized file format ".st" into an array of structures.
These file formats are written by the WRITE_IDLSTRUCT procedure. See the
documentation for that procedure for more info.
CATEGORY:
File I/O
CALLING SEQUENCE:
struct = read_idlstruct(filename, columns=, rows=, numrows=,
hdrstruct=, status=, /silent, error=)
INPUTS:
filename: Name of the file to be read.
OPTIONAL INPUTS:
columns: A string or integer (zero offset) array or scalar containing the
names of the columns to extract from the structure. By default all
columns are returned. If the binary_read or ascii_read C++
programs is compiled and available, this is used to save memory and
speed, otherwise the whole thing is read and the desired columns
are extracted, with the expected limitations.
rows: A numerical array, zero offset, with the requested rows to read. By
Default all rows are read. Again, if binary_read or ascii_read is
available it is used (see columns). Takes precedence over numrows=
numrows=: Read the first numrows of the file. Useful if you have a very
large file and you just want to check out what the first few rows
look like without using lots of memory or time.
/silent: don't print informational messages
OUTPUTS:
struct: The data read from the file.
OPTIONAL OUTPUTS:
hdrstruct: The header for the idlst file.
error=error
status=status
PROCEDURES CALLED:
READ_IDLHEADER
(SWAP_ENDIAN)
(IEEE_TO_HOST)
(ASCII_READ)
(BINARY_READ)
EXAMPLE:
file = '~/blah.st'
struct = read_idlstruct(file)
MODIFICATION HISTORY:
Created 02-Jul-2004 Erin Sheldon, UofChicago
ES: Added columns keyword. 07-Mar-2004
ES: Added use of binary_read C function when available if columns
or rows are requested. 7-Nov-2005
ES: Added use of ascii_read C function when available and if
columns, rows requested. 28-April-2006
(See pro/idlstruct_files//read_idlstruct.pro)
NAME:
READ_IDLSTRUCT_MULTI
PURPOSE:
Read binary tables from multiple FITS files using mrdfits. Return
a single structure containing all data.
CALLING SEQUENCE:
struct = read_idlstruct_multi(files, $
/diff, $
columns=, $
count=, $
/silent, $
status=)
INPUTS:
files: A set of fits file names.
OPTIONAL INPUTS:
columns: The columns to read.
KEYWORD PARAMETERS:
/diff: This informs that the structures from each file may be different. A
slower but safer method is used that defines the output structure
based upon the first file and just copies the matching tags
afterward.
/silent: Be quiet except for errors.
OUTPUTS:
Combined structure.
OPTIONAL OUTPUTS:
count: the total count of rows read.
MODIFICATION HISTORY:
Author: Erin Sheldon, NYU
Documented: 2006-July-21. E.S.
(See pro/idlstruct_files//read_idlstruct_multi.pro)
NAME:
read_objmask()
PURPOSE:
Read in object mask data for objects in an SDSS atlas file.
CATEGORY:
SDSS routine.
CALLING SEQUENCE:
st = read_objmask(run, camcol, field, rerun=, idlist=, status=)
INPUTS:
run,camcol,field: SDSS field info.
OPTIONAL INPUTS:
rerun: The sdss rerun. If not sent it is taken as the latest available.
idlist: List of sdss ids. If not sent all are retrieved.
OUTPUTS:
Structure with mask info for each object.
run, rerun, camcol, field, id,
row0[5], col0[5], rowmax[5], colmax[5], drow[5], dcol[5]
OPTIONAL OUTPUTS:
status: 0 for success.
RESTRICTIONS:
Must have DLM rdObjmask compiled and linked in.
MODIFICATION HISTORY:
Created: 2007-02-26, Erin Sheldon, NYU
(See pro/sdss//read_objmask.pro)
NAME:
READ_SPDIAG1D
PURPOSE:
read in the spDiag file for a given plateid (mjd)
CATEGORY:
SDSS specific routine.
CALLING SEQUENCE:
read_spdiag1d, plateID, spdiag, mjd=mjd, spec_vers=spec_vers, /silent
INPUTS:
plateID: plate number in integer form.
OPTIONAL INPUTS:
mjd: modified julian date
spec_vers: version of the spectra. Default is to use SPEC_VERS from the
configuraton file.
KEYWORD PARAMETERS:
/silent: do not print out informative messages.
OUTPUTS:
spDiag: the contents of the spDiag file.
RESTRICTIONS:
The user needs yanny_read.pro and the spectra data on disk. SPEC_VERS
and SPEC_DIR must be defined in the config file
PROCEDURE:
Use yanny_read to read the contents of the spDiag file.
EXAMPLE:
read_spDiag1D, 1026, spDiag
MODIFICATION HISTORY:
Creation: ??-??-2003. Erin Sheldon UofChicago
(See pro/sdss//read_spdiag1d.pro)
NAME:
READ_SPEC1D
PURPOSE:
Read spectra data for the input plateid and fiberid. The mjd is optional;
if not entered, the latest mjd is used.
CATEGORY:
SDSS specific routine
CALLING SEQUENCE:
read_spec1d, plateid, fiberid, sp_struct, $
mjd=mjd, $
spec_vers=spec_vers, $
file=file, $
$
/no_substructs, $
silent=silent, $
$
z=z, err_z=err_z,$
$
plot=plot, $ ;Plotting stuff
/nolegend, $'
/nolines, $
nsmooth=nsmooth, $
errclr=errclr, $
leg_charsize=leg_charsize, $
label_charsize=label_charsize
_extra=_extra
INPUTS:
plateid: the plate number
fiberid: fiber number
OPTIONAL INPUTS:
mjd: The mjd; if not input, the latest mjd is used.
spec_vers: a string containing the spectro rerun id. e.g. '1d_23'. The
default is to read this from the SPEC_VERS config variable.
file: the file to read. Otherwise, it is created from the inputs.
KEYWORD PARAMETERS:
/no_substructs: Don't add the structures found in the other HDU's as nested
structures to sp_struct. This is useful if the user wants to
save the structure in a fits file with MWRFITS.PRO, which
does not allow nested structures. These structures can be
returned individually; see below.
/silent: don't print out informative messages
/plot: make a plot of the spectra. Calls plot_spec1d.pro
** inputs if /plot is set: nsmooth=nsmooth: boxcar smooth over this many
adjacent pixels
errclr=errclr: color for the error curve.
Default is green in X,Z and blue in PS
/nolegend: don't plot the legend, with the type,
redshift, and ra/dec
/nolines: don't plot and label the lines
leg_charsize=leg_charsize: the charsize for the
legend
label_charsize=label_charsize: the charsize for
the line labels.
_extra=_extra: Plotting keywords
OPTIONAL OUTPUTS:
sp_struct: all elements of the header are placed in a structure using the
hdr2struct procedure. This includes redshift, classification,
etc.
z=z: the redshift. This is also contained in the sp_struct.
err_z=err_z: The uncertainty in redshift.
These are the binary tables from higher HDU's. They can be returned
invidually with these keywords. They are also added to the returned
sp_struct unless /no_substructs is set.
lines_auto: all lines found automatically by the wavelet filter, with
no apriori knowledge of the redshift.
lines_redshift: all lines measured based on their expected positions
from the highest-confidence emission line redshift
em_z: Redshift determinations based on sets of emission lines. There
may be multiple entries, with each entry corresponding to a
different set of lines.
cc_z: Redshift determinations from cross-correlations. More than one
peak may be measured in each cross-correlation function (i.e.,
for each template).
line_indices: Standard line indices and flux ratios are stored
here. Lick indices, Brodie & Hanes, and Diaz, Terlevich, &
Terlevich are measured.
mask_res: The masks as passed from spPlate*.fit (the mask bit values
are a subset of those used in the mask array above), as well as
the resolution. The length of this table should be the same as
the length of the spectrum
*** See: http://www-sdss.fnal.gov:8000/edoc/dm/flatFiles/spSpec.html
for more info
RESTRICTIONS:
You need the Goddard idl astronomy procedures and the Umich SDSS idl
libraries. You need the SPEC_DIR Config variable set.
EXAMPLES:
read_spec1d, 550, 125, sp_struct
read_spec1d,550,125,sp_struct,/plot,nsmooth=10
MODIFICATION HISTORY:
Creation: 15-Aug-2003: Erin Sheldon UofChicago Based roughly on Dave
Johnston's read_spec.pro
(See pro/sdss//read_spec1d.pro)
NAME: REFORM_PTRLIST() PURPOSE: Take an array of pointers, each of which may point to arrays themselves, and return an array of pointers in which the pointers each point to individual objects only. The original pointers are freed unless the /nofree keyword is set. CATEGORY: Utility CALLING SEQUENCE: output = reform_ptrlist(ptrlist, /nofree) INPUTS: ptrlist: Array of pointers. KEYWORD PARAMETERS: /nofree: The original pointers are freed unless this keyword is sent. OUTPUTS: A new pointer array as described in the purpose. OPTIONAL OUTPUTS: status=: 0 for success MODIFICATION HISTORY: 1-August-2005 Erin Sheldon, UChicago
(See pro/util//reform_ptrlist.pro)
NAME:
REMOVE_TAGS()
PURPOSE:
Remove the specified tags from input structure and return what is
left.
CALLING SEQUENCE:
newstruct = remove_tags(oldstruct, tagnames)
INPUTS:
oldstruct: the original structure
tagnames: the names of tags to be removed (can be an array)
OUTPUTS:
newstruct: the new structure without tags.
CALLED ROUTINES:
MATCH
PROCEDURE:
REVISION HISTORY:
????? Judith Racusin
25-OCT-2000 Modified to handle arbitrary tag types. Also error
handling. Erin Scott Sheldon
2006-May-31: Converted to a function. Return -1 when all tags removed.
(See pro/struct//remove_tags.pro)
NAME:
RENAME_TAGS()
PURPOSE:
Rename tags in a structure
CALLING SEQUENCE:
newstruct = rename_tags(struct, oldtagnames, newtagnames)
INPUTS:
struct: The original structure. May be an array.
oldtagnames: names of tags to change
newtagnames: new names for tags
OUTPUTS:
A new structure with tags renamed.
OPTIONAL INPUTS:
verbose: set to greater than 0 for verbose mode. Each changed tag will
be printed.
MODIFICATION HISTORY:
Early 2006: Erin Sheldon, NYU
(See pro/struct//rename_tags.pro)
NAME:
REORDER_TAGS()
PURPOSE:
Reorder the tags in a structure
CALLING SEQUENCE:
newstruct = reorder_tags(struct, ordered_tagnames)
INPUTS:
struct: The original structure. May be an array.
ordered_tagnames: Tags to be placed in the front of the struct in the
specified order. Other tags are placed at the end in their original
order.
OUTPUTS:
A new structure with tags reordered.
Example:
st = {a: 35, b: 66.0, c: 25.2, d: [3.5, 2.2]}
nst = reorder_tags(st, ['c','a'])
print,tag_names(nst)
C A B D
MODIFICATION HISTORY:
Early 2006: Erin Sheldon, NYU
(See pro/struct//reorder_tags.pro)
NAME:
RGBFCHART
PURPOSE:
Create a color finding chart for the input ra/dec position
Calls FIND_RADEC_FCHART to create an r-band fchart, then constructs
the g and i fcharts. Then RGBVIEW is called to create and display
the color image. Various images can be written or the postscript
device can be opened before calling RGBFCHART
CALLING SEQUENCE:
THERE ARE TOO WAYS TO CALL RGBFCHART:
rgbfchart, ra, dec, $ OR
run, rerun, camcol, field, id,
$ ; How big is the image?
/pixels, $
/arcminutes, $
/arcseconds, $
$ ; radius of chart
radius=, $
$
runuse=, $ ; sometimes don't want to use first run found when ra/dec searching
$
$ ; Should we mark positions?
/markPosition, $
markStruct=, $ ; mark style structure for ra/dec (object)
extra_markStruct=, $ ; extra marking structs
$ ; Draw N-E direction arrows?
/directions, $
$ ; display parameters for rgbview
nonlinearity=, $
alpha=, $
low_cut=, $
/sdss, $
/addu,$
/prompt, $
$ ; For writing images
jpegfile=, pngfile=, $
expand=, $
jpegfchart=, pngfchart=,$
z_resolution=, $
$
$ ; These can be returned
$
fu=, fg=, fr=, fi=, fz=, $
struct=, $ ; struct for fields used
photoid=, $ ; index of closest object
objx=, objy=, $
useind=, $
imtot=, $
$ ; Style for X or Z display
addtitle=, title=, xtitle=, $
order=, $
/nodisplay, $
rmap=, gmap=, bmap=, $ ; 8-bit color maps
astrans=,$ ; Use the astrans to find radec?
status=, $ ; exit status
maguse=
FOR COMPATABILITY ONLY
saturation=saturation,contrast=contrast, gamma=gamma,$
giffile=giffile, giffchart=giffchart, clip=clip,maxsize=
INPUTS:
Either of these:
ra/dec: coordinates in degrees. This position will be marked in the
image if the /markPosition keyword is sent, and the mark style
can be controlled with the markstruct keyword. Other objects
may be marked using the extra_markstruct input keyword.
run,rerun,camcol,field,id: SDSS id info for object chart is built
around.
OPTIONAL INPUTS:
/pixels: Use pixel units for all entered quantities.
/arcminutes: Use arcminte units (default)
/arcseconds: Use arcsecond units.
radius: Half length of the square finding chart in specifiied units.
runuse: find_radec may return more than one run. Set this value
to an integer to choose which run.
/markPosition: Mark the position of entered object or nearest object if
ra/dec was specified. Default is a cross.
markStruct=: Mark structure describing the mark. e.g
markstruct = {ra: 200.0, dec: 0.0, type: 'circle', radius: 0.5}
for more options, see markstruct_copy_defaults.pro
extra_markStruct=: other positions to be marked.
/direction: Print N-W direction arrows.
nonlinearity: scaled image = asihn(nonlinearity*alpha*(im-sky))/nonlin
alpha:
low_cut: Lowest value in image to use
/sdss: Use SDSS parameters to rescale counts to energy.
/addu: add the u-band to the g image
/prompt: Use a prompt in rgbview to interactively change display
parameters.
jpegfile: File to write full-res jpeg to.
pngfile: same for png
expand=: Integer factor by which to expand the image.
jpegfchart: Name of jpeg file to write a finding chart.
If sent write_jpeg will be called and the image will be
written from the X-window.
pngfchart: png finding chart file.
z_resolution: resoluton in z-buffer, used when no display exists.
addtitle: Additional title to tack on
title: Title
xtitle: xtitle
order: IDL image order
/astrans: use astrans method to find radec
maguse: which magnitude used.
OPTIONAL OUTPUTS:
fu, fg, fr, fi, fz: finding charts individual bands
struct: the PHOTO structure read in to make finding chart
objx, objy: positions in finding chart.
useind: index of objects used as "center".
photoid: index into struct of nearest object to ra/dec
imtot: the bytescaled total rgb image
rmap=rmap, gmap=gmap, bmap=bmap:
If on 8-bit display, one can set these keywords to
a named variable which will be set to the color map
status: if status ne 0 then something went wrong
CALLED ROUTINES:
FIND_RADEC_FCHART (calls many programs)
FCHART
RGBVIEW
CIRC_RADEC
PROCEDURE:
REVISION HISTORY:
Created ??-??-2001. Documentation added 3-Jul-2002
Erin S. Sheldon UofMich
(See pro/sdss//rgbfchart.pro)
NAME:
RGBVIEW
PURPOSE:
Create and display a RGB image from red, green, and blue input images.
This program designed for use with astronomical images:
* The image has the "sky" removed, so that the sky is black.
* An asinh stretch is used, as described in Lupton et al.
astro-ph/0312483
SDSS should use red=i, grn=r, blue=g although this will have false
color. This can be input for each image, or the median is used.
If the device is postscript, then a color postscript is made.
NOTE: The color map is NOT inverted so there is often large amounts
of black space.
Works best on devices with 16 million+ colors, but will work sensibly
with any number of available colors (e.g. 256 in postscript)
Also note that the number of colors on your display does not affect
the optional jpeg/png files that RGBVIEW outputs because it uses full
color range when producing them.
WARNING: this program can use lots of memory. It makes
a copy of each image for speed: each image is converted to float and
sky subtracted. If your images are already sky-subtracted and float then
you should modify this program.
CALLING SEQUENCE:
rgbview, rr, gg, bb, $
$ ; control the stretch
nonlinearity=nonlinearity, $
alpha=alpha, $
scales=scales, $ ; multiply images by this number
sdss=sdss, $ ; set scales for sdss
$ ; range in image
low_cut=low_cut, high_cut=high_cut, $
$ ; sky is subtracted
rsky=rsky, gsky=gsky, bsky=bsky, $
nodisplay=nodisplay, $ ; display?
prompt=prompt, $ ;should we interact with user for display?
$ ; Write jpeg or png
jpegfile=jpegfile, $
pngfile=pngfile, $
expand=expand, $ ; factor to expand pixels when writing image
$ ; read from the screen?
tvread=tvread, $
$ ; some of the images used
color_im=color_im, imtot=imtot, $
$ ; color map used for 8-bit
rmap=rmap, gmap=gmap, bmap=bmap, $
$ ; some screen parameters
xrange=xrange, yrange=yrange, $
title=title, xtitle=xtitle, ytitle=ytitle, $
subtitle=subtitle, $
noframe=noframe, nolabels=nolabels, $
silent=silent, $
_extra=extra_key
THESE KEYWORDS ARE KEPT FOR COMPATABILITY ONLY, AND WILL BE QUIETLY IGNORED
gamma=gamma, saturation=saturation,
contrast=contrast,
rsig=rsig, gsig=gsig, bsig=bsig,
giffile=giffile ;gif no longer supported by IDL
INPUTS:
red, grn, blue: The red, green and blue images. Images must be same size.
OPTIONAL INPUTS:
nonlinearity: Image is scaled as
asinh(alpha*nonlinearity*(image-sky))/nonlinearity The
default is 8, which works well with alpha=0.02 for SDSS
images.
alpha: default 0.02. Controls where the linearity kicks in, i.e. where
the asihn behaves linearly.
For the HDF, I found that nonlinearity=8, alpha=1 works well.
scales: scale for each image 3 elem. array'
low_cut: Lowest value in image to use in the image.
high_cut: Highest value to use in the image.
rsky, gsky, bsky: input sky value of r,g,b images. Avoides running
sigma-clipping to find sky. If not input, these values
can be returned through these keywords.
jpegfile: If a string is sent in this keyword, rgbview will write a jpeg
file containing the image with this filename. Written directly
at full resolution from the images unless /tvread is set.
pngfile: same as above except writes png image file.
expand: Factor to expand pixels when writing image (not tvread)
xrange, yrange, noframe, nolabels: see tvim2
title,xtitle,ytitle,subtitle: Plot labels.
_extra=extra_key: Other plotting keywords.
KEYWORD PARAMETERS:
/sdss: if set, rescales images by energy based on sdss filters.
/nodisplay: if set, no display is made. You might use this if you are
just outputting the jpeg files, maybe in a batch job if used in
conjunction with /prompt
/prompt: if set then user can interactively change display parameters.
/tvread: write the image to file from the display rather than directly
from the composite image.
/silent:
OPTIONAL OUTPUTS:
imtot: image containing ar, ag, ab in the form bytarr(3, n, m). Can be
input directly to write_jpeg to produce 24-bit image.
rmap,gmap,bmap: color map vectors. These are the vectors used to display
this image. If using an 8-bit display, they can be sent to
IDL> WRITE_PNG, filename, TVRD(), rmap, gmap, bmap
If on 8-bit display, you might need to go back to BW linear display
The color map can be reset to BW linear with loadct,0
color_im: a byte 2-d image containing the image used for display with the
8-bit color maps above
CALLED ROUTINES: (lower case are built in IDL procedures)
DCENTER
SIGMA_CLIP
color_quan
bytscl
tv
tvlct
(device)
(write_gif)
(write_jpeg)
PROCEDURE:
REVISION HISTORY:
Author: Erin Scott Sheldon UofMich 11/28/99
(See pro/plotting//rgbview.pro)
NAME:
RND
PURPOSE:
Round a number to the nearest decimal point. Similar to build-in round, but
can round to any digit.
CATEGORY:
Util.
CALLING SEQUENCE:
num = rnd(number [, digit])
INPUTS:
number: the number to be rounded
OPTIONAL INPUTS:
digit: The rounding digit. Default is digit=0, or integer rounding.
OUTPUTS:
number rounded to requested digit.
EXAMPLE:
IDL> print,rnd(3.14159, 4)
3.14160
MODIFICATION HISTORY:
First documented 1-August-2005. Author, Erin Sheldon Uchicago
(See pro/util//rnd.pro)
NAME:
rowcol2eq
PURPOSE:
convert from row/col to equatorial coords, ignoring higher
order terms in the transformation. For this
crude program, you need to read in the transformation file and know
the sdss field to do the transformation.
CALLING SEQUENCE:
rowcol2eq, trans, node, inc, field, row, col, ra, dec, status=
INPUTS:
trans: the astrans file for this run,camcol,bandpass. Use
READ_ASTRANS to get the astrans file.
field: the field
row,col: sdss row/col coordinates for a given bandpass
OUTPUTS:
ra,dec: equatorial coordinates
OPTIONAL OUTPUTS:
status: 1 for success, 0 for failure
PROCEDURE:
The row,col are from 562 of run 756, the r-band
run=756
rerun=44
camcol=3
field = 562
bandpass=2
trans=sdss_read('astrans',run,camcol,bandpass=bandpass,node=node,inc=inc)
rowcol2eq, trans, node, inc, field, row, col, ra, dec
REVISION HISTORY:
15-AUG-2002 Creation. Erin Scott Sheldon UofMich
(See pro/sdss//rowcol2eq.pro)
NAME:
rowcol2munu
PURPOSE:
convert from row-column to great circle coordinates (mu,nu)
CALLING SEQUENCE:
rowcol2munu, trans, field, row, col, mu, nu, ri=ri
INPUTS:
trans: the astrans file for this run,camcol,bandpass. Use
READ_ASTRANS to get the astrans file.
field: the field
row,col: the row,column to be converted to mu,nu
OPTIONAL INPUTS:
ri: the r-i color of the objects.
OUTPUTS:
mu,nu: SDSS great circle coords.
OPTIONAL OUTPUTS:
status: 1 for success, 0 for failure
REVISION HISTORY:
14-NOV-2000 Creation. Erin Scott Sheldon UofMich
(See pro/sdss//rowcol2munu.pro)
NAME:
RUN2STRING
PURPOSE:
Function outputs a string containing run of a photo tsObj
file in the correct format: length 6 with zero padding.
CALLING SEQUENCE:
result = run2string(run)
INPUTS:
run: may be an array.
REVISION HISTORY:
Author: Erin Scott Sheldon Umich 5/25/99
Now just use a format string. 2006-10-07, Erin Sheldon, NYU
(See pro/sdss//run2string.pro)
NAME:
SDSSIDL_CONFIG
PURPOSE:
Return the value of an sdssidl configuration variable
CATEGORY:
SDSS Specific routine
CALLING SEQUENCE:
value = sdssidl_config(varName, /struct, exists=exists)
INPUTS:
varName: The name of the SDSSIDL config. variable to get.
KEYWORD PARAMETERS:
/struct: Return the structure containing all the configuration variables. In
this case the user need not send any arguments.
OUTPUTS:
By default, either the value of the configuration varaible or -1 if it does
not exist.
If /struct, then the configuration structure, or -1 if it cannot be read.
OPTIONAL OUTPUTS:
exists=exists: 1 if the variable exists or 0 if not
COMMON BLOCKS:
sdssidl_config_block, configStruct, tags
SIDE EFFECTS:
If the config file has not been loaded, then sdssidl_load_config is run and
the common block above is modified.
EXAMPLE:
;; Read the sdss data_dir config variable
data_dir = sdssidl_config('data_dir')
;; List the available configuration variables
help,sdssidl_config(/struct),/str
;; Check for a variable and if it is defined, continue
lss_dir = sdssidl_config('lss_dir', exists=lss_dir_exists)
if lss_dir_exists then begin
file = lss_dir + '......'
MODIFICATION HISTORY:
Created: Nov-2004, Erin Sheldon UChicago
(See pro/sdss//sdssidl_config.pro)
NAME: SDSSIDL_LOAD_CONFIG PURPOSE: Load the configuration file. The $SDSSIDL_CONFIG variable msut be set by the user. The configuration variables are loaded into a structure, stored in a common block. In addition, the hostname and the ra/dec search runs are loaded. CATEGORY: SDSS specific routine. CALLING SEQUENCE: sdssidl_load_config COMMON BLOCKS: sdssidl_config_block SIDE EFFECTS: configStruct and tags, from the common block, are set RESTRICTIONS: The $SDSSIDL_CONFIG environment variable must be set by the user. MODIFICATION HISTORY: Created: Erin Sheldon UofChicago
(See pro/sdss//sdssidl_load_config.pro)
NAME: SDSSIDL_SETUP PURPOSE: Set up SDSSIDL variables. The global variable !sdss is created. This is an instance of the sdss class. This class inherits sdss_files, sdss_flags, and sdss_util classes. CATEGORY: SDSS specific routine. CALLING SEQUENCE: sdssidl_setup, /silent, /reload_config RESTRICTIONS: To load the config file, the user must set the $SDSSIDL_CONFIG environment variable. This is automatically set if the sdssidl_setup shell script is sourced. MODIFICATION HISTORY: Created: Erin Sheldon, UofChicago
(See pro/sdss//sdssidl_setup.pro)
NAME:
SDSS_EXTRACT
PURPOSE:
Applies a user defined extraction function to an SDSS column....
INPUTS:
filename: name of input fits file
ofilename: output fits file (will overwrite existing file)
command_name: command to use for extraction
This MUST take as arguments
list (input)
index (output)
It should return -1 in the index if nothing passes.
taglist: A list of photo tags in all CAPS that the user wants
in struct
nframes: Optional parameter which tells how many frames to read
from filename
start: Beginning fram
max_mag: maximum magnitude to use (default=20)
sig_clip: Number of sigma for clipping large radius objects (default=3)
addrow: Optional parameter which tells how many rows the user
wants to add to objc_rowc (That tag must be in taglist)
groupn: How many frames to take together
Outputs: fits file containing stars
Author: Phil Fischer
Date: 1/14/9
Modified: Tim McKay
Date: 5/6/99
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(See pro/sdss//sdss_extract.pro)
NAME:
sdss_file()
PURPOSE:
Return an SDSS file name for the input filetype, and id information.
CATEGORY:
SDSS specific
CALLING SEQUENCE:
file=sdss_file(type, run, camcol, rerun=, bandpass=, fields=,
dir=, /nodir, /stuffdb, exists=)
INPUTS:
type: file type. For a list of types do
print,!sdss->supported_filetypes()
run: The sdss run.
camcol: The camcol. This is optional for some file types.
OPTIONAL INPUTS:
rerun: SDSS rerun. If not sent, the run_status structure is searched
for the run and the latest rerun is returned.
bandpass: The bandpass in numerical of string form where
u,g,r,i,z -> 0,1,2,3,4
fields: The fields to read. Defaults to a pattern with '*' for the
field number.
/nodir: Do not prepend the directory.
/stuffdb: Filenames for db stuffing.
OUTPUTS:
The file name.
OPTIONAL OUTPUTS:
dir: The directory.
exists: 1 for yes, 0 for no
RESTRICTIONS:
If rerun is not sent, the run must be defined in the run status structure.
MODIFICATION HISTORY:
Created Erin Sheldon, UChicago
(See pro/sdss//sdss_file.pro)
NAME:
SDSS_FILES__DEFINE
PURPOSE:
A class definition file containing methods for dealing with sdss files.
This is a much more compact way to store these programs and avoids
namespace collisions.
SOME METHODS Defined in this class file:
INITIALIZE A NEW OBJECT:
IDL> sf = obj_new('sdss_files')
RUN_EXISTS
IDL> if sf->run_exists(run, reruns=, info=) then ...
can return array of available reruns and info structs
RERUN_EXISTS
IDL> if sf->rerun_exists(run, rerun) then ....
RERUN
IDL> reruns = sf->rerun(runs, /min)
By default it finds latest rerun for the input run. Set /min to find
earliest. Can send an array of runs.
STRIPE
IDL> stripes = sf->stripe(runs)
STRIP
IDL> strips = sf->strip(runs)
RUNS
IDL> runs = sf->runs()
Get a list of all unique runs
RUNS_RERUNS
IDL> sf->runs_reruns, runs, reruns
Get a list of runs and reruns. Runs may be duplicated here.
RUNDIR
IDL> rundir = sf->rundir(run, rerun=, /min, /corrected, exists=)
Get the directory for an sdss run. See rerun for /min.
FILEDIR
IDL> dir = sf->filedir(subdir, run, rerun=, camcol=, /corrected, exists=])
Get the directory for a subdir of a run. Valid subdirs:
astrom, calibChunks, corr, nfcalib, objcs, photo, zoom, rezoom,
combined. If camcol is sent, and there are camcol subdirectories for
this type, then that is appended to the directory.
FILE2FIELD
IDL> fields = sf->file2field(files)
Extract the field numbers from a set of sdss files. Assumes last 0000
represent the field, as in tsObj-000756-3-44-0803.fit
FILELIST
IDL> files = sf->filelist(filetype, run, camcol, rerun=, bandpass=,
fields=, dir=, exists=)
Get all the files of a certain type. Valid file types:
tsObj, tsField, fpObjc, fpAtlas, fpM, fpBin, psField, adatc
FILE
IDL> name = sf->file(type, run, [camcol, fields=, rerun=, bandpass=, dir=,
/nodir, /stuffdb])
Supported file types: asTrans, tsObj, tsField,
fpObjc, fpAtlas, fpM, fpBIN, fpFieldStat,
psField, psBB, adatc
All types except asTrans require that the camcol is entered.
For fpM, fpBIN, and psBB you must enter the bandpass as an integer or
string.
If fields is not entered, a value of '*' is used. Useful for making file
patterns. Fields can be an array.
Examples:
IDL> fname = sf->name('tsObj', 756, 2, field=125, /nodir)
IDL> file = sf->name('asTrans', 756)
READ
This is still basic. Will add more functionality such as is in
read_tsobj.
IDL> struct = sf->read(type, run, [camcol, fields=, rerun=, bandpass=,
taglist=, wstring=, /pointers, status=)
STRIPE2STRING
IDL> result = sf->stripe2string(stripes)
RUN2STRING
IDL> result = sf->run2string(runs)
FIELD2STRING
IDL> result = sf->field2string(fields)
ID2STRING
IDL> result = sf->id2string(ids)
METHODS
IDL> methods,'sdss_files'
IDL> doc_method,'sdss_files::read'
HELP
Print the documentation for this class
COMMON BLOCKS:
sdss_files_filelist_block, filetype_old, run_old, rerun_sent, rerun_old, $
camcol_sent, camcol_old, files_old
RESTRICTIONS:
Needs to read the run_status file for most operations.
MODIFICATION HISTORY:
Created: 12-Apr-2005, Erin Sheldon, UofChicago. Consolidated from
existing procedures.
(See pro/sdss//sdss_files__define.pro)
NAME:
SDSS_FLAG
PURPOSE:
Return the SDSS flag value given the flag name.
CATEGORY:
SDSS specific
CALLING SEQUENCE:
flagval = sdss_flag(flag_type, flag_name, status=)
INPUTS:
flag_type: The flag type. A list of supported types can be gotten from
The !sdss->flagtypes() function. E.g. OBJECT1, PRIMTARGET, etc.
flag_name: The flag name, e.g. GALAXY, or PRIMARY
OUTPUTS:
The flag value
OPTIONAL OUTPUTS:
status: 1 for success, 0 for failure
EXAMPLES:
IDL> print,sdss_flag('target', 'galaxy_red')
32
if (primtarget and sdss_flag('target','galaxy_red')) ne 0 then .....
MODIFICATION HISTORY:
Added to archive mid 2005 from ancient existing code. Erin Sheldon, UChicago
(See pro/sdss//sdss_flag.pro)
NAME:
SDSS_FLAGS__DEFINE (An IDL Class File)
PURPOSE:
Defines a set of methods for doing SDSS flag selection.
CATEGORY:
SDSS
CALLING SEQUENCE:
sf=obj_new('sdss_files')
SIDE EFFECTS:
The sdss flagvals file is read and internal pointers are created to
the data.
RESTRICTIONS:
The flagvals.idl data file must exist in the expected place.
getenv("SDSSIDL_DIR")+'/data/flagvals.idl'
METHODS:
Use the methods procedure to list the methods of this file.
IDL> methods, 'sdss_files'
And the doc_method procedure to get documentation on individual
methods.
IDL> doc_method, 'sdss_files::flag_select'
A quick list of useful methods:
::flag_select(flags,type,select_struct) - Do flag selection using a flag struct
::flag(type,name) - Return the flag value for the input type and name
::flagtypes() - Return available flag types.
::flagnames(type) - Return flag names for a given flag type.
::print_flagdefs - Print all available flag info.
EXAMPLES:
IDL> sf=obj_new('sdss_flags')
IDL> fst = {galaxy_red: 'Y'}
IDL> si = sf->flag_select(st.primtarget, 'primtarget', fst}
IDL> fst = {child: 'y', satur: 'n'}
IDL> si = sf->flag_select(st.flags[2], 'object1', fst)
; Choose either lrg or main sample galaxies usign the /orflags option.
IDL> fst = {galaxy_red: 'Y', galaxy: 'Y'}
IDL> si = sf->flag_select(st.primtarget, 'primtarget', fst, /orflags}
NOTE: If sdssidl_setup is run, you can use these methods from the
!sdss object. e.g.
IDL> print, !sdss->flag('object1','bright')
MODIFICATION HISTORY:
Created: Mid-2005 Erin Sheldon Uchicago
(See pro/sdss//sdss_flags__define.pro)
NAME:
sdss_flag_plot
PURPOSE:
Plot a histogram of the flags set for a set of objects.
CALLING SEQUENCE:
sdss_flag_plot, flags, flagtype, _extra=_extra
INPUTS:
flags: a flag array.
flagtype: The flag type. Currently supported flags may be listed
using the
IDL> sf->print_flagtypes
method, but is most likely at least
OBJECT1, OBJECT2, PRIMTARGET, SECTARGET, STATUS
OPTIONAL INPUTS:
_extra: Extra plotting keywords.
EXAMPLE:
sdss_flag_plot, struct.primtarget, 'primtarget'
MODIFICATION HISTORY:
Generalized from old program. 2006-12-3, Erin Sheldon, NYU.
(See pro/sdss//sdss_flag_plot.pro)
NAME:
sdss_flag_print
PURPOSE:
Print all flags that are set.
CALLING SEQUENCE:
sdss_flag_print, flags, flagtype, _extra=_extra
INPUTS:
flags: a flag array.
flagtype: The flag type. Currently supported flags may be listed
using the
IDL> sf->print_flagtypes
method, but is most likely at least
OBJECT1, OBJECT2, PRIMTARGET, SECTARGET, STATUS
EXAMPLE:
sdss_flag_print, struct.flags2, 'object2'
MODIFICATION HISTORY:
Generalized from old program. 2006-12-3, Erin Sheldon, NYU.
(See pro/sdss//sdss_flag_print.pro)
NAME:
sdss_flag_select_struct
PURPOSE:
Return a flag selection structure for a given flag type. This can be
sent to sdss_flag_select. This will also show you all the possible
flags for a given type, although not all elements must be in the
structure sent to sdss_flag_select.
CATEGORY:
SDSS specific routine
CALLING SEQUENCE:
fs = sdss_flag_select_struct(flagtype, default=, status=)
INPUTS:
flagtype: The flag type. Currently supported flags may be listed
using the
IDL> ft = sf->flagtypes()
or
IDL> sf->print_flagdefs
methods, but are most likely at least
OBJECT1, OBJECT2, PRIMTARGET, SECTARGET, STATUS, RUNSTATUS
OPTIONAL INPUTS:
default: The default selection value.
'y': yes, the flag is set
'n': no, the flag is not set
'd': Don't care
The default value is 'd'
OUTPUTS:
A flag select structure that can be sent to sdss_flag_select
OPTIONAL OUTPUTS:
status: 1 for success, 0 for failure.
EXAMPLES:
IDL> fs=sdss_flag_select_struct('object2')
IDL> fs.bright = 'N'
IDL> fs.satur = 'N'
IDL> keep = sdss_flag_select(struct.flags2, 'object2', fs)
Alternatively, if you already know the flags to check:
IDL> fs = {bright:'n', satur:'n'}
IDL> keep = sdss_flag_select(struct.flags2, 'object2', fs)
MODIFICATION HISTORY:
(See pro/sdss//sdss_flag_select_struct.pro)
NAME:
sdss_flag_truct([flagtype], status=)
PURPOSE:
Return the flag structure for all types or a given type if
the flagtype parameter is sent. This structure contains the
flag values by name; e.g. if no flagtype is sent, the object1
flag "bright" is given by:
flagstruct.object1.bright
if flagtype "object1" is sent then this is simplified:
flagstruct.bright
Note, individual flag values can be extracted with the flag
method, or sdss_flag() procedure:
print,sdss_flag(flagtype,flagname)
CALLING SEQUENCE:
si = sdss_flag_struct(flagstype)
INPUTS:
flagtype: The flag type. Currently supported flags may be listed
using the
IDL> ft = sf->flagtypes()
IDL> sf->print_flagdefs
methods, but is most likely at least
OBJECT1, OBJECT2, PRIMTARGET, SECTARGET, STATUS
OUTPUTS:
The flag structure.
OPTIONAL OUTPUTS:
status: 1 if success, 0 if failure
EXAMPLES:
IDL> fs=sdss_flagstruct('object1')
MODIFICATION HISTORY:
Created: Mid-2004 Erin Sheldon Uchicago
(See pro/sdss//sdss_flag_struct.pro)
NAME:
SDSS_GENRAND
PURPOSE:
Generate random points for photometric or spectroscopic galaxies using
masks. For photometric galaxies, hierarchical pixel masks are used
(generated by Ryan Scranton). For spectroscopic galaxies spherical polygons
are used, based on the tiling (generated by Max Tegmark). One can also
apply the photometric mask to the spectroscopic random points with
/photmask. Edge checking can also be performed for specgals (not yet
implemented).
NOTE: This code uses apply_sphpoly_mask.pro and apply_pixel_mask.pro.
These routines call complied C code, which must be compiled before
running this program. Also, the pixel code uses the gsl (gnu
scientific libraries) which must also be installed on the system.
CATEGORY:
SDSS specific routine
CALLING SEQUENCE:
sdss_genrand
INPUTS:
stripes: For which stripes should be generate random points? e.g. [10,11,12]
nrand: number of random points.
OPTIONAL INPUTS:
phot_maskfile: The mask file for the photometric pixel mask.
spec_maskfile: The mask file for the specgal spherical polygon mask.
primary_bound_array: the overall boundaray array for these stripes. By default, the
boundary array is created from primary_bound_multi, stripes, each_bound,
bound_array. Note: Currently the pixel maks code implements bounds based
on the primary survey area.
angmax: max angle around each point to search for edges. If this is sent,
edges are checked. Only used if /photmask is also set.
compcut: A completeness cut for the specgal points. Each point in the sky
has a completeness based on the existing spectroscopy. compcut=0 will
cover all the area observed spectroscopically, but not all
this area is complete. By setting this to, say, 0.95, one gaurantees
that 95% of the target objects in each region actually has a spectra.
This avoids over-populating incomplete areas with lots of random points.
One should also apply this cut to the actual specgals used.
KEYWORD PARAMETERS:
Types of masks:
/basic, /simple, /bound, /combined. See apply_pixel_mask for an
explanation. Default is /basic
/photmask: apply the boundary photometric mask to the spectra
/twoquad: when checking for edges (angmax is sent), use the two quadrant
check method. In this case, a point is still ok if two adjacent
quadrants do not find an edge or hole.
/silent: Don't print anything (note the C programs print things anyway).
OUTPUTS:
clambda, ceta: The random points in corrected lambda/eta coordinates.
OPTIONAL OUTPUTS:
edgeflag=edgeflag: will be returned if edges are checked.
maskflags=: Flags from the mask code.
EXAMPLES:
* To generate spectro objects with completeness greater than 0.9
stripes = [10,11,12]
nrand = 100000
compcut=0.9
sdss_genrand, stripes, nrand, clambda, ceta, /spec, compcut=compcut
* To generate with a cut on the photometric masks:
sdss_genrand, stripes, nrand, clambda, ceta, /spec, /photmask
* To check for edges against the photometric mask
angmax = replicate(0.2, nrand) ;degrees
sdss_genrand, stripes, nrand, clambda, ceta, /spec, /photmask, angmax=angmax
* To generate random points from the photometric mask, not including the
* combined or "junk" masks
sdss_genrand, stripes, nrand, clambda, ceta
* To include the junk masks
sdss_genrand, stripes, nrand, clambda, ceta, /combined
EXTERNAL ROUTINES:
primary_bound_multi.pro
|-> primary_bound.pro
apply_sphpoly_mask.pro
|-> sphpoly_completeness.pro
apply_pixel_mask.pro
arrscl.pro
MODIFICATION HISTORY:
Created: 25-May-2003 Erin Scott Sheldon
(See pro/sdss//sdss_genrand.pro)
NAME: SDSS_MAGUSE PURPOSE: Given a structure, look for magnitude arrays and return the tag index of the first one found. The default is to look for CMODEL_COUNTS, then COUNTS_MODEL, PETROCOUNTS, FIBERCOUNTS, PSFCOUNTS. The user can tell it to look for a specific tag as well using the magUse keyword. CATEGORY: SDSS specific routine CALLING SEQUENCE: wmag = sdss_maguse(struct, magUse=magUse, /silent) INPUTS: struct: A structure. OPTIONAL INPUTS: magUse: the name of the magnitude to look for. KEYWORD PARAMETERS: /silent: no informative messages. OUTPUTS: the tag index of the matching magnitude array. EXAMPLE: run=756 rerun=40 camcol=3 field=125 nFrames=20 read_tsobj, [run,rerun,camcol], struct, start=field, nFrames=nFrames wmag = sdss_maguse(struct) MODIFICATION HISTORY: Creation: ??-??-2003 Erin Sheldon UofChicago
(See pro/sdss//sdss_maguse.pro)
NAME:
sdss_objname
PURPOSE:
Generate a standard sdss filename chunk from SDSS id info.
CALLING SEQUENCE:
name = sdss_objname(run,rerun,camcol,field,id,front=)
EXAMPLE:
IDL> print,sdss_objname(756,137,2,125,221, front='myobject-')
myobject-000756-137-2-0125-00221
CREATED:
Erin Sheldon, UofMichigan, ????
(See pro/sdss//sdss_objname.pro)
NAME:
sdss_postgres__define (IDL Class File)
PURPOSE:
This class inherits the POSTGRES class and provides a simple way to access
postgres tables by SDSS id information (run, rerun, camcol, field, id) and
the composite 64-bit id "photoid". The user can send various levels of id
information, from just runs to individual run,rerun,camcol,field,ids (or
photoids).
CATEGORY:
SDSS routine.
CALLING SEQUENCE:
sp=obj_new('sdss_postgres', connect_info=)
OPTIONAL INPUTS:
connect_info: This is stored at initialization so can be used later
without sending. Useful if not using the database listed in the
PGDATABASE environment variable for example.
METHODS:
You can list the methods using
IDL> methods,'postgres' and see the
individual documentaion for each using
IDL> doc_method,'postgres::methodname'
This class also inherits all the methods of POSTGRES.
sdss_postgres::readbyid()
Read data given the any of the id information, from just runs to the
full run,camcol,field,id (rerun optional).
sdss_postgres::read_photoids()
Read data for a list of photoids. Given an input list of photoids,
generates a set of queries to retrieve the data. There is a limit to
lenght of a query, so this program breaks up the list into multiple
queries. Assumes the query length has been increases so it can send
about 10,000 photoids in a single query.
Alternatively, a structure with run,rerun,camcol,field,id may be
sent and photoids will be generated.
photoids are generated from run,rerun,camcol,field,id with the
sdss_util::photoid() method.
sdss_postgres::send_queries
Takes a list of input queries and collates the results from each and
returns a single structure. This takes care of the bookkeeping for
multiple queries.
The readbyid() function calls one of a number of functions depending on
the arguments.
sdss_postgres::read_runs(): If only runs are sent.
sdss_postgres::read_camcol(): If runs,camcols sent.
sdss_postgres::read_fields(): If runs,camcols,fields sent.
sdss_postgres::read_ids(): If runs,camcols,fields,ids sent.
|-> sdss_postgres::read_photoids().
RESTRICTIONS:
EXAMPLE:
IDL> sp=obj_new('sdss_postgres')
IDL> res = sp->readbyid('datasweep', 756, 3, [125, 166, 172])
IDL> res = sp->readbyid('datasweep', struct, columns=['ra','dec'])
IDL> pid = sp->photoid(struct)
IDL> res = sp->read_photoids('datasweep', pid, clauses='modelfux > 200000')
MODIFICATION HISTORY:
Created: Mid-2005 Erin Sheldon.
(See pro/sdss//sdss_postgres__define.pro)
NAME:
sdss_psfrec()
PURPOSE:
reconstruct the psf at position (row,col) in an sdss
field from the KL-decompositions. These can be read
from the psField files using sdss_read()
CATEGORY:
SDSS specific routine.
CALLING SEQUENCE:
psf=sdss_psfrec(struct, row, col, counts=)
INPUTS:
struct: A PSF KL-decomposition structure read from
a psField file.
row,col: row and column in the field.
OPTIONAL INPUTS:
counts: The total counts in the image. Default is
whatever comes from the reconstruction, which
is usually close to unity.
OUTPUTS:
An image of the PSF.
EXAMPLE:
kl=sdss_read('psfield',run, camcol, field=field, extension=3)
psf=sdss_psfrec(kl, row, col, counts=1000)
MODIFICATION HISTORY:
Added to archive, 2007-03-26, written by Dave Johnston
in the depths of time.
(See pro/sdss//sdss_psfrec.pro)
NAME:
sdss_read()
PURPOSE:
Generic SDSS file reader. Reads asTrans, tsObj, tsField, fpObjc, psField...
Atlas files have a special reader read_atlas. psField files are normally
read the same way as tsObj, etc for extension 6 (the default). For the
other extensions you can send an extension and read a single field only.
CATEGORY:
SDSS routine.
CALLING SEQUENCE:
st = sdss_read(type, run, camcol, rerun=, bandpass=, fields=, /all,
taglist=, wstring=, ex_struct=, extension=, dir=,
/pointers, verbose=, status=)
if type is 'astrans' the extra keywords node= and inc= exist.
INPUTS:
type: The file type. Currently supported types are:
astrans, tsobj, tsfield, fpobjc, psfield
Note: for psField, Multiple files can only be read for
extension=6 (the default)
Atlas files have a special reader sf->atlas read, or for the
procedural interface read_atlas.
run, camcol: SDSS id info.
OPTIONAL INPUTS:
rerun: Rerun number. If not sent, latest is used.
bandpass: For files that require a bandpass.
fields: Field number(s). If not sent, the first is read.
/all: read all fields.
taglist: List of tags to read. Default is all.
wstring: A string that can be sent to the where function to select
objects. Should refer the structure as "lnew"
ex_struct: A structure that will be added to the output structure
definition.
extension: FITS extension to read.
indir: Directory from which to read. Overrides default directory.
dir: Directory used for the read.
/pointers: Return an array of pointers rather than an array of structures.
This saves a factor of two in memory since no copy must be made.
verbose=: Verbosity level. 0 for silent, 1 for some info, 2 for lots.
default 1
/silent: Same as verbose=0. Verbose keyword takes precedence.
OUTPUTS:
An array structure or array of pointers if /pointers is sent.
OPTIONAL OUTPUTS:
status: 0 for success, 1 for failure
EXAMPLES:
run=756
camcol=3
fields=[35,88]
st = sdss_read('tsobj', run, camcol, fields=fields)
kl=sdss_read('psfield', run, camcol, field=field, extension=3)
psf=sdss_psfrec(kl, row, col)
MODIFICATION HISTORY:
Conglomeration of various read tools. Erin Sheldon, NYU
(See pro/sdss//sdss_read.pro)
NAME:
sdss_recframe
PURPOSE:
Reconstruct an SDSS frame from atlas images.
CALLING SEQUENCE:
sdss_recframe, run, camcol, field, rerun=, imu=,img=,imr=,imi=,imz=,
idlist=, struct=, status=
INPUTS:
run,camcol,field,rerun=: SDSS field id.
OPTIONAL INPUTS:
idlist: The list of objects to use for reconstruction by SDSS id. If not
sent, this list is chosen as all objects in the field with no children.
OUTPUTS:
imu,img,imr,imi,imz=: The optional images returned. If the keyword arg
is not present, then that image is not retrieved from disk. This can
save considerable time.
RESTRICTIONS:
The sdss atlas images and either tsobj or fpobjc must be on disk and
in the directories listed in the sdssidl config file.
EXAMPLE:
sdss_recframe, 756, 3, 125, imr=imr
MODIFICATION HISTORY:
Created sometime in 2004. Documented 2006. Erin Sheldon, NYU
(See pro/sdss//sdss_recframe.pro)
NAME:
sdss_runstatus()
PURPOSE:
Return the runstatus information structure. Load the data if needed.
The runstatus structure contains information about each run on disk,
such as stripe, strip, rerun, and whether certain files are found.
CATEGORY:
SDSS utility
CALLING SEQUENCE:
rs = sdss_runstatus(exists=, /reload)
KEYWORD PARAMETERS:
/reload: Reload the runstatus file.
OUTPUTS:
The runstatus structure.
OPTIONAL OUTPUTS:
exists=: 1 if the data was loaded, 0 if not.
/silent: Print nothing.
COMMON BLOCKS:
runstatus_block, runstatus
EXAMPLE:
rs = sdss_runstatus()
runs = rs.run
reruns = rs.reruns
MODIFICATION HISTORY:
Some time in 2004. Erin Sheldon, NYU
(See pro/sdss//sdss_runstatus.pro)
NAME:
sdss_runstatus_create
PURPOSE:
Find files and other info for the runs in the SDSS DATA_DIR and
SHAPECORR_DIR
CALLING SEQUENCE:
sdss_runstatus_create, file=, /photoop
OPTIONAL INPUTS:
file: The output file.
/photoop: Indicates we are working with photoop outputs instead
of fermilab.
OUTPUTS:
Outputs RUN_STATUS_FILE, a fits file containing info about
known runs.
REVISION HISTORY:
14-NOV-2000 Erin Scott Sheldon UofMich
30-Nov-2006: Renamed
(See pro/sdss//sdss_runstatus_create.pro)
NAME:
sdss_runstatus_print
PURPOSE:
Decode and print the status for the input run/rerun
CALLING SEQUENCE:
print_runstatus, run, rerun
INPUTS:
run: photo run
rerun: photo rerun
OUTPUTS:
print to screen
REVISION HISTORY:
Creation:
??-??-2000: Erin Scott Sheldon UofChicago
18-Nov-2002: Added bad2 flag checking: tsField files
(See pro/sdss//sdss_runstatus_print.pro)
NAME:
sdss_specline_name
PURPOSE:
Convert the restframe wavelength of a line to its name.
CATEGORY:
Spectra
CALLING SEQUENCE:
name = sdss_specline_name(input_line, type=type, position=position)
INPUTS:
line wavelength in angstroms
OPTIONAL INPUTS:
none
OUTPUTS:
the name in string form, e.g. 'OIII'
CAVEATS: This set of lines only works for 1d_22 for now, there are some in
1d_23 that don't match. So don't panic if some lines don't show;
I'll fix it soon.
OPTIONAL OUTPUTS:
type: what kind of line it is.
positions: used by plot_spec1d. A relative position on the plot device.
MODIFICATION HISTORY:
Creation: 15-Aug-2003: Erin Sheldon UofChicago
(See pro/sdss//sdss_specline_name.pro)
NAME:
SDSS_SPEC_TYPE
PURPOSE:
Convert the spec class number to a string representing the type of the
object. For example, sdss_spec_type(2) is "GALAXY"
CATEGORY:
SDSS specific routine.
CALLING SEQUENCE:
st = sdss_spec_type(spec_cln)
INPUTS:
spec_cln: the spec classification number from spectro 1d. This can be an
array.
OUTPUTS:
The string version of the classification is returned
MODIFICATION HISTORY:
Dave Johnston ??/??/??
Added to archive, documented. Erin Sheldon 15-Aug-2003
(See pro/sdss//sdss_spec_type.pro)
NAME:
sdss_transform__define (and IDL class file)
PURPOSE:
Defines a set of methods for coordinate transformations.
CATEGORY:
SDSS specific
METHODS:
A list of methods can be obtained with
IDL> methods,'sdss_transform'
Documentation can be obtained with
IDL> doc_method,'sdss_transform::methodname'
::eq2csurvey - From equatorial to corrected survey coords.
::csurvey2eq - From corrected survey to equatorial.
::eq2gc - From equatorial to SDSS great circle coords.
::gc2eq - From great circle to equatorial
::munu2rowcol - From mu,nu to CCD row,col
::rowcol2munu - From CCD row,col to mu,nu
::eq2rowcol - From equatorial to CCD row,col
::rowcol2eq - From CCD row,col to equatorial.
These involve the poorly defined "survey coordinates"
::eq2survey - From equatorial to survey coords.
::survey2eq - From survey to equatorial.
::gc2survey - From great circle to survey coords.
::survey2gc - From survey to great circle coords.
MODIFICATION HISTORY:
Consolidated all programs into a class file. 2006-12-3 Erin Sheldon NYU
(See pro/sdss//sdss_transform__define.pro)
NAME:
SDSS_UTIL__DEFINE (An IDL Class File)
PURPOSE:
Defines a set of utility methods usefule for SDSS data manipulation.
Generally one uses the "sdss" class which inherits this one and
some others.
CATEGORY:
SDSS
CALLING SEQUENCE:
su=obj_new('sdss_util')
METHODS:
Use the methods procedure to list the methods of this file.
IDL> methods, 'sdss_util'
And the doc_method procedure to get documentation on individual
methods.
IDL> doc_method, 'sdss_util::photoid'
A quick list of useful methods:
::photoid() - return a unique id given run,rerun,camcol,field,id
or a struct containing those tags..
::photoid_extract: Convert a photoid to the corresponding run,rerun...
::histid() - Return a tree structure for a given set of sdss ids
with the leaves as indices.
::histid_destroy - free the pointers in the tree
::histid_print - print the tree structure.
::psfrec: Reconstruct the psf image given a psf structure as read
with sdss_files::psfield_read()
EXAMPLES:
IDL> su=obj_new('sdss_util')
IDL> phid = su->photoid(run,rerun,camcol,field,id)
;; Get tree structure for objects by run,rerun
IDL> histid = su->histid(run,rerun)
;; Get tree structure for objects by run,rerun,camcol
IDL> histid = su->histid(run,rerun,camcol)
TODO:
Move many of the procedures in the sdss directory into this class.
MODIFICATION HISTORY:
Created: Mid-2005 Erin Sheldon Uchicago
(See pro/sdss//sdss_util__define.pro)
NAME:
SDSS__DEFINE (An IDL Class File)
PURPOSE:
The main SDSS class file. Inherits sdss_util, sdss_files, sdss_flags.
So far the whole point of this class is to inherit the others and
simplify the interface. Most useful if an object is created at
IDL startup as a system variable, e.g. !sdss. This is done by
sdssidl_setup which should be put in your startup file. The startup
file SDSSIDL_SETUP creates a system variable from an instance of this
class !SDSS and all methods may be accessed from there without the
user each time performing the kludgy IDL object declaration. This also
prevents the tedious by-hand memory cleanup of IDL objects.
CALLING SEQUENCE:
sd=obj_new('sdss')
EXAMPLES:
After running sdssidl_setup:
IDL> struct = !sdss->read('tsobj', 756, 2, fields=[35,112])
IDL> if !sdss->run_exists(756) then ....
IDL> fst = {galaxy_red: 'y'}
IDL> si = !sdss->flag_select(struct.primtarget, 'primtarget', fst)
MODIFICATION HISTORY:
Created Mid 2005 Erin Sheldon, UChicago
(See pro/sdss//sdss__define.pro)
NAME: search_color_space PURPOSE: For taking an sdss catalog and selecting objects of desired colors,magnitude and size. Does this by plotting four plots. u-g versus g-r g-r versus r-i r-i versus i-z r versus petrorad(in r color) Then it prompts you to draw a closed curve on all four plots. Then it makes a structure with this information stored in it. The structure and a photo catalog can be handed to make_color_flag which will then flag each objects with a number 0 to 15 ie. it will set each of four bits depending on whether the object was in each one of the four regions selected. So an object with flag =15 was inside of all closed curves drawn. This structure can be saved as a binary table and used later for doing NON-interactive selections. For example one could define the stellar locus once and save it to use again another day. CALLING SEQUENCE: -syntax search_color_space,cat,str,qso=qso, all=all,psf=psf,petro=petro,qsofile=qsofile, hist=hist,radrange=radrange INPUTS: cat : the sdss photo-output structure OUTPUTS: str : the structure containing your selected regions and the transformation parameters to map the data onto this array. This is used by make_color_flag. KEYWORDS: all : if set will use all objects not just stars psf : if set will use psfcounts rather than fibercounts petro : if set will use petrocounts rather than fobercounts qso : if set will over plot known quasars to aid selection of quasars qfile : fits binary file of a certain format will try default file if this is not given quasars from (G. Richards and D. Schneider) hist : if set it will use 2D histograms instead of scatter plots (see "ploth" procedure) radrange : the range to use on petrorad default=[0,6] _extra=ex : extra keywords handed to ploth or plot EXTERNAL CALLS: extract_stars : called if all is NOT set ploth : if hist is set mrdfits : if overplotting quasars exist METHOD: uses IDL function defroi (Define Region Of Interest) to make an array having four regions the first set to 2^0=1 the second set to 2^1=2 the third 2^2=4 and the fourth 2^3=8. All other are set to 0. The parameters for the linear transformation from data to device coordinated are all saved with this array in the structure str. So later one can map a star or galaxy onto this array and read its pixlel. It will map onto four pixles since it has four pairs of data points and these can be summed to give it a flag 0 to 15 indicating uniquely whether it is in each of the regions of interest. Most often people will use this with "select_colors" wrapper which just outputs the index of objects flagging to 15 (ie. they are in all regions) but this program is slightly more general. EXAMPLE see select_colors NOTES DO NOT CHANGE THE WINDOW SIZE it must remain [640,640] for defroi to work HISTORY: written by David Johnston -University of Chicago Physics Department 1999
(See pro/sdss//search_color_space.pro)
NAME:
select_colors
PURPOSE:
An interactive tool for selection sdss objects based on their
colors , magnitudes and size. It will make the following four plots:
u-g versus g-r
g-r versus r-i
r-i versus i-z
r versus petrorad(in r color)
Then it prompts you to draw an arbitrary closed curve on all
four plots. From these curves it selects the objects having
parameters contained in all four regions and outputs their index.
CALLING SEQUENCE:
-syntax select_colors,cat,index,str,stars=stars,qso=qso
qfile=qsofile,hist=hist,radrange=radrange,psf=psf,petro=petro
INPUTS:
cat : the sdss photo-output structure
OUTPUTS:
index : the index of selected points
str : the structure that is made by search_color_space
and given to make_color_fLag
can be saved as a fits binary table for later use
(see those two programs for details)
KEYWORDS:
stars : if set will dispay only stars
(so one can see the locus better)
qso : if set will overplot known quasar colors (to aid
selection of quasars)
qfile : fits binary file of known quasar colors
if not given will try the default file
hist : if set it will use 2D histograms rather than scatter plots.
Aids visualization when many objects are plotted and is faster
when there are many thousands to plot.
radrange : the range on petrorad , the default is [0,6]
psf : if set it will use psfcounts instead of fibercounts
petro : if set it will use petrocounts instead of fibercounts
_extra=ex : extra keywords eventually handed to ploth or plot
EXTERNAL CALLS:
search_color_space
make_color_flag
METHOD:
uses IDL function defroi (Define Region Of Interest)
explained in search_color_space
and make_color_flag
EXAMPLE OF USES:
defining the stellar locus
selecting objects with quasar colors
star galaxy seperation
looking for interesting objects
make multiple selections like so:
IDL> select_colors,cat,stellar
IDL> select_colors,cat(stellar),qsocolor
IDL> qsoindex=stellar(qsocolor)
we have indexed the index so that cat(qsoindex) are indeed the
selected quasars
NOTES
HISTORY: written by David Johnston -University of Chicago
Physics Department 1999
(See pro/sdss//select_colors.pro)
NAME:
setfont
PURPOSE:
Set the font. Currently only supports vector fonts, for which it is
more important since it is difficult to do properly on the fly.
CALLING SEQUENCE:
setfont, font
INPUTS:
font: The vector font number.
OPTIONAL INPUTS:
tmpdir=: The directory to hold the temporary file. Default is /tmp
SIDE EFFECTS:
The default font is set.
RESTRICTIONS:
Must be able to create a temporary file in tmpdir.
EXAMPLE:
; Use the Complex Roman font
setfont, 6
MODIFICATION HISTORY:
2007-08-25: Creation, Erin Sheldon, NYU
(See pro/plotting//setfont.pro)
NAME:
SETUPPLOT
PURPOSE:
Set up default plotting parameters. Parameters are taken from
the !pslayout system variable, created by the pslayout procedure.
The user should put a copy of pslayout in their path and change
the defaults to suit them. Note pslayout contains tags for setting
up X and Z buffer as well as PS
Also runs simpctable, to create a set of colors, and defsymbols
to define the system variables !tsym for true-type font symbols
and !vsym for vector drawn font symbols, and !csym for use with
either true-type or vector drawn fonts. Note, this is obsoleted
by the textoidl() program which allows one to type tex symbols.
CALLING SEQUENCE:
setupplot [, type, /help, /test, true=true, /invbw, tmpdir=]
OPTIONAL INPUTS:
type: if given, the type is set using set_plot, type
tmpdir=: Temporary directory used by setfont for setting the vector
font. Default is /tmp
KEYWORD PARAMETERS:
/true: Can set /true to use true-type fonts. Can be used to override
the x_true and ps_true tags in !pslayout
/test: run a test showing all the symbols created by defsymbols.pro
/help: print simple syntax/help.
/invbw: flip colors
OUTPUTS:
None unless /test, in which case some plots are made.
OPTIONAL OUTPUTS:
None
CALLED ROUTINES:
PSLAYOUT
SIMPCTABLE
DEFSYMBOLS
REVISION HISTORY:
19-Mar-2001 Erin Scott Sheldon UofMich
2007-08-28: Added setfont calls for vector fonts.
(See pro/plotting//setupplot.pro)
NAME:
SIGMA_CLIP
PURPOSE:
a simple sigma clipping algoritm
CALLING SEQUENCE:
sigma_clip, array, amean, asigma, nsig=, niter=,
/silent, pause=, index=, /plot, _extra=
(See pro/statistics//sigma_clip.pro)
NAME:
SIMPCTABLE
PURPOSE:
Define a set of colors for plotting. If the display is 8-bit, a color
table is created.
CALLING SEQUENCE:
simpctable, red_ct, green_ct, blue_ct, bits=bits, help=help
COMMENTS:
Sets system variables with values that correspond to colors.
!Black !White !Red !Green !Blue !Yellow !Cyan !Magenta'
!LightSteelBlue !SkyBlue !DarkSlateGrey'
!SlateGrey !LightBlue !MidnightBlue'
!NavyBlue !RoyalBlue !DodgerBlue'
!DarkBlue !Turquoise !DarkGreen'
!SeaGreen !ForestGreen !LightGreen'
!Sienna !Firebrick !Salmon'
!Orange !OrangeRed !HotPink'
!DeepPink !Violet !DarkRed'
!Purple'
!grey0 grey1 ... !grey100'
For 8-bit device or display this is the default set of colors. This set
can be returned through the colorlist keyword on any device, also including
!p.color at the beginning.
On a true-color display, many more colors are defined: all the colors that
are in the rgb.txt file on unix systems (see the showrgb program).
You can send the keyword /showcolors the command showrgb, which shows
the color names.
On an 8-bit display or device (such as postscript) a new color table is
loaded. 33 colors above are defined plus greys !grey00 to !grey100. Other
grey values are also available in the color table. you want all greys from
0 to 255, run loadct,0
INPUTS:
None
OPTIONAL INPUTS:
bits=bits: input the bits/pixel. Must be either 8 or 24.
If not set, simpctable will
determine it from the number of available colors.
KEYWORD PARAMETERS:
/help: if set, a help message is printed showing the
the system variables set by SIMPCTABLE
/showcolors: run the program showrgb if it exists on the machine
OUTPUTS:
colorlist=: Array of the standard colors listed above.
OPTIONAL OUTPUTS:
red_ct, green_ct, blue_ct: The red, green, and blue color arrays
loaded for 8-bit devices
Useful for writing gif files from the plotting window. This only
makes sense on 8-bit devices
CALLED ROUTINES:
(TVLCT) if 8-bit device
EXAMPLE:
IDL> simpctable
IDL> plot, [0], /nodata, yrange=[-1.2,1.2],xrange=[0,2.*!pi], $
IDL> color=!black, background=!white, xstyle=1
IDL> x = findgen(300)/299.*2.*!pi
IDL> y = sin(x) + randomn(seed,300)/5.
IDL> oplot, x, y, color=!blue
IDL> oplot, x, sin(x), color=!red
REVISION HISTORY:
Written May 09 2000, Erin Scott Sheldon, U. of Michigan
Revision History:
28-Feb-2002 Added all colors in rgb.txt (some 657 colors)
(See pro/plotting//simpctable.pro)
NAME:
spheredist
PURPOSE:
Compute great circle distances and angles between sets of points.
CALLING SEQUENCE:
dis = spheredist(ra1, dec1, ra2, dec2, units=, theta=)
INPUTS:
ra1,dec1: First list of positions in degrees.
ra2, dec2: Second list of positions in degrees.
The lengths of these sets of coordss must make sense for calculations
such as as sin(dec1)*sin(dec2) + cos(dec1)*cos(dec2)*cos(ra1-ra2)
A typical use is a single ra1,dec1 and a longer list of ra2,dec2.
KEYWORDS:
units=: Units of inputs and outputs. Default 1.
1: Input positions in degrees. Outputs in radians.
2: Input positions in degrees. Outputs in degrees.
3: Input positions in radians. Outputs in radians.
4: Input positions in radians. Outputs in degrees.
OUTPUTS:
distance: The distance in radians.
OPTIONAL OUTPUTS:
theta=: Angle east of north from ra1,dec1 (the origin) to the
ra2,dec2 point. (The x-axis points toward the celestial pole;
the y-axis points toward increasing R.A. along a line of constant
dec.) Either the sets 1 and 2 must be the same length or one of
the sets must be length 1.
MODIFICATION HISTORY:
Created 2002 Erin Sheldon, UofMich. Inspired by gcirc.pro and by AEK UW
(See pro/astro//spheredist.pro)
NAME:
SPHOTO_MATCH
PURPOSE:
Match two photo structs by their run, rerun, camcol, field,
and rerun. This uniquely defines each object. Same as
PHOTO_MATCH but works on structs
CALLING SEQUENCE:
sphoto_match, pstruct1, pstruct2, matches1, matches2, $
count=count, /silent
INPUTS:
pstruct1, pstruct2: photo structures. must contain:
run, rerun, camcol, field, id: unique info for each object
OPTIONAL INPUTS:
None.
KEYWORD PARAMETERS:
/silent: don't print out removal of duplicates
OUTPUTS:
matches1, matches2: match indices for each list.
OPTIONAL OUTPUTS:
count: number of matches
CALLED ROUTINES:
MATCH
PROCEDURE:
Call PHOTO_MATCH
REVISION HISTORY:
??/??/00 Erin S. Sheldon
(See pro/sdss//sphoto_match.pro)
NAME:
SPHPOLY_COMPLETENESS
PURPOSE:
Call Andreas' spherical polygon code, which checks ra/dec points against a
spherical polygon mask, and return the completeness.
CATEGORY:
SDSS routine
CALLING SEQUENCE:
sphpoly_completeness, ra, dec, completeness, $
poly_id=poly_id, poly_area=poly_area, $
maskfile=maskfile, verbose=verbose
INPUTS:
ra/dec: scalar or arrays of ra/dec in double precision.
OPTIONAL INPUTS:
maskFile=: The mask file to use. Default is from the config file
KEYWORD PARAMETERS:
/verbose: Print messages.
OUTPUTS:
completeness: The completeness for each ra/dec point.
OPTIONAL OUTPUTS:
poly_id: The polygon id for each object.
poly_area: The area of the polygon each object is in.
RESTRICTIONS:
You must have compiled the code. See the README file in the base directory
of the SDSSIDL distribution.
MODIFICATION HISTORY:
Created Erin Sheldon, UChicago, some time in 2003
(See pro/spherical_polygons//sphpoly_completeness.pro)
NAME:
stringrep
PURPOSE:
Get a string representation that can be used with execute() to create a
variable. This also allows it to be used with mrd_struct() to create
a structure tag. If the /structure keyword is sent then this is
equivalent to size(var, /structure) but the returned structure is
augmented with a new tag 'stringrep' containing the string description.
Currently, only 'NONE' is returned for structures, scalar complex,
objects, and undefined variables. Support for structures and scalar
complex may be added in the future.
CALLING SEQUENCE:
d=stringrep(variable, /structure)
INPUTS:
variable: an IDL variable.
KEYWORD PARAMETERS:
/structure: Same as the result for size(var, /structure) but the returned
structure is augmented with the 'stringrep' tag containing the string
description of the variable.
OUTPUTS:
String description of type structure.
MODIFICATION HISTORY:
Created: 2007-07-23. The descriptor code is based on the old datatype()
program from the Goddard libraries.
(See pro/util//stringrep.pro)
NAME:
STRIPE2STRING
PURPOSE:
Function outputs a string containing stripe of a photo tsObj
file in the correct format: length 2 with zero padding.
CALLING SEQUENCE:
result = stripe2string(stripe)
INPUTS:
stripe: may be an array.
REVISION HISTORY:
Author: Erin Scott Sheldon Umich 23-OCT-2001
Now just use a format string. 2006-10-07, Erin Sheldon, NYU
(See pro/sdss//stripe2string.pro)
NAME:
struct_addtags
PURPOSE:
Add new tags to the structure.
CALLING SEQUENCE:
newstruct = struct_addtags(oldstruct, tagnames, values, structype=)
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
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'"]
newst = struct_addtags(oldstruct, tagnames, values)
CALLED ROUTINES:
MRD_STRUCT
STRUCT_COMBINE
PROCEDURE:
Use mrd_struct to create a new structure.
REVISION HISTORY:
25-OCT-2000, Erin Scott Sheldon
2007-08-09, Converted from add_tags to function. Erin Sheldon, NYU
(See pro/struct//struct_addtags.pro)
NAME:
struct_combine
PURPOSE:
Combine 2 equal length arrays of structures into one array of structures,
with the UNION of the tags. Values from the common tags will be from the
first structure.
CATEGORY:
IDL Structures
CALLING SEQUENCE:
newst=struct_combine(struct_array1, struct_array2)
INPUTS:
struct_array1, struct_array2: equal length arrays of structures.
OUTPUTS:
new_struct: the output struct with the UNION of the tags. Values from the
common tags will be from the first structure.
PROCEDURE:
Get the union of the tags and tag descriptions. The names are
concatenated and the duplicates removed. The order of tags is preserved
except when common tags are found; then the order will be that of the
second structure and the tag definition is also from the second.
COPY_STRUCT is used to copy, first from struct_array2 then from
struct_array1.
MODIFICATION HISTORY:
04-June-2004: created, E. Sheldon, UofChicago
2006-10-06: Now preserves name order. Also, when structs have the
exactly same tags, struct1 is returned. Renamed to struct_combine
because it completely subsumes the functionality of that program.
2007-08-09: Renamed struct_combine and made a function. Erin Sheldon NYU
(See pro/struct//struct_combine.pro)
NAME:
struct_concat
PURPOSE:
for concatenating two arrays of structures of the same type
but not necessarily the same name or order of tag names.
CALLING SEQUENCE:
newst=struct_concat(str1, str2, /different)
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.
If tags differ and /different is sent, then the common tags
are kept.
KEYWORD PARAMETERS:
/different: Allow different structs keeping the common tags.
Original Author: Dave Johnston UofM
Rewrote and included ability to concat different structures keeping
common tags. Erin Sheldon, NYU
2007-08-09: Renamed struct_concat and made into a function.
(See pro/struct//struct_concat.pro)
NAME:
SURVEY2EQ
PURPOSE:
Convert from lambda, eta (SDSS survey coordinates) to ra, dec
Use of these coordinates are not recommended because they do
not form a meaningful system. See the documentation for eq2csurvey.
CALLING SEQUENCE:
survey2eq, lambda, eta, ra, dec
INPUTS:
lambda: Survey longitude in degrees
eta: Survey latitude in degrees
OUTPUTS:
ra: Equatorial latitude in degrees
dec: Equatorial longitude in degrees
REVISION HISTORY:
Written: 5/15/2000 Erin Scott Sheldon
Taken from astrotools.
REVISION HISTORY:
Written: 5/15/2000 Erin Scott Sheldon
Taken from astrotools.
(See pro/sdss//survey2eq.pro)
SPECIAL NOTE:
The file textoidl_trans_sub_super.pro contains two functions,
textoidl_trans_sub_super, and textoidl_sub_sup. The former is the
generic routine for processing TeX sub/superscripts, the
latter is used only by textoidl_trans_sub_super and has no general
utility. Hence it lives here. You will see documentation for
textoidl_trans_sub_super second if you use DOC_LIBRARY.
(See pro/plotting//textoidl.pro)
NAME:
TEXTOIDL
PURPOSE:
Convert a valid TeX string to a valid IDL string for plot labels.
CATEGORY:
text/strings
CALLING SEQUENCE:
new = textoidl(old)
INPUTS:
old -- TeX string to be converted. Will not be in
modified. old may be a string array.
KEYWORD PARAMETERS:
FONT -- Set to 0 to use hardware font, -1 to use
vector. Note that the only hardware font
supported is PostScript.
/TEX_SEQUENCES -- return the available TeX sequences
/HELP -- print out info on use of the function
and exit.
OUTPUTS:
new -- IDL string corresponding to old. out
COMMON BLOCKS:
SIDE EFFECTS:
NOTES:
- Use the procedure SHOWTEX to get a list of the available TeX
control sequences.
- The only hardware font for which translation is available is
PostScript.
- The only device for which hardware font'
translation is available is PostScript.'
- The FONT keyword overrides the font selected'
by !p.font'
EXAMPLE:
out = TeXtoIDL('\Gamma^2 + 5N_{ed}')
The string out may be used in XYOUTS or other IDL text
display routines. It will be an uppercase Gamma, with an
exponent of 2, then a plus sign, then an N with the subscript
ed.
MODIFICATION HISTORY:
$Id: textoidl.pro,v 1.8 2004/07/19 16:48:04 schlegel Exp $
$Log: textoidl.pro,v $
Revision: Added \odot symbol. 2007-08-28, Erin Sheldon, NYU
Revision 1.8 2004/07/19 16:48:04 schlegel
Replace calls to the obsolete function RSTRPOS() with STRPOS(/REVERSE_SEARCH).
Revision 1.7 2000/11/20 02:27:24 dfink
Added \AA option for Anstroms
Revision 1.6 2000/07/12 14:31:33 hogg
fixed another ()/[] bug.
Revision 1.5 2000/06/15 18:21:23 hogg
fixed tiny () -> [] bugs
Revision 1.4 2000/06/03 17:12:42 dfink
Fink's new textoidl - all procedures in one file; avoid name conflict
Revision 1.4 1996/06/14 20:00:27 mcraig
Updated Copyright info.
Revision 1.3 1996/05/09 00:22:17 mcraig
Added error handling, cleaned up documentation.
Revision 1.2 1996/02/08 18:52:50 mcraig
Added ability to use hardware fonts for PostScript device.
Revision 1.1 1996/01/31 18:47:37 mcraig
Initial revision
RELEASE:
$Name: $
COPYRIGHT:
Copyright (C) 1996 The Regents of the University of California, All
Rights Reserved. Written by Matthew W. Craig.
See the file COPYRIGHT for restrictions on distrubting this code.
This code comes with absolutely NO warranty; see DISCLAIMER for details.
(See pro/plotting//textoidl.pro)
NAME:
TEXTOIDL_MATCHDELIM
PURPOSE:
Match open/close delimiters in a string.
CATEGORY:
text/strings
CALLING SEQUENCE:
position = textoidl_matchdelim( strn, [openpos])
INPUTS:
strn -- a string containing an open in
delimiter (e.g. '{') in which you
want to find the matching closing
delimiter (e.g. '}')
KEYWORD PARAMETERS:
OPEN_DELIM -- A single character containing the opening in
delimiter (e.g. '('). Default is '{'
CLOSE_DELIM -- A single character containing the closing in
delimiter (e.g. ')'). Default is '}'
OUTPUTS:
position -- returns the position in strn of the out
closing delimiter, -1 if no closing found.
openpos -- Set to a named variable to receive the out
position of the first opening delimiter.
Optional.
COMMON BLOCKS:
SIDE EFFECTS:
NOTES:
- Any pair of (nonidentical) characters can be used as
delimiters.
EXAMPLE:
textoidl_matchdelim('{one{two}}three') returns 9, the character just
before 'three'.
MODIFICATION HISTORY:
$Id: textoidl.pro,v 1.8 2004/07/19 16:48:04 schlegel Exp $
$Log: textoidl.pro,v $
Revision 1.8 2004/07/19 16:48:04 schlegel
Replace calls to the obsolete function RSTRPOS() with STRPOS(/REVERSE_SEARCH).
Revision 1.7 2000/11/20 02:27:24 dfink
Added \AA option for Anstroms
Revision 1.6 2000/07/12 14:31:33 hogg
fixed another ()/[] bug.
Revision 1.5 2000/06/15 18:21:23 hogg
fixed tiny () -> [] bugs
Revision 1.4 2000/06/03 17:12:42 dfink
Fink's new textoidl - all procedures in one file; avoid name conflict
Revision 1.3 1996/06/14 20:00:27 mcraig
Updated Copyright info.
Revision 1.2 1996/05/09 00:22:17 mcraig
Removed restriction that open delim must be first char. Added argument
to allow for return of position of open delim.
Revision 1.1 1996/01/31 18:41:06 mcraig
Initial revision
RELEASE:
$Name: $
COPYRIGHT:
Copyright (C) 1996 The Regents of the University of California, All
Rights Reserved. Written by Matthew W. Craig.
See the file COPYRIGHT for restrictions on distrubting this code.
This code comes with absolutely NO warranty; see DISCLAIMER for details.
(See pro/plotting//textoidl.pro)
NAME:
TEXTOIDL_NEXTTOK
PURPOSE:
Find the next occurance of any of a set of characters in a
string and return the character which occurs next.
CATEGORY:
text/strings
CALLING SEQUENCE:
tok = textoidl_nexttok( strn, tokens )
INPUTS:
strn -- string to be searched for sub/superscripts in
tokens -- string containing characters to be found. in
KEYWORD PARAMETERS:
POSITION -- Set to a named variable to get position out
of next token, or -1 if none found.
/HELP -- Print useful message and exit.
OUTPUTS:
tok -- Contains the character among tokens which out
occurs next in strn, or null '' if none found.
COMMON BLOCKS:
SIDE EFFECTS:
NOTES:
EXAMPLE:
textoidl_nexttok( 'x^2 + N_j^3', '^_', position=pos ) returns '^' and sets
pos to 1.
MODIFICATION HISTORY:
$Id: textoidl.pro,v 1.8 2004/07/19 16:48:04 schlegel Exp $
$Log: textoidl.pro,v $
Revision 1.8 2004/07/19 16:48:04 schlegel
Replace calls to the obsolete function RSTRPOS() with STRPOS(/REVERSE_SEARCH).
Revision 1.7 2000/11/20 02:27:24 dfink
Added \AA option for Anstroms
Revision 1.6 2000/07/12 14:31:33 hogg
fixed another ()/[] bug.
Revision 1.5 2000/06/15 18:21:23 hogg
fixed tiny () -> [] bugs
Revision 1.4 2000/06/03 17:12:42 dfink
Fink's new textoidl - all procedures in one file; avoid name conflict
Revision 1.3 1996/06/14 20:00:27 mcraig
Updated Copyright info.
Revision 1.2 1996/05/09 00:22:17 mcraig
Generalized so that the next occurence of any of a set of characters will
be returned.
Revision 1.1 1996/01/31 18:41:06 mcraig
Initial revision
RELEASE:
$Name: $
COPYRIGHT:
Copyright (C) 1996 The Regents of the University of California, All
Rights Reserved. Written by Matthew W. Craig.
See the file COPYRIGHT for restrictions on distrubting this code.
This code comes with absolutely NO warranty; see DISCLAIMER for details.
(See pro/plotting//textoidl.pro)
NAME:
TEXTOIDL_STRCNT
PURPOSE:
Count number of occurrences of a substring in a string.
CATEGORY:
text/strings
CALLING SEQUENCE:
num = textoidl_strcnt(strn, substring, [pos])
INPUTS:
string -- The string in which to count occurences. in
substring -- The substring to count occurrences of. in
pos -- the position at which to begin the search. [in]
If not supplied, start at beginning of
string.
KEYWORD PARAMETERS:
/HELP -- Print useful message and return.
OUTPUTS:
num -- Number of occurances of substring in string. out
COMMON BLOCKS:
SIDE EFFECTS:
NOTES:
Overlapping occurances are not counted separately. For
example, counting occurances of 'bb' in 'blah bbb' returns one
occurance.
EXAMPLE:
MODIFICATION HISTORY:
$Id: textoidl.pro,v 1.8 2004/07/19 16:48:04 schlegel Exp $
$Log: textoidl.pro,v $
Revision 1.8 2004/07/19 16:48:04 schlegel
Replace calls to the obsolete function RSTRPOS() with STRPOS(/REVERSE_SEARCH).
Revision 1.7 2000/11/20 02:27:24 dfink
Added \AA option for Anstroms
Revision 1.6 2000/07/12 14:31:33 hogg
fixed another ()/[] bug.
Revision 1.5 2000/06/15 18:21:23 hogg
fixed tiny () -> [] bugs
Revision 1.4 2000/06/03 17:12:42 dfink
Fink's new textoidl - all procedures in one file; avoid name conflict
Revision 1.3 1996/06/14 20:00:27 mcraig
Updated Copyright info.
Revision 1.2 1996/05/09 00:22:17 mcraig
Added fast processing using BYTE arrays if we are counting occurences of
a single character. Added error handling.
Revision 1.1 1996/01/31 18:47:37 mcraig
Initial revision
RELEASE:
$Name: $
COPYRIGHT:
Copyright (C) 1996 The Regents of the University of California, All
Rights Reserved. Written by Matthew W. Craig.
See the file COPYRIGHT for restrictions on distrubting this code.
This code comes with absolutely NO warranty; see DISCLAIMER for details.
(See pro/plotting//textoidl.pro)
NAME:
TEXTOIDL_STRTOK
PURPOSE:
Retrieve portion of string up to token.
CATEGORY:
text/strings
CALLING SEQUENCE:
new = textoidl_strtok( old, token )
INPUTS:
old -- String to be split. Contains text after in, out
token on output.
token -- Token to use in splitting old. in
KEYWORD PARAMETERS:
/TRIM -- set to remove leading blanks from old
before returning.
/HELP -- print useful message and exit.
OUTPUTS:
new -- portion of string up to token. out
old -- portion of old after token. out, in
COMMON BLOCKS:
SIDE EFFECTS:
Input parameter old is modified.
NOTES:
Token may be one or more characters.
If token is not found, returns old and sets old to ''.
EXAMPLE:
If old is 'foo44 bar', then textoidl_strtok( old, '44' ) would return
'foo', and upon return, old will be left with ' bar'. If /TRIM
were set, old would be 'bar' on return.
If old='xyz', then new=textoidl_strtok(old,'a') would return with
new='xyz' and old=''.
THANKS:
To D. Linder who wrote GETTOK, part of the goddard library,
upon which this is based.
MODIFICATION HISTORY:
$Id: textoidl.pro,v 1.8 2004/07/19 16:48:04 schlegel Exp $
$Log: textoidl.pro,v $
Revision 1.8 2004/07/19 16:48:04 schlegel
Replace calls to the obsolete function RSTRPOS() with STRPOS(/REVERSE_SEARCH).
Revision 1.7 2000/11/20 02:27:24 dfink
Added \AA option for Anstroms
Revision 1.6 2000/07/12 14:31:33 hogg
fixed another ()/[] bug.
Revision 1.5 2000/06/15 18:21:23 hogg
fixed tiny () -> [] bugs
Revision 1.4 2000/06/03 17:12:42 dfink
Fink's new textoidl - all procedures in one file; avoid name conflict
Revision 1.3 1996/06/14 20:00:27 mcraig
Updated Copyright info.
Revision 1.2 1996/05/09 00:22:17 mcraig
Added built in help.
Revision 1.1 1996/01/31 18:47:37 mcraig
Initial revision
RELEASE:
$Name: $
COPYRIGHT:
Copyright (C) 1996 The Regents of the University of California, All
Rights Reserved. Written by Matthew W. Craig.
See the file COPYRIGHT for restrictions on distrubting this code.
This code comes with absolutely NO warranty; see DISCLAIMER for details.
(See pro/plotting//textoidl.pro)
NAME:
TEXTOIDL_STRTRANS
PURPOSE:
Translate all occurences of one substring to another.
CATEGORY:
text/strings
CALLING SEQUENCE:
new = textoidl_strtrans(oldstr,from,to,ned)
INPUTS:
oldstr -- string on which to operate. in
May be an array.
from -- substrings to be translated. May be in
an array.
to -- what strings in from should be in
translated to. May be an array.
KEYWORD PARAMETERS:
/HELP -- Set this to print useful message and
exit.
OUTPUTS:
new -- Translated string. Array if oldstr is out
an array.
ned -- number of substitutions performed in out
oldstr. Array if oldstr is an array.
COMMON BLOCKS:
SIDE EFFECTS:
NOTES:
- Any of old, from, and to can be arrays.
- from and to must have the same number of elements.
EXAMPLE:
inp='Many*bad!chars+in_here'
from=['*','!','+','_']
to =[' ',' ',' ',' ']
out = textoidl_strtrans(inp,from,to,ned)
Will produce out='Many bad chars in here', and set ned to 4.
MODIFICATION HISTORY:
$Id: textoidl.pro,v 1.8 2004/07/19 16:48:04 schlegel Exp $
$Log: textoidl.pro,v $
Revision 1.8 2004/07/19 16:48:04 schlegel
Replace calls to the obsolete function RSTRPOS() with STRPOS(/REVERSE_SEARCH).
Revision 1.7 2000/11/20 02:27:24 dfink
Added \AA option for Anstroms
Revision 1.7 2000/11/19 18:25:00 dfink / Jonathan Swift
Added \AA option for Anstroms
Revision 1.6 2000/07/12 14:31:33 hogg
fixed another ()/[] bug.
Revision 1.5 2000/06/15 18:21:23 hogg
fixed tiny () -> [] bugs
Revision 1.4 2000/06/03 17:12:42 dfink
Fink's new textoidl - all procedures in one file; avoid name conflict
Revision 1.3 1996/06/14 20:00:27 mcraig
Updated Copyright info.
Revision 1.2 1996/05/09 00:22:17 mcraig
Sped up significantly by using str_sep to handle the translation. No longer
relies on routines fromother user libraries.
Revision 1.1 1996/01/31 18:47:37 mcraig
Initial revision
RELEASE:
$Name: $
COPYRIGHT:
Copyright (C) 1996 The Regents of the University of California, All
Rights Reserved. Written by Matthew W. Craig.
See the file COPYRIGHT for restrictions on distrubting this code.
This code comes with absolutely NO warranty; see DISCLAIMER for details.
(See pro/plotting//textoidl.pro)
NAME:
TEXTOIDL_SUB_SUP
PURPOSE:
Return the proper IDL font positioning command for TeX
sub/superscripts.
CATEGORY:
TeXtoIDL
CALLING SEQUENCE:
fnt = textoidl_sub_sup( strn )
INPUTS:
strn -- Either '^' or '_', the TeX super/subscript in
characters
KEYWORD PARAMETERS:
/FORCE_UD -- Set this to use !U/!D instead of !E/!I for
sub/superscripts .
/HELP -- Set to print useful message and exit.
OUTPUTS:
fnt -- Either '!U' or !E' for superscripts, out
or '!D' or '!I' for subscripts.
COMMON BLOCKS:
SIDE EFFECTS:
NOTES:
Used only by textoidl_trans_sub_super. Should be kept in same
file.
EXAMPLE:
MODIFICATION HISTORY:
$Id: textoidl.pro,v 1.8 2004/07/19 16:48:04 schlegel Exp $
$Log: textoidl.pro,v $
Revision 1.8 2004/07/19 16:48:04 schlegel
Replace calls to the obsolete function RSTRPOS() with STRPOS(/REVERSE_SEARCH).
Revision 1.7 2000/11/20 02:27:24 dfink
Added \AA option for Anstroms
Revision 1.6 2000/07/12 14:31:33 hogg
fixed another ()/[] bug.
Revision 1.5 2000/06/15 18:21:23 hogg
fixed tiny () -> [] bugs
Revision 1.4 2000/06/03 17:12:42 dfink
Fink's new textoidl - all procedures in one file; avoid name conflict
Revision 1.4 1996/06/14 20:00:27 mcraig
Updated Copyright info.
Revision 1.3 1996/05/09 00:22:17 mcraig
Changed some function calls to reflect changes in those functions, moved
some code out of the main loop that didn't need to be there, added
documentation.
Revision 1.1 1996/01/31 18:47:37 mcraig
Initial revision
RELEASE:
$Name: $
COPYRIGHT:
Copyright (C) 1996 The Regents of the University of California, All
Rights Reserved. Written by Matthew W. Craig.
See the file COPYRIGHT for restrictions on distrubting this code.
This code comes with absolutely NO warranty; see DISCLAIMER for details.
(See pro/plotting//textoidl.pro)
NAME:
TEXTOIDL_TABLE
PURPOSE:
Returns a translation table from TeX to IDL.
CATEGORY:
text/strings
CALLING SEQUENCE:
table = textoidl_table()
INPUTS:
None
KEYWORD PARAMETERS:
/POSTSCRIPT -- If set, return postscript translation
table rather than vector fonts table.
Default is translations for vector
fonts.
/HELP -- Print help and exit.
OUTPUTS:
table -- a 2D text array. table(0,*) contains out
the words to be translated away, table(1,*)
contains the words to translate them to.
COMMON BLOCKS:
SIDE EFFECTS:
NOTES:
To find out what TeX sequences are available, look at
table(0,*).
EXAMPLE:
MODIFICATION HISTORY:
$Id: textoidl.pro,v 1.8 2004/07/19 16:48:04 schlegel Exp $
$Log: textoidl.pro,v $
Revision: Added \odot symbol. 2007-08-28, Erin Sheldon, NYU
Revision 1.8 2004/07/19 16:48:04 schlegel
Replace calls to the obsolete function RSTRPOS() with STRPOS(/REVERSE_SEARCH).
Revision 1.7 2000/11/20 02:27:24 dfink
Added \AA option for Anstroms
Revision 1.6 2000/07/12 14:31:33 hogg
fixed another ()/[] bug.
Revision 1.5 2000/06/15 18:21:23 hogg
fixed tiny () -> [] bugs
Revision 1.4 2000/06/03 17:12:42 dfink
Fink's new textoidl - all procedures in one file; avoid name conflict
Revision 1.7 1996/07/22 23:56:08 mcraig
Added \vartheta.
Revision 1.6 1996/07/12 21:31:42 mcraig
Fixed \varphi in vector font, added \circ.
Revision 1.5 1996/06/14 20:00:27 mcraig
Updated Copyright info.
Revision 1.4 1996/05/09 00:22:17 mcraig
Added command to return to previous font after switching to Greek or
symbol font.
Revision 1.3 1996/02/08 19:49:35 mcraig
Removed control sequence \perp because the postscript code for it is '^'.
Revision 1.2 1996/02/08 18:53:38 mcraig
Added translations for PostScript fonts, and added several new TeX
control sequences.
Revision 1.1 1996/01/31 18:47:37 mcraig
Initial revision
RELEASE:
$Name: $
COPYRIGHT:
Copyright (C) 1996 The Regents of the University of California, All
Rights Reserved. Written by Matthew W. Craig.
See the file COPYRIGHT for restrictions on distrubting this code.
This code comes with absolutely NO warranty; see DISCLAIMER for details.
(See pro/plotting//textoidl.pro)
NAME:
TEXTOIDL_TRANS_SUB_SUPER
PURPOSE:
Translate TeX sub/superscripts to IDL sub/superscripts.
CATEGORY:
text/strings
CALLING SEQUENCE:
new = textoidl_trans_sub_super( old )
INPUTS:
old -- string to be translated from TeX to IDL. in
KEYWORD PARAMETERS:
/RECURSED -- set if this function is being called
recursively.
/HELP -- Set to print useful message and exit.
OUTPUTS:
new -- string old converted from TeX to IDL out
COMMON BLOCKS:
SIDE EFFECTS:
NOTES:
- For best results, when both a sub and superscript are used,
place the shorter of the two first (e.g. 'N^{a}_{bbbb}' is
better than 'N_{bbbb}^{a}').
- Single character sub/super scripts do not need to be
protected by braces.
- Sub/superscripts may be nested (e.g. 'N^{N_1^N}').
EXAMPLE:
out = textoidl_trans_sub_super( 'N^2_{big}' )
Then out='N!U2!N!Dbig!N' which looks like it should on the
display.
LIBRARY FUNCTIONS CALLED:
textoidl_strtok -- Text/string (mcraig)
textoidl_sub_sup -- contained in this file
MODIFICATION HISTORY:
$Id: textoidl.pro,v 1.8 2004/07/19 16:48:04 schlegel Exp $
$Log: textoidl.pro,v $
Revision 1.8 2004/07/19 16:48:04 schlegel
Replace calls to the obsolete function RSTRPOS() with STRPOS(/REVERSE_SEARCH).
Revision 1.7 2000/11/20 02:27:24 dfink
Added \AA option for Anstroms
Revision 1.6 2000/07/12 14:31:33 hogg
fixed another ()/[] bug.
Revision 1.5 2000/06/15 18:21:23 hogg
fixed tiny () -> [] bugs
Revision 1.4 2000/06/03 17:12:42 dfink
Fink's new textoidl - all procedures in one file; avoid name conflict
Revision 1.4 1996/06/14 20:00:27 mcraig
Updated Copyright info.
Revision 1.3 1996/05/09 00:22:17 mcraig
Changed some function calls to reflect changes in those functions, moved
some code out of the main loop that didn't need to be there, added
documentation.
Revision 1.2 1996/02/08 18:54:20 mcraig
Changed default sub/superscript size to be !D/!U rather than !I/!E to
improve readability of plat annotations.
Revision 1.1 1996/01/31 18:47:37 mcraig
Initial revision
RELEASE:
$Name: $
COPYRIGHT:
Copyright (C) 1996 The Regents of the University of California, All
Rights Reserved. Written by Matthew W. Craig.
See the file COPYRIGHT for restrictions on distrubting this code.
This code comes with absolutely NO warranty; see DISCLAIMER for details.
(See pro/plotting//textoidl.pro)
NAME:
TMPFILE
PURPOSE:
Create a temporary, non-existent filename based on random numbers.
CALLING SEQUENCE:
s = tmpfile(prefix=, suffix=, tmpdir=)
OPTIONAL INPUTS:
prefix: A prefix to add to the file name.
suffix: A suffix for the file name.
tmpdir: A directory to prepend to the file name.
Example:
IDL> print,tmpfile(prefix='temp-', suffix='.tmp', tmpdir='/tmp')
/tmp/temp-1187981506047-217287.tmp
Revision History:
Creator: Dave Johnston
Name was not unique enough. Sometimes when two programs called this
one within one second, they could get the same file name.
Cleaned up the code some.
2005-01-28, Erin Sheldon UofChicago
Added tmpdir
2007-08-24, Erin Sheldon, NYU
(See pro/files//tmpfile.pro)
NAME:
TVASINH
PURPOSE:
Display an input image using an asinh stretch (Lupton, et al...)
CATEGORY:
Plotting routine.
CALLING SEQUENCE:
tvasinh, image, $
scaled_image=scaled_image, $
order=, $
nonlinearity=, alpha=, $
sky=, high=, $
/zoom, $
/noframe, /nolabels, $
xtitle=, ytitle=, title=, subtitle=, $
/invbw, $
max_color=, $
_extra=_extra
INPUTS:
image: two-dimensional image.
OPTIONAL INPUTS:
order=: Image order, flips across y-axis.
nonlinearity: Nonlinearity parameter in Lupton's asinh stretch.
alpha: alpha parameter in Lupton's asinh stretch.
sky=: The sky value, saves time.
high: The high value to use, rather than the max in the image.
xtitle=, ytitle=, title=, subtitle=: Plotting keywords
max_color=: Maximum color index available.
KEYWORD PARAMETERS:
/zoom: Allow the user to interactively zoom into the image.
/noframe: Don't draw a frame around the plot.
/nolabels: Don't draw labels on the plot.
/invbw: Invert the greyscale.
OPTIONAL OUTPUTS:
scaled_image=: The user can return the asinh scaled image through this
keyword.
MODIFICATION HISTORY:
Created: Erin Sheldon, UChicago, some time in 2003
(See pro/plotting//tvasinh.pro)
NAME:
tvim2
USEAGE: tvim2,a
tvim2,a,title=,xtitle=,ytitle=,xrange=,yrange=,subtitle=,$
scale=,range=,/noframe,aspect=
PURPOSE:
Display an image.
1. numbered color scale
2. plot title
3. annotated x and y axis
4. simplified OPLOT capability
INPUT a image quantity
Optional keyword input:
**NOTE**: This routine now uses the _extra mechanism to pass
keywords for put_clr_scl.
title plot title
xtitle x axis title
ytitle y axis title
subtitle x axis subtitle
xrange array spanning entire x axis range.
NOTE: TVIM2 only uses XRANGE(0) and
XRANGE(N_ELEMENTS(XRANGE)-1).
yrange array spanning entire y axis range.
NOTE: TVIM2 only uses YRANGE(0) and
YRANGE(N_ELEMENTS(YRANGE)-1).
scale if set draw color scale. SCALE=2 causes steped
color scale
range two or three element vector indicating physical
range over which to map the color scale. The
third element of RANGE, if specified, sets the
step interval of the displayed color scale. It
has no effect when SCALE is not set. E.g.,
RANGE=[0., 1., 0.1] will cause the entire color
scale to be mapped between the physical values
of zero and one; the step size of the displayed
color scale will be set to 0.1.
aspect the x over y aspect ratio of the output image
if not set aspect is set to (size_x/size_y) of the
input image. If set it -1, no aspect ratio is forced.
/noCenter: if set, don't center the display
noframe if set do not draw axis box around image
nolabels If set, inhibits labels on plot and scale.
invbw To invert the color table ie. array=!d.n_colors-1-array
before calling tv. The deault is invbw=1 for the
postscript device and invbw=0 else.
SIDE EFFECTS: Setting SCALE=2 changes the color scale using the
STEP_CT procedure. The color scale may be returned
to its original state by the command, STEP_CT,/OFF
PROCEDURE TVIM first determins the size of the plot data window
with a dummy call to PLOT. When the output device is
"X", CONGRID is used to scale the image to the size of
the available data window. Otherwise, if the output
device is Postscript, scaleable pixels are used in the
call to TV. PUT_COLOR_SCALE draws the color scale and
PLOT draws the x and y axis and titles.
DEPENDENCIES: PUT_COLOR_SCALE, STEP_CT
AUTHOR: Paul Ricchiazzi oct92
Earth Space Research Group, UCSB
Modified version of TVIM by Jeff Bloch, SST-9, LANL
1.12 10/13/95
Added invbw keyword to invert the color table.
The default is invbw=1 for postscript and invbw=0 else.
Changed a line to use bytscl function.
David Johnston UChicago July 1999
Centered up the display. Comments, Cleaned up.
Erin Scott Sheldon UMich 11/24/99
(See pro/plotting//tvim2.pro)
NAME: tvim2_scl PURPOSE: View a peice of an image and retain the coordinates of the original image in that peice CALLING SEQUENCE: tvim2_scl,image,xm,xx,ym,yx,range INPUTS: image is the name of the image to be viewed xm is the minimum x coordinate xx is the maximum x coordinate ym is the minimum y coordinate yx is the maximum y coordinate range is the range with which to view the image OUTPUTS: A zoomed in peice of an image retaining its original coordinates OPTIONAL KEYWORD PARAMETERS: none NOTES: PROCEDURES CALLED: tvim2 REVISION HISTORY: written by Susan Amrose -University of Michigan July 97
(See pro/plotting//tvim2_scl.pro)
NAME:
VIEW_ATLAS
PURPOSE:
Display the atlas images for an object. Images are read using the
dynamically linked DLM rdAtlas (type rdAtlas at the prompt for
syntax).
CALLING SEQUENCE:
view_atlas, objStruct -OR- run, rerun, camcol, field, id,
clr=,
dir=,
index=,
imu=, img=, imr=, imi=, imz=,
imtot=,
col0=, row0=, dcol=, drow=, ncol=, nrow=,
status=,
/info,
maguse=,
/hideradec,
/silent,
_extra=_extra
INPUTS: The user can either input the
run,rerun,camcol,field,id: Unique SDSS identifier
OR
objStruct: a photo structure containig the id information.
OPTIONAL INPUTS:
clr: indices of colors to use. Can be an array. Default is all
bands. Follows photo convention: 0,1,2,3,4 -> u,g,r,i,z
dir: directory of atlas images. THIS IS NOW OPTIONAL, since this
information is stored in a system variable.
index: Index for when input structure is an array. Defaults to zero.
_extra=extra: extra keywords for plotting.
KEYWORD PARAMETERS:
/info: add information to the plot, such as magnitudes, colors,
ra/dec, and position angle when the object is a double.
/hideradec: will not include ra dec in titles
/silent: will run silently unless bad images or missing
images are found
OPTIONAL OUTPUTS:
imu=, img=, imr=, imi=, imz=: The images for individual
colors.
imtot=: An composite image containing all requested bands.
row0=, col0=: objc_rowc, objc_colc position of bottom left corner
of atlas image.
dcol=, drow=: positional difference between each band and the r-band
nrow=, ncol=: number of columns, rows in each image.
status= The exit status. 0 is good, anything else is bad
RESTRICTIONS:
The C-function rdAtlas must be compiled, and the DLM directory must be in
the user's $IDL_DLM_PATH. Also, the directory configuration variable
DATA_DIR
must be set and the runs must be visible from there with the usual
directory structure. If not, then the directory can be sent with the
dir=dir keyword.
EXAMPLES:
Look at the atlas images in each bandpass for first 10 objects in frame 35
of run 109
IDL> run=745 & rerun=20 & camcol=3 & field = 123 & id = 27
IDL> view_atlas, run, rerun, camcol, field, id
Use an input struct. Save the r-band image.
IDL> view_atlas, struct[27], clr=2, imr=red_image
REVISION HISTORY:
Author:
16-Nov-2004: Erin Scott Sheldon UChicago
Based on obsolete get_atlas.pro
Renamed to view_spec1d. 30-Nov-2006, ES NYU
(See pro/sdss//view_atlas.pro)
NAME:
view_spec1d
PURPOSE:
Plot an SDSS spectra. The redshift, spectral classification, spectro id,
and photo object id are also placed on the plot. Lines are labeled if that
information is available.
CATEGORY:
SDSS specific routine
CALLING SEQUENCE:
By id: '
-Syntax: view_spec1d, plateid, fiberid, $'
/noprompt, $'
/nolegend, $'
/nolines, $
mjd=mjd, spec_vers=spec_vers, nsmooth=nsmooth, $'
errclr=errclr, $'
leg_charsize=leg_charsize, $
label_charsize=label_charsize
_extra=_extra'
From structure: '
-Syntax: view_spec1d, struct, $'
/nolegend, $'
/nolines, $
mjd=mjd, nsmooth=nsmooth, $'
errclr=errclr, $'
leg_charsize=leg_charsize, $
label_charsize=label_charsize
_extra=_extra'
INPUTS:
Either
*plateid, fiberid: identifier for SDSS plate number and the fiber number
of the object in the plate. These can be arrays.
Or
*struct: The spectra structure for this object.
view_spec1d will figure out what the user wants based on the inputs.
KEYWORD PARAMETERS:
/noprompt: if plateid and fiberid sent as arrays, then the user will be
prompted to move to the next/previous object in 'X' device. This
behaviour can be turned off with /noprompt.
/nolegend: don't plot the legend, with the type, redshift, and ra/dec
/nolines: don't plot and label the lines
OPTIONAL INPUTS:
mjd=mjd: if plateid/fiberid are entered, then view_spec1d will find the
latest mjd unless this input is given. Must be the same size as
the plateid and fiberid inputs.
spec_vers: a string containing the spectro rerun id. e.g. '1d_23'. The
default is to read this from the SPEC_VERS config variable.
nsmooth=nsmooth: boxcar smooth over this many adjacent pixels
errclr=errclr: color for the error curve. Default is green in X,Z and
blue in PS
nsmooth=nsmooth: Number of neighbors to use in a boxcar average smoothing.
errclr=errclr: color for the noise curve.
leg_charsize=leg_charsize: the charsize for the legend
label_charsize=label_charsize: the charsize for the line labels.
_extra=_extra: plotting keywords
OUTPUTS:
A plot is made on the screen.
RESTRICTIONS:
You need the Goddard idl astronomy procedures and the Umich SDSS idl
libraries. You need the SPEC_DIR variable set in the configuration file.
EXAMPLE:
view_spec1d,550,125,nsmooth=10
plates=[550,655]
fibers=[125,36]
view_spec1d,plates,fibers,nsmooth=10
MODIFICATION HISTORY:
Creation: 15-Aug-2003: Erin Sheldon UofChicago
(See pro/sdss//view_spec1d.pro)
NAME:
WHICH
PURPOSE:
Determine in which library/directory the procedure or function
specified is located in the !PATH. This is useful for finding
out which library a certain procedure comes from, particularly
when there are duplicates. This is similar to the unix
'which' command.
CALLING SEQUENCE:
WHICH, [ proc_name ] ;Find PROC_NAME in !PATH and display
OPTIONAL INPUT:
proc_name - Character string giving the name of the IDL procedure or
function. Do not give an extension. If omitted,
the program will prompt for PROC_NAME.
/show: if set, will show the user the first file found
/help: print syntax
OUTPUTS:
files: An array containing the filenames
SIDE EFFECTS
None.
PROCEDURE:
The system variable !PATH is parsed into individual libraries or
directories. Each library or directory is then searched for the
procedure name.
EXAMPLE:
Find out where the procedure CURVEFIT lives.
IDL> which, 'curvefit'
RESTRICTIONS:
None.
REVISION HISTORY:
29-MAY-94 Modified from getpro.pro by E. Deutsch
14-JUL-95 Fixed for IDL 4.0
03-DEC-2000 Added files and show keywords. Erin Sheldon
21-JUN-2004 Use FILE_WHICH procedure for IDL > 5.3 for significant
speed increase. Fixed intrinsic procedure searching. E.S.
(See pro/files//which.pro)
NAME:
WMOM
PURPOSE:
Find weighted mean,stdev,err of an input array.
CALLING SEQUENCE:
wmom, array, sigma, wmean, wsig, werr, inputweights=, inputmean=,
weights=weights, /noweights, /calcerr
INPUTS:
array: an array of numbers
sigma: the errors on each array element. See below.
OPTIONAL INPUTS:
inputmean: use this number as the mean instead of
re-calculating the mean
weights: Use these as the weights for each point rather than 1/sigma^2. If input,
the sigma input parameter is ignored. If not input but a named variable is
present, the used weights will be returned. (note the inputweights keyword is
still supported but deprecated).
OUTPUTS:
wmean: weighted mean
wsig: weighted standard deviation
werr: weighted error in mean
/noweights: no weight: straight mean/variance is done.
/calcerr: Default is to set the error on the mean to
sqrt(1../total(weights)) where weights = 1/sigma^2 which
is correct for a gaussian distribution. If /calcerr, then the
formula below is used
PROCEDURE:
wi = 1/sig[i]^2 (or use inputweights[i])
wmean = sum( xi*wi)/sum(wi) (or =inputmean)
wsig^2 = sum( wi*(xi-wmean)^2 )/sum(wi)
the error on the mean is simple if the user inputs the
sigmas:
werr = 1./sqrt(sum(wi))
If the user inputs weights, which may not be 1/err^2 then
this formula is used:
werr^2 = sum( wi^2*(xi - wmean)^2 ) / ( sum(wi) )^2
This formula is also used if /calcerr.
REVISION HISTORY:
Author: Erin Scott Sheldon UofMich 8/99
Revision History:
Added optional inputmean, inputweights inputs
Added weights as returned variable
Added noweights keyword. E.S.S. 13-Nov-2001
(See pro/statistics//wmom.pro)
NAME:
WRITE_IDLSTRUCT
PURPOSE:
Write a structure array to a standardized file type ".st". The file is
self-describing such that it can be read using READ_IDLSTRUCT() without
prior knowledge of the file structure. The data is either written as
unformatted binary in the native or IEEE formats or as ascii when the
/ascii keyword is sent. These procedures provide a natural way to write
and read IDL data in ascii or binary form. Unlike fits files, all IDL data
types other than complex and pointers are supported for both formats,
including array fields for strings. Data can be appended naturally using
the /append keyword. Because the user can use the native byte order, read
of files can be much faster, up to a factor of 3 over fits files.
CATEGORY:
File I/O
CALLING SEQUENCE:
write_idlstruct, struct, filename,
/ascii, /csv, /no_c_write,
/ieee_big, /ieee_little,
/append, /noheader,
hdrStruct=hdrStruct,
info_struct=info_struct,
error=error,
status=status
INPUTS:
struct: An IDL structure array. All basic IDL data types other than
complex and pointers are supported for both binary
and ascii formats.
filename: Name of the file to be written or appended.
OPTIONAL INPUTS:
hdrStruct=: The user can input keyword-value to be written into the header
through this structure. For example:
IDL> hdr={date:"12-May-1974", val1:[2.5, 66.7], val2:33}
IDL> write_idlstruct, struct, file, hdrStruct=hdr
info_struct=: This structure contains info on the makeup of the structure,
and output formatting for ascii. It can be returned on the
first call and sent again when appending to save time.
KEYWORD PARAMETERS:
/ascii: write an ascii data file rather than unformatted binary. If the
system routine ASCII_WRITE is present it will be used unless
/no_c_write is sent
/csv: For ascii, use commas to separate values rather than the default
tabs. Note in order to read csv with strings using read_idlstruct you
must have the ascii_read procedure compiled and in your DLM path; tab
separated and csv with numbers can always be read.
/no_c_write: Don't attempt to use the ascii_write C DLM.
/ieee_big: Use IEEE XDR byte ordering rather than the native for
LITTLE_ENDIAN machines (they are the same for BIG_ENDIAN) Using
native format can increase the speed of reads and writes by a
large amount, but then BIG_ENDIAN users must swap the byteorder
to use the data. All this swapping is done automatically by
read_idlstruct so, unlike fits, the user can use whatever is
desired.
/ieee_little: Use LITTLE_ENDIAN byte ordering.
/append: append to the file and update the header. Strings will be written
with the same length as previous writes; otherwise the file could
not be read (except for ascii when ascii_read is available).
/noheader: don't write a header.
OUTPUTS:
The structure is written to a file
OPTIONAL OUTPUTS:
info_struct: see above
status=: 0 for success, otherwise failure.
error=: Description of error that occured.
-1000: Input data is not a structure.
-3000: Unsupported complex type sent
-4000: Other unsupported type
Plus the errors returned by openw
SDSSIDL ROUTINES CALLED:
STRINGREP
SIDE EFFECTS:
For string fields in the structure, the strings are padded to the largest
string in the array for that field. This can take up a lot of extra space
if you have one string in a million that is really long, so you might
consider trimming them yourself. Also, beware of appending with strings
since write_idlstruct will use the previous string length.
COMMON BLOCKS:
write_idlstruct_block, ROW_STRING_FORMAT, isbig_endian, version,
use_c_write, old_info_struct
EXAMPLE:
struct = {a:findgen(10), b:dindgen(10,10), c:23353233}
struct = replicate(struct, 1000)
write_idlstruct, struct, 'test.st'
write_idlstruct, struct, 'test2.st', /ascii
MODIFICATION HISTORY:
Created 02-Jul-2004 Erin Sheldon, UofChicago
Improved /append now ensures proper string lengths. 7-Nov-2005 E.S.
Added support for CSV. Made default delimiter tab rather than space.
Supported styles are tab and csv now. E.S.S, but old space delimited
files can still be read by read_idlstruct.pro. 27-April-2006
(See pro/idlstruct_files//write_idlstruct.pro)
NAME:
XY2RD
PURPOSE:
Compute R.A. and Dec in degrees from X and Y and an astrometry structure
(extracted by EXTAST) from a FITS header. A tangent (gnomonic)
projection is computed directly; other projections are computed using
WCSXY2SPH.
XY2AD is meant to be used internal to other procedures. For interactive
purposes use XYAD.
CALLING SEQUENCE:
XY2AD, x, y, astr, a, d
INPUTS:
X - row position in pixels, scalar or vector
Y - column position in pixels, scalar or vector
ASTR - astrometry structure, output from EXTAST procedure containing:
.CD - 2 x 2 array containing the astrometry parameters CD1_1 CD1_2
in DEGREES/PIXEL CD2_1 CD2_2
.CDELT - 2 element vector giving physical increment at reference pixel
.CRPIX - 2 element vector giving X and Y coordinates of reference pixel
(def = NAXIS/2)
.CRVAL - 2 element vector giving R.A. and DEC of reference pixel
in DEGREES
.CTYPE - 2 element vector giving projection types
.LONGPOLE - scalar longitude of north pole (default = 180)
.PROJP1 - Scalar parameter needed in some projections
.PROJP2 - Scalar parameter needed in some projections
OUTPUT:
A - R.A. in DEGREES, same number of elements as X and Y
D - Dec. in DEGREES, same number of elements as X and Y
RESTRICTIONS:
Note that all angles are in degrees, including CD and CRVAL
Also note that the CRPIX keyword assumes an FORTRAN type
array beginning at (1,1), while X and Y give the IDL position
beginning at (0,0).
No parameter checking is performed.
REVISION HISTORY:
Written by R. Cornett, SASC Tech., 4/7/86
Converted to IDL by B. Boothman, SASC Tech., 4/21/86
Perform CD multiplication in degrees W. Landsman Dec 1994
Rename xy2rd forces tangent projection David Johnston
(See pro/astro//xy2rd.pro)
NAME:
ZERO_STRUCT
PURPOSE:
"Zero" all the elements in a structure. Numbers are set to zero,
strings to '', pointers and objects references to NULL
CALLING SEQUENCE:
zero_struct, struct
INPUTS:
struct: Structure to be zeroed. Can be an array of structures.
REVISION HISTORY:
Created 26-OCT-2000 Erin Scott Sheldon
Better way using struct_assign. 2006-July-21 E.S.
(See pro/struct//zero_struct.pro)