Source: src/idl_cvs/adddate.pro
NAME:
addDate
PURPOSE:
Add days to a date. Tries to return string in same form as input
CATEGORY:
Dates
CALLING SEQUENCE:
newDate = addDate(date, ndays)
INPUTS:
date = date string, e.g., '6/17/1951', '1951/6/17', or 19510617
17 Jun, 1951 Jun 17 1951 1951 Jun 17
17/Jun/85 17-Jun-1951 85-Jun-17 17 June, 1951.
nDays - number of days to add (negative number OK)
KEYWORD PARAMETERS:
JULIAN - if set, return as Julian day
LONGYEAR - if set, return year as 4-digits
OUTPUTS:
newDate = Returned date string
EXAMPLES:
IDL> print, addDate('6/17/1951', 13)
06/30/1951
IDL> print, addDate('June 17, 1951', 13)
June 30, 1951
IDL> print, addDate('6/17/51', 365)
06/16/52
IDL> print, addDate('6-17-1951', -30)
05-18-1951
IDL> print, addDate('17-Jun-1951', -30)
18-May-1951
IDL> print, addDate('20110520', -30)
20110420
IDL> print, adddate(systime(),-2)
28 Jun 11
COMMON BLOCKS:
NOTES:
MODIFICATION HISTORY:
20-May-2011 fix for longdates
19-Feb-2010 add LONGYEAR keyword so 4-digit year returned
17-Aug-2009 Written by Bill Davis
Source: src/idl_cvs/addlabelnodes.pro
NAME:
addLabelNodes
PURPOSE:
Add LABEL sub-nodes to MDSplus signal nodes reading info from a file
CATEGORY:
MDSplus, TCL
CALLING SEQUENCE:
addLabelNodes, shot1, shot2, filename=filename
INPUTS:
shot1 = starting shot number to process (defaults to last shot)
shot2 = last shot number to process (optional)
KEYWORDS:
filename - name of file with info - REQUIRED,
see, e.g., BDAVIS$:[CVS.MISC.WF]tauslabel.dat
the file must contain 4 columns, separated by white space.
the first column is the tagname (without \), the last column is
the Label text enclosed in double quotes. The middle columns
can be any single word or character (file format from another
application).
tree - name of tree -- defaults to 'WF'
COMMON BLOCKS:
NONE
NOTES:
YOU NEED PRIVILEGES to write to the MDSplus tree.
LIMITATIONS:
MODIFICATION HISTORY:
25-Jan-01 Written by Bill Davis.
Source: src/idl_cvs/addmdstags.pro
NAME:
addmdstags
PURPOSE:
Add tags to MDSplus nodes
PROCEDURE:
CATEGORY:
MDSplus, Summary
CALLING SEQUENCE:
addmdstags, shot=shot, nodes=nodes, tags=tags
INPUTS:
KEYWORDS:
shot - shot number to process
nodes - MDSplus node names to which tag will added (all in same tree)
tags - to add
VERBOSE - if set, more info is printed
test - doesn't write to MDSplus
EXAMPLE:
nodes = ['\PASSIVESPEC::TOP.IR.IMG0.RAWDATA.IR_408:TIMES', $
'\PASSIVESPEC::TOP.IR.IMG1.RAWDATA.IR_408:TIMES', $
'\PASSIVESPEC::TOP.IR.IMG2.RAWDATA.IR_408:TIMES' ]
tags = ['img0_408_times', 'img1_408_times', 'img2_408_times' ]
addmdstags, shot=128000, nodes=nodes, tags=tags, /verb, /test
for i=shot1,shot1+499 do addmdstags, shot=i, nodes=nodes, tags=tags, /verb
NOTES:
YOU NEED PRIVILEGES to write to the MDSplus tree.
LIMITATIONS:
Divide by zeroes, etc. will cause a message like:
% Program caused arithmetic error: Floating illegal operand
MODIFICATION HISTORY:
27-Mar-2008 Written by Bill Davis.
Source: src/idl_cvs/addsignodes.pro
NAME:
addsignodes
PURPOSE:
Add signal nodes and tags to a MDSplus tree for many shots
PROCEDURE:
CATEGORY:
MDSplus
CALLING SEQUENCE:
addsignodes, shot1, shot2, tags=[tag1,tag2,tag3,...]
INPUTS:
shot1 = starting shot number to process
shot2 = last shot number to process
KEYWORDS:
tags - tags to add (if defined in the model tree, you
will not need to specify the corresponding nodes).
nodes = if tags are not defined in the model tree, these are necessary
tree - MDSplus tree
usage - for MDSTCL node creation. Default='signal'
VERBOSE - if set, more info is printed
test - doesn't write to MDSplus
NOTES:
YOU NEED PRIVILEGES to write to the MDSplus tree.
LOGIC:
finds node names for tags. Then, if node names are not different
than the "tag" names, does not add tags.
LIMITATIONS:
all signals must be in the same tree
MODIFICATION HISTORY:
11-Apr-07 changed for Linux (add output= to mdstcl)
13-Jun-02 Written by Bill Davis.
Source: src/idl_cvs/addtreetotag.pro
NAME:
addTreeToTag
PURPOSE:
return tags with trees merged in
CATEGORY:
MDSplus, SCOPE
CALLING SEQUENCE:
names = addTreeToTag( tags, trees )
INPUTS:
tags - array of tags, e.g., '\ip1' (if tree already there, will not change)
trees - array of trees (same dimension as tags)
RETURNED:
names - tag names with tree in them, e.g., '\engineering::ip1'
KEYWORDS:
COMMON BLOCKS:
none
EXAMPLE:
IDL> print, addTreeToTag( ['\ip1+\ip2'], ['engineering'] )
\engineering::ip1+\engineering::ip2
IDL> print, addTreeToTag( ['\engineering::ip1.blah+\ip2'], ['engineering'] )
\engineering::ip1.blah+\engineering::ip2
LIMITATIONS:
MODIFICATION HISTORY:
30-Apr-01 Written by Bill Davis
Source: src/idl_cvs/add_tag.pro
NAME:
ADD_TAG
PURPOSE:
Add a new tag to the structure. NOTE: if you want to add more
than one tag at once, use ADD_TAGS
CATEGORY:
Programming
CALLING SEQUENCE:
add_tag, oldstruct, tagname, tagValue, newstruct, structyp=structyp
INPUTS:
oldstruct: The original structure (or array of structures)
tagname: string containing the new tag name
tagValue: the initial value of the new tag, e.g. fltarr(5)
or [3,5,6], or 0L, etc.
KEYWORD PARAMETERS:
structyp: a string with the name of the new structure.
if already defined an error is printed.
OUTPUTS:
newstruct: The structure with the new tag it it.
OPTIONAL OUTPUT
NONE
CALLED ROUTINES:
COMBINE_STRUCTS
REVISION HISTORY:
25-OCT-2000, Judith Racusin.
Source: src/idl_cvs/alphamovie10.pro
NAME:
alphamovie10
PURPOSE:
Plot every 10th frame in time, and overlay
10 d-alpha traces. Have a marching vertical line indicating time
in a plot indicating the Strike Point Radius.
CATEGORY:
Animation, NSTX
CALLING SEQUENCE:
IDL> d=alphamovie10( 138000, tStart=tStart, tEnd=tEnd )
INPUTS:
shot = NSTX shot number
KEYWORD PARAMETERS:
Inputs:
tStart -
tEnd -
rMin - minimum time to display (DEFAULT: 25 )
rMax - minimum time to display (DEFAULT: 85 )
inc - how many D-alpha traces to put on a plot
efit -
xsize - horizontal size of X window (DEFAULT: 600 )
ysize - vertical size of X window (DEFAULT: 450 )
xpos - initial X position of lower left of X window in pixels
ypos - initial Y position of lower left of X window in pixels
charsize - size of characters on plot (Default: 1.5)
verbose - if set, will print many informational messages
debug - if set, will stop before returning
OUTPUTS:
MPEGS can be saved from the IDL Animation Widget interface
EXAMPLE:
IDL> d=alphamovie10( 138000, /verb )
NOTES:
This routine uses X-memory, so too many frames can cause X errors.
Try reducing the number of frames or xsize and ysize.
MODIFICATION HISTORY:
19-Jul-2010 put into xinteranimate by Bill Davis
20-Apr-2010 written by Josh Kallman. cam4_fy10 written by Vlad.
Source: src/idl_cvs/amedian.pro
NAME:
AMEDIAN
PURPOSE:
Works the same as MEDIAN, but the effect tapers off at the edges.
CATEGORY:
Smoothing, Math
CALLING SEQUENCE:
Result = AMEDIAN( ARRAY, WIDTH )
INPUT PARAMETERS:
ARRAY = One or two-dimensional array to be median filtered.
WIDTH = Width of the median filter box.
OPTIONAL KEYWORD PARAMETERS:
None.
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
ARRAY must be one or two-dimensional.
PROCEDURE:
A larger array is constructed with the border filled with the reflected
edges of the original array. Then MEDIAN is applied to this larger
array, and the area corresponding to the original array is returned as
the result of the function.
MODIFICATION HISTORY:
26-Oct-2010 added edge keyword
15-Jul-2008 for True Color images (dimensioned [3,xsize,ysize]),
smooth over each color.
12-Jun-01 Made work for 1 dimension of 2 being small. [BD]
21-Feb-01 Just return array if width < or = 1. [BD]
WRITTEN by William Thompson, February 1993.
Source: src/idl_cvs/anim2cine.pro
NAME:
anim2cine
PURPOSE:
Create an mpeg or avi movie from two .cin files from Phantom Cameras.
The data can be color or monochrome
CATEGORY:
animation
CALLING SEQUENCE:
anim2cine, CineFile1, CineFile2, movieFile=movieFile, t1=t1, t2=t2
INPUTS:
CineFile1 - cine file
CineFile2 - (optional)
-
OPTIONAL KEYWORD PARAMETERS:
movieFile - name of output MPEG or QuickTime file (will default to a nice name), or
prefix - what would precede _shot_t1_t2 (in msec) in the output filename
t1 - start time of animation in seconds
t2 - end time of animation in seconds
VIEW - if set, just displays images, and does not make an mpeg
ndups - if given means repeat every image 'ndups' times
despeckle - if set call despeckle routine (slow, but less "intrusive"
than median)
nSmooth - number input to median smoothing routine for camera data
sigSmooth - number input to median smoothing routine for signal data
topPixels -
botPixels -
charsize - character size for plots. Default=2
ctb - color table for non-color image
label1 - label on plot for CineFile1 (default='Monochrome')
label2 - label on plot for CineFile2 (default='Color')
gamma1 - gamma setting for camera 1
gamma2 - gamma setting for camera 2
saturation1 - saturation setting for camera 1, if color
saturation2 - saturation setting for camera 2, if color
min1 - minimum value for bytescaling camera 1
min2 - minimum value for bytescaling camera 2
max1 - maximum value for bytescaling camera 1
max2 - maximum value for bytescaling camera 2
region1 - crop region to display for camera 1
region2 - crop region to display for camera 2
byteScale - if set, will scale
sigName - if set, will not show Fast Camera images, but this
signal vs. time (defaults to \passivespec::BAYC_DALF_HAIFA)
sigT1 - starting time of signal vs. time plot
sigT2 - ending time of signal vs. time plot
sigTitle - if set, will be displayed above sigName plot,
else tries to get label from MDSplus
verbose - if set will print out info as it works
OUTPUTS:
an MPEG file named by movieFile keyword
EXAMPLE:
anim2cine,camera1="Phantom710-9206", camera2="Phantom73-6663", shot=138767, $
sig1='\wf::ip',sig2='\wf::nel', t1=.405, t2=.406, $
gamma1=.37, min1=20, max1=1442, $
gamma2=.8, sat2=.3, max2=1440, rot2=1 ,/debug
anim2cine,camera1="Phantom710-9206", camera2="Miro2-7988", shot=138767, $
sig1='\wf::ip',sig2='\wf::nel', t1=.405, t2=.406, $
gamma1=.37, min1=20, max1=1442, $
gamma2=.3, sat2=.3, max2=255 ,/debug
f1=findcamfiles('nstx_1_135258.cin')
f2=findcamfiles('Miro_135258.cin')
anim2cine,f1,f2,t1=.17,t2=.53, inc=10, mag1=2, mag2=3, $
region1=[.08,.05,1,1], region2=[.1,.0, 1.0,.9], $
sig1='\operations::mi_h908_01:input_03*(-1.6)', sig2='\wf::prf', $
Units1='mTor', /QUICKTIME, sigLabel1='Antenna Power', /debug
anim2cine, camera1='Phantom710-9206', camera2='Miro2-7988', $
shot=140000, t1=0.2, t2=0.3, sigT1=0.0, sigT2=1.0, $
sig1='\wf::ip', sig2='\wf::pnb', nSmooth=5, /verbose , /debug
anim2cine, 'NSTX_130387.cin', $
'MIRO_130387.cin', $
t1=0.1, t2=1.4, sig1='\wf::ip', sigTitle='Plasma Current', /verbose
anim2cine, shot=130370, t1=0.5, t2=0.58, /verbose, /view , /debug
f1=findcamfiles('nstx_1_135254.cin')
f2=findcamfiles('Miro_135254.cin')
anim2cine,f1,f2,t1=.180,t2=.580, inc=10, $
movieFile='NSTX_135254_180-580ms.mpg', mag1=2, mag2=3 , /debug
f1='/p/nstxcam-archive/Phantom71-5040/2009/nstx_1_135254.cin'
f2='/p/nstxcam-archive/Miro2-7988/2009/Miro_135254.cin'
anim2cine,f1,f2,t1=.180,t2=.580, inc=10, $
region1=[.08,.05,1,1], region2=[.1,.0, 1.0,.9], $
movieFile='NSTX_135254_180-580ms.mpg', mag1=2, mag2=3 , /debug
f1=findcamfiles('nstx_1_136159.cin') ; fastest one
f2=findcamfiles('Miro_136159.cin')
anim2cine, f1,f2, mag2=2, $
label1='Full', label2='Dropper View', $
gamma1=0.096, min1=65, max1=4095, $
gamma2=1.188, min2=1114, max2=11075 , /debug
mv files to /w/nstx.pppl.gov/htdocs/nstx/Software/Diagnostics/FC2008
(or whatever year) for web viewing at
http://nstx.pppl.gov/nstx/Software/Diagnostics/
MODIFICATION HISTORY:
08-Dec-2011 added flip1 and flip2 keywords (also made work with just 1 file)
31-Aug-2010 lots of changes to allow to work off web tool nstxmovie.html
01-Jul-2010 added region1 and region2 keywords and allow different
magnifications for different cameras
08-Oct-2009 updates for 2009 cameras. Extract shot # from filenames,
if not input
12-Nov-2008 mods because cineload now assuming frame 0 is beginning of data
16-Jul-2008 Use Z-buffer, even when viewing, for smoother displays
15-Jul-2008 Written by Bill Davis
Source: src/idl_cvs/animxyplot.pro
NAME:
animxyplot
PURPOSE:
Animate X-Y plot of a 2-D array
CATEGORY:
Animation
CALLING SEQUENCE:
IDL> animxyplot, data2d, x, time [, ....]
INPUTS:
data2d - 2 d array (1st dimension like x, 2nd like time)
x - array for x-axis of x-yplot
time
KEYWORD PARAMETERS:
(can have any keywords used in PLOT command -- will be passed on)
mpeg - if set, will create an mpeg of animation
filename - name of mpeg file (default = 'plotanimation.mpg')
rep - # number of times to repeat frames (to slow down mpeg) default=0
t1 - time to start animation (indexes into time array) (default=start)
t2 - time to end animation (default=end)
xtitle -
ytitle -
xsize - xsize of window in pixels
ysize - ysize of window in pixels
flip - if set, will flip mpeg image
timeTitle - appended to indication of time on plot (def='Sec.')
pause - # of seconds to pause between plotted frames when creating
verbose - if set, will print many informational messages
debug - if set, debug output will be printed
OUTPUTS:
NONE; just the mpeg file, if specified
EXAMPLE:
nframes = 20
nPts = 1000
data2d = fltarr(npts, nframes)
time = findgen(nFrames)/1000 +0.2
x =findgen(npts)/npts*150 + 50
for i=0,nframes-1 do data2d[0,i]=sin(x*5/max(x)+i/10.)*exp(1.-x/100-i/10.)
animxyplot, data2d, x, time, xtitle='Radii', ytitle='Value', /mpeg
NOTES:
MODIFICATION HISTORY:
18-Jan-2008 Written by Bill Davis, PPPL
Source: src/idl_cvs/arraymask.pro
NAME:
arrayMask
PURPOSE:
Return an array mask where values are 1 if within the drawn polygon
and 0 if outside.
CATEGORY:
Utility
CALLING SEQUENCE:
IDL> mask=arrayMask( fullx, fully, x, y )
INPUTS:
fullx - full X array of data
fully - full y array of data
x - x coordinates of polygon to enclose
y - y coordinates of polygon to enclose
OUTPUTS:
mask - array dimensioned same as fullX and fullY containing 1's and 0's.
EXAMPLE:
IDL> fullx = findgen(65)
IDL> fully = findgen(65)
IDL> x = [10,10,20,20]
IDL> y = [10,30,30,10]
IDL> mask=arrayMask( fullx, fully, x, y )
WRITTEN 03-Dec-2009 by Bill Davis
Source: src/idl_cvs/array_eq.pro
NAME:
ARRAY_EQ
PURPOSE:
Return TRUE if two arrays are equal, else false.
CATEGORY:
Programming
CALLING SEQUENCE:
logical=ARRAY_EQ(array1,array2)
INPUTS:
bigArray - an array of numbers to look in
littleArray - an array to look for matches in bigArray
OUTPUTS:
logical - 0/1
COMMON BLOCKS:
NOTES:
MODIFICATION HISTORY:
17-May-99 WMD Written
Source: src/idl_cvs/viewtext.pro
NAME:
badpar
PURPOSE: (one line)
Validate an input parameter against valid entries.
DESCRIPTION:
This is a general parameter checking function for validating input
quantities in other procedures and functions. This routine will
generate an error message indicating what is wrong with the item.
Example of use:
pro foo,array
if badpar(array,[4,5],2,CALLER='foo') then return
.
. code for foo .
.
end This would cause an immediate return to the routine that called foo
with an error message if the input was not either floating or double
and 2 dimensional.
As of IDL v3.0, these are the recognized type codes (see 1-218 in
reference guide).
Type
Code Data Type
---- -----------------------------
0 Undefined
1 Byte
2 Integer
3 Longword integer
4 Floating point
5 Double-precision floating
6 Complex floating
7 String
8 Structure
CATEGORY:
Utility
CALLING SEQUENCE:
val = badpar(param,goodtype,goodrank)
INPUTS:
param - IDL variable to validate.
goodtype - Scalar or vector of type codes that are valid.
goodrank - Scalar or vector of valid ranks.
OPTIONAL INPUT PARAMETERS:
KEYWORD PARAMETERS:
CALLER - String identifying the calling routine.
DEFAULT - Value to return in param if undefined and undefined allowed.
DIMEN - Dimensions of variable.
NPTS - Total number of elements in variable.
RANK - Rank of variable.
TYPE - Type of variable.
OUTPUTS:
Return value is true if the parameter is bad. False if good.
COMMON BLOCKS:
SIDE EFFECTS:
using the font keywords makes resizing very slow and inaccurate
RESTRICTIONS:
PROCEDURE:
MODIFICATION HISTORY:
03-Feb-03 Added FIT, FILE, and WID keywords. Made font work [BD]
3/24/93 - Written by Marc W. Buie, Lowell Observatory.
4/27/93 - MWB, added TYPE and DEFAULT keywords.
Source: src/idl_cvs/bad_ptdata_error.pro
NAME:
BAD_PTDATA_ERROR
PURPOSE:
Return a logical true IF the PTDATA error is serious
CATEGORY:
GA, error processing
CALLING SEQUENCE:
logical = Bad_PTDATA_Error(ptdata_ierr)
INPUTS:
ptdata_ierr - error return from PTDATA calls
KEYWORD PARAMETERS:
OUTPUTS:
RETURNED: logical indication of a serious error
(per IDL definition, e.g., 0 IF false)
COMMON BLOCKS:
MODIFICATION HISTORY:
1-Apr-97 WMD Written
Source: src/idl_cvs/bangpw.pro
NAME:
bangPW
PURPOSE:
Widget to set interactively some !P values. Lists colors by name,
if mk_color used; otherwise finds "closest" index to named colors.
Allows selection of several custom plotting symbols (see PLOTSYM).
CATEGORY:
Graphics, Widgets
CALLING SEQUENCE:
IDL> bangPW
INPUTS:
KEYWORD PARAMETERS:
Optional Keywords:
UPDATECALLBACK - a routine to call after struct system variable is set
GROUP_LEADER - This widget is destroyed if it's GL is destroyed
OUTPUTS:
The system variable !P is changed
COMMON BLOCKS:
NONE
EXAMPLE:
IDL> bangPW, UPDATECALLBACK='myReplotter'
NOTES:
If an application overrides !P.* parameters, or specifies them on
the plot command, changing settings with this widget will not override.
!P.SYMSIZE not controlled, because it seems to have no effect.
MODIFICATION HISTORY:
29-Apr-08 check for routine being compiled (vs. needing to be found)
added a "Refresh" button which, if a proper plotting routine
is provided, will replot with any changed settings.
17-Aug-01 Allow lines with symbols [BD]
30-Oct-00 Written by Bill Davis, PPPL
Source: src/idl_cvs/bell.pro
NAME:
BELL
PURPOSE:
Ring terminal bell.
CATEGORY:
Programming, Sound, Errors
CALLING SEQUENCE:
bell, [n]
INPUTS:
n = number of rings (def=1). in
KEYWORD PARAMETERS:
OUTPUTS:
COMMON BLOCKS:
NOTES:
MODIFICATION HISTORY:
R. Sterner, 20 Oct, 1989.
Copyright (C) 1989, Johns Hopkins University/Applied Physics Laboratory
This software may be used, copied, or redistributed as long as it is not
sold and this copyright notice is reproduced on each copy made. This
routine is provided as is without any express or implied warranties
whatsoever. Other limitations apply as described in the file disclaimer.txt.
Source: src/idl_cvs/betterrainbow.pro
NAME:
betterrainbow
PURPOSE:
Loads a rainbow color palette with 6 evenly-spaced (roughly) colors
CATEGORY:
Colors, Graphics
CALLING SEQUENCE:
IDL> betterrainbow
INPUTS:
NONE
KEYWORD PARAMETERS:
Optional Keywords:
BAR - if set, will draw a color bar on plot
nColors - # of colors to load (Defaults to !D.TABLE_SIZE)
lessRed - if set, rainbow will have a smaller red region
WhiteBottom - if set, there will be a white region at the bottom
topColor - can be an index or 'white' or 'black'
botColor - can be an index or 'white' or 'black'
linePlots - if set, top color will be black and bottom color will be white
noYellow - if set, don't have yellow (because doesn't show up well on white)
OUTPUTS:
NONE (color table changed)
EXAMPLE:
IDL> betterrainbow, botColor='white', /bar
IDL>
LIMITATIONS:
always starts at the bottom of color palette.
MODIFICATION HISTORY:
13-Aug-2012 mucked with white bottom
04-Nov-2011 smoothed out corners in green between 180 & 240, so discontinuity not
seen in organge
26-Aug-2011 added smooth parameter, default it to 50. Round off purple to
blue transition.
18-Jun-2008 added NoYellow keyword
02-Aug-2007 fix bug for /lineplot and ncolors<256;
if /linePlots keyword set, reset !p.color & !p.background
30-Apr-2007 added linePlots keyword
26-May-2006 added ncolors and whiteBottom keywords
14-Feb-2005 add topColor and botColor keywords
15-Jul-2002 Written by Bill Davis, PPPL
Source: src/idl_cvs/betterticklabels.pro
NAME:
betterticklabels
PURPOSE:
Tick labels are made a little cleaner. E.g., shorter exponentials,
no unnecessary trailing zeroes, accurate numbers when tick values
are small differences between large numbers, etc.
CATEGORY:
Plotting, Graphics
EXAMPLE:
IDL> plot, y, ytickformat='betterticklabels'
EXAMPLE A - Make a dummy plot call so can determine Tick Max:
IDL> COMMON betterticklabels_common, yticklabels
IDL> plot, y, ytick_get=yticklabels, ytickname=replicate(' ',30)
IDL> AXIS, YAXIS=1, YRANGE=!y.crange, ytickformat='betterticklabels'
IDL> dum = TEMPORARY(yticklabels) ; so doesn't affect later calls
HISTORY:
03-Mar-2008 slight mod to handle floating point comparison
03-Aug-2006 fixed for values less than 2.e-6
15-Apr-04 be able to return xtick values and x tic labels (NOT DEBUGGED)
15-Oct-01 shift y axis labels if !p.font=0 (helps with some 3-D plots)
11-Jan-01 shift y-axis labels if on TEK and !p.font=0
09-Oct-00 Written by Bill Davis
Source: src/idl_cvs/bin2d.pro
NAME:
Bin2D
PURPOSE:
Create a density image (2D histogram) from arrays of (x,y) points,
or create an image of a function from arrays of ( x, y, f(x,y) ) data.
In first case each pixel counts # of (x,y) points falling into
a 2D bin (box), thus forming an image of counters. In optional case,
each pixel is the average of all f(x,y) data falling into the box.
Boxes are determined by dividing the (x,y) range into a uniform grid.
CATEGORY:
Image Processing
CALLING EXAMPLES:
imh = Bin2D( x, y, NPIX=64, XRAN=[0,20], YRAN=[-5,5] )
imz = Bin2D( x, y, FXY=z, NPIX=[200,100] )
INPUTS:
X = array (any dimension) of x values.
Y = array of y values, should correspond to x array.
optionally, x can be of the form [[x],[y]]
containing both x and y coordinates as rows of matrix,
and then argument y should not be specified.
KEYWORDS:
XRAN and YRAN : specify the x,y range to be mapped into the image.
Common Bin2D, xminc,xmaxc, yminc,ymaxc
can also specify the x,y range if keywords are not used,
otherwise the defaults = min-max ranges of x and y.
NPIXELS = 1 or 2 element integer array specifying size of result,
(single value means square image), default = [64,64].
/NOCLIP means do not bother checking if (x,y) are within range (faster).
TYPE_VAR = type code specifying the IDL variable type of result,
(1=byte, 2=short, 3=Long, 4=float,... default=2, short integer).
KEYWORDS (optional):
IMAGE_DENSITY = an existing image of counters (2D histogram)
to which the result is added (overrides NPIX=).
FXY = array giving z = f(x,y) for the purpose of binning into an image
however, bins with no (x,y) data points are left = zero.
(NOTE: must specify XRAN and YRAN, or set /NOCLIP).
if /BOTH is set and FXY=z is given, then the binned image of z=f(x,y) is
returned by function, and an image of (x,y) density is
returned via the keyword IMAGE_DENSITY.
OUTPUTS:
Result of function is an image of the density of (x,y) points, or an
image of scalar field function if z values are given at (x,y) points.
PROCEDURE:
Binning is performed by finding number of (x,y) duplicates
at each pixel, using the IDL sort and where functions.
HISTORY:
written Frank Varosi, U.of MD., 1988.
F.V. 1990, modif. for IDL-V2.
Source: src/idl_cvs/bitmapbuttons.pro
NAME:
bitmapbuttons
PURPOSE:
Illustrate use of bitmapbuttons in IDL
CATEGORY:
GUI, buttons
CALLING SEQUENCE:
IDL> bitmapbuttons
Then click on buttons and watch them change.
COMMON BLOCKS:
none
NOTES:
Requires IDL 5.2 or later.
LIMITATIONS:
This may not be the easiest way to manage button states
MODIFICATION HISTORY:
27-Jan-00 [BD]
Source: src/idl_cvs/bits.pro
NAME:
bits
PURPOSE:
Given a byte or integer, return a vector of 8 or 16 values
which are the binary representation of the value.
CATEGORY:
bits, hardware
INPUT:
invalue - The byte or integer value to check
OUTPUT:
bitarr - The 8-element array with values set
if the bit is set
EXAMPLE:
IDL> BITS, invalue, BITARR
HISTORY:
Written 1988 by M.Morrison
13-Nov-92 (MDM) - Modified to allow integer*2 values
and to allow an array of values.
7-Apr-94 (MDM) - Allow integer*4 values
15-Aug-94 (MDM) - Corrected error from 7-Apr-94 mod which
did not allow an array of inputs
Source: src/idl_cvs/blobbinranges.pro
NAME:
blobbinranges
PURPOSE:
plot bins of one variable vs another from blob database and drawn
ranges, of say 90%, in Y for each binned point.
See http://nstx.pppl.gov/nstx/Software/Applications/blobDBdefs.txt
for an explanation of variables and units of database variables.
CATEGORY:
Blobs
CALLING SEQUENCE:
IDL> blobBinRanges, filename
INPUTS:
------
filename - file saved from DbAccess
KEYWORDS:
--------
xVar - Column in DbAccess for independent variable (default='topNorm')
yVar - Column in DbAccess for dependent variable (default='xVel')
Note: velocities are in Km/sec. Most other things are in pixels.
x1 - starting pixel in horizontal direction to consider
x2 - ending pixel in horizontal direction to consider
t1 - starting pixel in vertical direction to consider
t2 - ending pixel in vertical direction to consider
percent - % of data points to draw bars over (Default=90, but 95% might be better)
binSize - length of bin (on X axis)
nBins - if set, will set binsize so this # of bins cover range of X data
minHt - min value of topNorm
maxHt - max value of topNorm
saveFile - if=1, will save a JPEG file
plotFile - file name to save JPEG to
position - bounding box in normalized coords (def=[.1,.1,.95, .9])
xrange - the x limits of the plot (set !x.style=1 before running for exact)
yrange - the y limits of the plot (set !y.style=1 before running for exact)
explain - include in the legend an explanation of bars and numbers
ctb - color table for color contours (default=3, hot metal)
interp - if set, will interpolate colors indicating blobs per bin
EXAMPLES:
--------
IDL> blobBinRanges, '/u/bdavis/cvs/idl_cvs/DBoutSH142000.txt', /debug
IDL> blobBinRanges, '/u/bdavis/cvs/idl_cvs/DBoutSH142000.txt', $
x1=40, charsize=1.5, $
xtitle='Normalized Blob Brightness', $
ytitle='Radial Velocity (Km/s)', $
title='Shot 142000; 240-270 msec', legend='Outside Separatrix', $
percent=90, yrange=[-2,4], xrange=[1,7], /contours, /rainbow
IDL> blobBinRanges, '/u/mko/testfile_142000.txt', x1=40, charsize=1.5, $
xtitle='Normalized Blob Brightness', $
ytitle='Radial Velocity (Km/s)', $
title='Shot 142000; 240-270 msec', legend='Outside Separatrix', $
percent=90, yrange=[-2,4], xrange=[1,7], /contours, /rainbow
MODIFICATION HISTORY:
--------------------
WRITTEN 26-Jul-2012 by Bill Davis
Source: src/idl_cvs/blobtrails.pro
NAME:
blobtrails
PURPOSE:
draw trails of blob trajectories that go through a certain region of the image.
Data comes from a database of blob characteristics for a given shot, and perhaps
just part of a shot (see populateblobs.pro).
CATEGORY:
Blobs
CALLING SEQUENCE:
IDL> blobtrails, table=table, xpt=xpt, ypt=ypt, box=box, minht=minht
INPUTS:
-------
database - SQL database (server maintained by Tom Carroll) for blobs, DEF='BLOBS'
table - table name in database of blobs for a period within a shot, or
shot - will assume table is named 'SH'+shot
xpt - horizontal center of region from which trajectories start
ypt - vertical center of region from which trajectories start
boxradius - # of pixels around [xpt, ypt] to allow for start of trajectories
minHt - min height of blob in normalized image. (when blob passes through box)
lifeRequired - lifetime required in seconds (after passing through box) , or
needed - number of frames needed (after passing through box) to bother with
t1 - (optional) 1st time to consider (seconds)
t2 - (optional) last time to consider (seconds)
timeOffSet - amount needed to be added to camera time to get to shot time
rainbow - if set, will use "betterrainbow" pallette, rather than hot metal.
nSmooth - smoothing to be applied before track is plotted (default=3)
maxJump - max # of pixel to change per frame to be considered same blob
(DEF=10)
msec - if set, display times in millisec
ellipse - if set, draw ellipses where fit was made
symWidth - if <=0 then draw ellipses in realistic shapes
scale - if realistic blob sizes drawn, scale their size by this factor
xplot1 - starting x pixel for plot
xplot2 - ending x pixel for plot
yplot1 - starting y pixel for plot
yplot2 - ending y pixel for plot
verbose - if set, lots of information output listed
debug - if set, will output even more and may stop at some spots
"rise" was the difference from the max of a blob (after normalizing frame)
and the lowest closed contour line that enclosed it.
EXAMPLES:
IDL> blobtrails, 32,32, box=2, /rainbow, minht=1.1, /list, /debug
IDL> blobtrails, 25,25, box=2, /rainbow, shot=138234, ny=80, /list , /debug
IDL> maxJump=5
IDL> blobtrails, table='SH138234',xpt='32',ypt='32',boxRadius='2',minHt='2', $
maxJump=maxJump, needed='3',t1='0',t2='20', ctb='-1', ListTimes='on', $
eFileType='None',psfilename='blobtrails',emailPsAddress='', /deb
IDL> blobtrails, table='SH1091216028', x1=39, x2=41, y1=2,y2=62, psym=4, minHt='1.5', $
maxJump=10, needed='3',t1='0',t2='20', ctb='-1', ListTimes='on', $
xplot1=30, xplot2=60, /msec, chimax=5, nSmooth=3, $
eFileType='None',psfilename='blobtrails',emailPsAddress='', /deb
blobtrails, table='SH138234',xpt='20',ypt='20',boxRadius='3', minHt='2', $
maxJump=maxJump, needed='3',ctb='-1', $
t1=530, t2=550, $
xplot1=10, xplot2=50, yplot1=10, yplot2=80, charsize=1.5, /ellip , /deb
blobtrails, table='SH138234',x1=15, x2=30, y1=20, y2=22, minHt='2.5', $
maxJump=maxJump, needed='3',ctb='-1', $
t1=530, t2=550, $
xplot1=15, xplot2=50, yplot1=10, yplot2=80, charsize=1.5, /ellip , /deb
blobtrails, 20, 20, boxRadius=3, shot=138234, $
minHt=2.2, t1=530, t2=550, xSize=500, ySize=600, $
/ListTimes, charsize=1.8, psym=4, symSize=2,$
xplot1=10, xplot2=40, yplot1=0, yplot2=30
to get a track of just one blob:
blobtrails, 8, 40, boxRadius=4, shot=138234, $
minHt=2.2, t1=534, t2=535, xSize=500, ySize=600, $
/ListTimes, charsize=1.6, psym=4, symSize=2,$
xplot1=-10, xplot2=40 ;;;, yplot1=0, yplot2=30
MODIFICATION HISTORY:
01-Oct-2012 colors for single tracks was broken; fixed.
Now, both blob positions and separatrix (and limiter) are plotted
physical coordinates when plotting in cm. Previously, and still when
plotting vs. pixels, the "rhomboid" shape of the fiber bundle is
not accounted for.
28-Sep-2012 when axesInCm set, use actual R & Z values for blob positions, and
plot separtrix from actual R & Zs.
13-Sep-2012 added EveryOther, suppress, noTitle keywords
18-Jul-2012 adjust for plot area not all the pixels
26-Mar-2012 option to draw separatrix
22-Mar-2012 Use HM values for ellipse shapes (have an option for size, too)
01-Dec-2011 fixed duplication of first and last blob indices
17-Jun-2011 fixed for Database time in msec
08-Mar-2011 added wholeLife field to database, so "needed" makes more sense
(the blob has to have persisted for that many frames to be considered)
WRITTEN 2-Feb-2011 by Bill Davis for Stewart Zweben
Source: src/idl_cvs/bpass.pro
NAME:
bpass
PURPOSE:
Implements a real-space bandpass filter which suppress
pixel noise and slow-scale image variations while
retaining information of a characteristic size.
CATEGORY:
Image Processing
CALLING SEQUENCE:
res = dgfilter( image, lnoise, lobject )
INPUTS:
image: The two-dimensional array to be filtered.
lnoise: Characteristic lengthscale of noise in pixels.
Additive noise averaged over this length should
vanish. MAy assume any positive floating value.
lobject: A length in pixels somewhat larger than a typical
object. Must be an odd valued integer.
OUTPUTS:
res: filtered image.
PROCEDURE:
simple 'wavelet' convolution yields spatial bandpass filtering.
NOTES:
MODIFICATION HISTORY:
19-May-2009 Limit filter width so convol doesn't exceed array dimensions [BD]
Written by David G. Grier, The University of Chicago, 2/93.
Greatly revised version DGG 5/95.
Added /field keyword JCC 12/95.
Revised & added 'stack','voxel' capability JCC 5/97.
This code 'bpass.pro' is copyright 1997, John C. Crocker and
David G. Grier. It should be considered 'freeware'- and may be
distributed freely in its original form when properly attributed.
Source: src/idl_cvs/bpwfedit.pro
NAME:
BPWFEDIT
PURPOSE:
Read, Edit, & Plot Breakpoint Waveform files used in ppcc system on TFTR
CATEGORY:
TFTR, Waveforms, GUI Editing
REVISION HISTORY:
21-Aug-98 Written by Bill Davis
Source: src/idl_cvs/breakmdsname.pro
NAME:
BreakMDSname
PURPOSE:
break an MDS pathname near the middle, if too long
CATEGORY:
MDSplus, Strings
CALLING SEQUENCE:
newLines = BreakMDSname( line )
INPUTS:
line - string containing an MDSplus tag or node name in
KEYWORD PARAMETERS:
MAXLENGTH - max line length (default 72) OPTIONAL
OUTPUTS:
newlines - string array of MDSplus name broken near middle
EXAMPLE:
IDL> line = '\ENGINEERING::OPERATIONS.PC_OH_BR_1_CUR_1'
IDL> newLines = BreakMDSname( line, MAXLENGTH=25 )
COMMON BLOCKS:
NOTES:
MODIFICATION HISTORY:
01-Apr-99 Written earlier by Bill Davis
Source: src/idl_cvs/breakstring.pro
NAME:
BreakString
PURPOSE:
Break a string up and return a string array
CATEGORY:
Strings
CALLING SEQUENCE:
IDL> str_array = BreakString(longString)
INPUTS:
longString = a string of words
KEYWORD PARAMETERS:
Optional Keywords:
MAXLENGTH - Maximum length of array elements of output (else=72)
DELIMITER - delimiter, else ' '
(see WORDARRAY for multispace delmiters')
COMPRESS - if set, squeeze out extra imbedded blanks
OUTPUTS:
str_array = returned array of strings out
COMMON BLOCKS:
NONE
EXAMPLE:
IDL> line = '\ENGINEERING::OPERATIONS.PC_OH_BR_1_CUR_1'
IDL> newLines = BreakString( BreakString, MAXLENGTH=25, DELIM=':' )
NOTES:
Can be used as a replacement for obsolete str_sep routine
MODIFICATION HISTORY:
31-Jan-02 bug fix and speed improvement
1-Apr-99 Written by Bill Davis, PPPL
Source: src/idl_cvs/breaktext.pro
NAME:
breaktext
PURPOSE:
break up (justify) text so lines not longer than a certain length.
CATEGORY:
strings
CALLING SEQUENCE:
IDL> newText = breakText( text )
INPUTS:
text - string array or scalar
KEYWORD PARAMETERS:
nper - number of characters per line (DEFAULT=72)
break - if set, lines longer than nper characters will be broken at an earlier space
OUTPUTS:
string array returned
EXAMPLE:
text = ['This is the first line this is the second', ' ', $
'123456789 123456789 123456789 123456789 123456789 ']
wrapped = breaktext( text, delim=' ', maxlength=25 )
NOTE:
MODIFICATION HISTORY:
14-Aug-2008 Written by Bill Davis, PPPL
Source: src/idl_cvs/break_path.pro
NAME:
BREAK_PATH
PURPOSE:
Breaks up a path string into its component directories.
CATEGORY:
MDSplus, Strings
CALLING SEQUENCE:
Result = BREAK_PATH( PATHS [ /NoCurrent])
INPUTS:
PATHS = A string containing one or more directory paths. The
individual paths are separated by commas, although in UNIX,
colons can also be used. In other words, PATHS has the same
format as !PATH, except that commas can be used as a separator
regardless of operating system.
A leading $ can be used in any path to signal that what follows
is an environmental variable, but the $ is not necessary. (In
VMS the $ can either be part of the path, or can signal logical
names for compatibility with Unix.) Environmental variables
can themselves contain multiple paths.
OUTPUT:
The result of the function is a string array of directories.
Unless the NOCURRENT keyword is set, the first element of the array is
always the null string, representing the current directory. All the
other directories will end in the correct separator character for the
current operating system.
OPTIONAL INPUT KEYWORD:
/NOCURRENT = If set, then the current directory (represented by
the null string) will not automatically be prepended to the
output.
PROCEDURE CALLS:
Functions: DATATYPE(), breakstring()
REVISION HISTORY:
Version 1, William Thompson, GSFC, 6 May 1993.
Added IDL for Windows compatibility.
Version 2, William Thompson, GSFC, 16 May 1995
Added keyword NOCURRENT
Version 3, William Thompson, GSFC, 29 August 1995
Modified to use OS_FAMILY
Version 4, Zarro, GSFC, 4 August 1997
Added trim to input
Converted to IDL V5.0 W. Landsman 25-Nov-1997
Source: src/idl_cvs/btest.pro
NAME:
BTEST
PURPOSE:
To test bit N in FIX(X)
CATEGORY:
Bits, Hardware
CALLING SEQUENCE:
YesNo = btest( X, N )
PARAMETERS:
Inputs:
X (REQ) (I) (0 1) (I F)
X is the variable to be tested
N (REQ) (I) (0) (I)
The bit of X to be tested
Returned:
YESNO (REQ) (O) (0 1) (I)
The result of the test. 1(true) if bit N is set, 0(false)
otherwise.
EXAMPLES:
YESNO = btest( !X.STYLE, 4 )
IF YESNO THEN PRINT,'X-axis suppressed' $
ELSE PRINT,'Draw X-axis'
To find points in NEWSIPS which are outside calibrated region:
YESNO = btest( ABS(NU),1 ) ; look for nu flag = -2
IND = WHERE (YESNO EQ 0) ; keep points where yesno = 0
PLOT,W(IND),F(IND) ; plot calibrated points
NOTES:
Note that negative integers are stored in twos complement form.
Therefore, the left-most bits are ON rather than OFF as they are for
positive numbers. Input the absolute value of X is negative numbers
to avoid this problem.
This procedure can be used to check the values of complex
IDL system variables such as ![XYZ].STYLE.
PROCEDURE:
Checks whether (FIX(X) OR (NOT 2^N)) = -1 to set the output
flag YESNO.
MODIFICATION HISTORY:
26-Oct-99 Convert from btest to make a function (like FORTRAN)
Mar 6 1983 RJP GSFC initial program
Aug 24 1987 RWT GSFC add PARCHECK
Mar 7 1988 CAG GSFC all VAX RDAF-style prolog
Jul 13 1990 RWT GSFC Sun mods: use examples pertinent to SUN IDL
and add listing of procedure call statement
Jun 19 1991 PJL GSFC cleaned up; tested on SUN and VAX; updated prolog
Mar 8 1993 RWT GSFC modify to allow X & YESNO to be vectors and
add documentation about negative numbers.