Source: src/idl_cvs/charsize2fit.pro
NAME:
charSize2Fit
PURPOSE:
compute charsize for a string to fit in horizontal # of pixels
CATEGORY:
strings
CALLING SEQUENCE:
IDL> charsize= charsize2fit( charstr, pixels)
INPUTS:
charstr - character string to plot
pixels - # of horizontal pixels character string must fit into
KEYWORD PARAMETERS:
nchars - overrides charstr size
OUTPUTS:
charsize - character size that can be used in call to xyouts
EXAMPLE:
IDL> pixels = 100
IDL> window,/fr, xsize=pixels, ysize=100
IDL> charstr='Hi to all you folks out there'
IDL> xyouts, 0,.5, charStr, charsize=charsize2fit( charstr, pixels )
25-Jul-2012 added nchars keyword
WRITTEN 06-Jul-2012 by Bill Davis
Source: src/idl_cvs/checkmdstree.pro
NAME:
checkMDStree
PURPOSE:
Check MDS trees, say after a transfer. Produce a file with a
list of nodes and checksum of contents of each numerical node or first
element of non-numeric nodes.
CATEGORY:
MDSplus, Searching
CALLING SEQUENCE:
IDL> checkMDStree, tree=tree, shot=shot, outFile=outFile
INPUTS:
tree - MDSplus tree.
shot - MDSplus shot to search.
KEYWORD PARAMETERS:
Input (Optional):
server - MDSplus server. Default is the default server for the tree.
outFile - defaults to tree_nnnnnn_server_list.txt
remove - if set, removes the tree::top when listing the node name
Returned (Optional):
status - status from mdsopen call
OUTPUTS:
(Optional):
outFile -
outDir - output dir (DEF='')
EXAMPLE:
IDL> checkMDStree, tree='particles', shot=130000, server='lark:8501', /verb
IDL> checkMDStree, tree='usxr', shot=142000, server='skylark:8501', /verb
NOTES:
MODIFICATION HISTORY:
24-Feb-2011 include any port info into default output filename
01-Oct-2008 add checksum for Alphanumerics, too.
29-Aug-2008 Written by Bill Davis, PPPL
Source: src/idl_cvs/checksig.pro
NAME:
checkSig
PURPOSE:
checks for existence of a signal in MDSplus for current shot and optionally
declares an event. It can also execute and IDL string when it sees the event.
It will then start watching for the next shot.
CATEGORY:
MDSplus, Events
CALLING SEQUENCE:
IDL> checksig, tree=tree, sig=sig, event=event
INPUTS:
KEYWORD PARAMETERS:
Inputs:
tree - MDSplus tree (DEFAULT=engineering)
sig - MDSplus signal to look for in current shot
event - MDSplus event to declare (DEFAULT=$USER_test)
logfile - where to write log messages
pause - seconds to pause between checks (default=10 sec)
test - if set, will not set event, only print messages
realVerbose - if set will tell you too much stuff
verbose - if set, will print many informational messages
debug - if set, debug output will be printed
OUTPUTS:
none, just printing
EXAMPLE:
IDL> checksig, tree='engineering', sig='\fdia', event='bdtest'
IDL> checksig, tree='engineering', sig='\fdia', /test,/verb, pause=10
IDL> checksig, sig='\cameras::ph7_1_count', $
exec='cinethumbnails, "*nstx_2_*'+strtrim(lastshot(),2)+'*.cin"'
IDL> checksig, sig='\efit02::r', $
exec='cinethumbnails,findLastFile("/p/nstxcam/Miro2-7988/2010/*.cin")'
15-Apr-2010 alternately can call an IDL routine [BD]
13-Apr-2010 increased default pauses [BD]
WRITTEN by Bill Davis, 01-Apr-2010
Source: src/idl_cvs/ch_example.pro
NAME:
CH_Example
PURPOSE:
a simple example using the GA Crosshair routines
CATEGORY:
GUI Graphics, Example
CALLING SEQUENCE:
CH_Example
COMMON BLOCKS:
ch_example
NOTES:
Your display may have to be set to 256 colors to see the crosshairs.
MODIFICATION HISTORY:
Written by Bill Davis, 8/29/97
GA Crosshair routines originally written by John Ferron.
Now maintained by T. Terpstra
Source: src/idl_cvs/ch_register.pro
NAME:
ch_register
PURPOSE:
register window for crosshair routines
CATEGORY:
GUI Graphics, Cursor Cross-hairs
EXAMPLE:
See ch_example.pro
MODIFIED:
29-Nov-07 Don't handle if window names not found in ch_set [BD]
30-Oct-00 Override !P.PSYM & !P.LINESTYLE for cros-hairs [BD]
04-Dec-99 Make mask bit 6, so it's red when used with MK_COLOR [BD]
29-Mar-99 Added newX, newY & newP keywords to CH_SET for changing
plotting parameters [BD]
26-Jan-99 Taken from GA [BD]
Combining all ch_ files here, since this must be called 1st.
Source: src/idl_cvs/cine2mpeg.pro
NAME:
cine2mpeg
PURPOSE:
Create a movie from a .cin files from Phantom Fast Cameras.
Will default to writing jpegs and spawning jmovie to create a
QuickTime movie. If /MPEGout keyword set, will write an MPEG.
The data can be color or monochrome,
CATEGORY:
animation
CALLING SEQUENCE:
cine2mpeg, CineFile1, outFile=outfile, t1=t1, t2=t2, ndups=ndups
or
cine2mpeg, shot=shot, t1=t1, t2=t2, /verbose
INPUTS:
CineFile1 - a cine filename
shot - if used instead of filename, it will search appropriate directories.
OPTIONAL KEYWORD PARAMETERS:
outFile - name of output MPEG 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 msec
t2 - end time of animation in msec
MPEGout - if set will create an MPEG movie
FramesOut - if=0, will not create QuickTime movie
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)
badValue - if data is this or above, replace with median of surrounding pixels
nSmooth - number input to median smoothing routine
gamma - gamma correction. (Default=1, which is no correction).
0.5 probably better for Miro
saturation - As in HSV color representation, for color camera.
Default is 0.3.
topPixels -
botPixels -
AveT1 - start time of range for Average Frame in msec
AveT2 - end time oof range for Average Frame in msec
charsize - character size for labels. Default=1.5
ctb - color table for non-color image
label - label on plot
horizontal_flip - if set, flip images horizontally
vertical_flip - if set, flip images vertically
byteScale - if set, will scale
minVal - if this and byteScale set, will use this as minimum value
maxVal - if this and byteScale set, will use this as maximum value
inc - default 1o 1; use every "inc"th frame
noCaption - do not put text on or above image
Rotate - integer from 0-3, passed to IDL ROTATE function
verbose - if set will print out info here and there
OUTPUTS:
an MPEG file named by outFile keyword
NOTES:
*** you have to be careful with MAXVAL. If too big, all frames will be black
EXAMPLE:
cine2mpeg, '/p/nstxcam-archive/Miro2-7988/2008/MIRO_130389.cin', $
t1=0.02, t2=0.0300, /verbose , /debug
cine2mpeg, shot=130277, t1=0.100, t2=0.200, /verbose, /view , /debug
cine2mpeg, GETENV("NSTXUSR")+'/phantom4/GDNex10usFps27000DC110maP1.98torr-1.cin', $
outfile='Ne110us.mpg', t1=.0007, t2=0.0017, ndups=4, mag=3
minHt and maxChi2 are the most useful to adjust:
blobCriteria = { minHt : 1.2, $
maxChi2 : 3., $
maxFrames : 1, $
maxJump : 10, $
minArea : 9, $
minLifetime : 3, $
maxAreaChange : 100, $
minRise : 0.02 $
}
cine2mpeg,'/p/nstxcam-archive/Phantom710-9205/2010/nstx_5_138234.cin',$
aveT1=0.530, aveT2=0.550, t1=0.532, t2= 0.5326, /blobs, $
blobCriteria=blobCriteria, $
colorTable=3, min=256, /surface, /RotCC, /arrow , /view,/debug
cine2mpeg,'/p/nstxcam-archive/Phantom710-9205/2010/nstx_5_138234.cin',$
aveT1=0.530, aveT2=0.550, t1=0.530, t2= 0.5302, /blobs, $
colorTable=3, minWidth=256, /surface, /horiz, /RotCC, /arrow , /view,/debug
; to test drawing plasma EDGE and limiter shadow:
cine2mpeg,'/p/nstxcam-archive/Phantom710-9205/2010/nstx_5_138234.cin',$
aveT1=0.530, aveT2=0.550, t1=0.530, t2= 0.5301, $
colorTable=3, minWidth=256, /horiz, /RotCC, /arrow, /EDGE , /view,/debug
mv files to /w/nstx.pppl.gov/htdocs/nstx/Software/Diagnostics/Miro/GlobalMPEGs
for web viewing at
http://nstx.pppl.gov/nstx/Software/Diagnostics/Miro/GlobalMPEGs
MODIFICATION HISTORY:
06-Mar-2013 black out top and bottom after drawing separatrix
05-Mar-2013 if bytescale set, don't use maxVal and minVal to scale image
25-Oct-2012 added showNumbers, xvals, and yvals, for suppressing blob #s and
having surface axes in cm.
27-Mar-2012 use fastcam_times and fastcam_frame so can support HDF files from simulation
12-mar-2012 moved smoothing out of cine2mpeg, and let be done in findblobs,
like other apps doing. Have time inputs in msec. Default to Gaussian smoothing
24-Feb-2012 added gaussian smoothing option
23-Feb-2012 many adjustments for showing CMOD data, especially when window size
not optimal.
31-Aug-2011 added Surface option for better Blob tracking
07-Apr-2011 added NoCaption keyword for NOVA work.
10-Aug-2010 added option to make .mov files from Eliots Java code that uses
jpegs
09-Jun-2010 made do loops start with LONG so can handle > 32K frames
27-Aug-2009 added /horizontal_flip and /vertical_flip
22-Jul-2009 if not MIRO, and maxVal not specified, scale each frame to it's max.
added NORMALIZE keyword (default) to read through all frames
and get the max value for use in BYTSCL.
24-Jun-2009 added showMin and showMax keywords.
12-Nov-2008 mods because cineload now assuming frame 0 is beginning of data
18-Sep-2008 mods to magnify keyword
05-Aug-2008 Written by Bill Davis
Source: src/idl_cvs/cineave.pro
NAME:
cineave
PURPOSE:
Produce an average frame from a time ranged from .cin files from
Phantom Fast Cameras. This frame is typically used to divide GPI
images by to get normalized image.
CATEGORY:
animation
CALLING SEQUENCE:
IDL> a=cineave( CineFile, aveT1=aveT1_in, aveT2=aveT2_in, aveInt=aveInt )
INPUTS:
CineFile - a cine filename
aveT1 - start time for averaging (seconds)
aveT2 - end time for averaging
nsmooth - # of points for median smoothing on individual frames
despeckle - if set call despeckle routine (slow, but less "intrusive"
than median)
badValue - if data is this or above, replace with median of surrounding pixels
inc - default 1o 1; use every "inc"th frame
FrameOffset - if set, subtract this (like a baseline) from all pixels
FrameAveMin - if set, make close-to-zero pixels this number,
so when dividing into data, as in normalizing, result is near zero
OUTPUTS:
maxInt - the maximum intensity anywhere in the frame vs. time
aveInt - the average intensity anywhere in the frame vs. time
maxNorm - max value of normalized images over that the same time range
times - times used to create this average frame
status - odd if OK
EAXMPLES:
filename='/p/gpi/szweben/Phantom_Data/2009_Phantom_data/1091216/shot_1091216029.cin'
or filename='/p/nstxcam-archive/Phantom710-9205/2010/nstx_5_142000.cin'
IDL> t0=systime(1) & a=cineave( filename, aveInt=aveInt ) & print, systime(1)-t0
Without finding AveInt, took 6.5 sec for nstx_1_142000.cin.
When finding average, 33.6 seconds .
MODIFICATION HISTORY:
05-Sep-2012 added keywords FrameOffset and FrameAveMin
04-Sep-2012 fixed bug where was dividing by n-1 rather than n.
27-Mar-2012 use fastcam_times and fastcam_frame so can support HDF files from simulation
01-Sep-2011 added nsmooth, inc, despeckle & badvalue keywords
27-Jul-2011 made max intensity at a pixel be the 99.9% pixel value so bad pixels
don't form max (as Ricky Macqueda did)
25-Jul-2011 added keyword maxInt to return maximum intensity vs. time
22-Jul-2011 default aveT1 and aveT2 to entire file and option to return
average intensity vs. time [BD]
18-Jan-2011 added minAll and maxAll keywords
WRITTEN Jan-2011 by Bill Davis for Stewart Zweben
Source: src/idl_cvs/cineload.pro
NAME:
cineload
PURPOSE:
Read a frame from a .cin file from a Phantom 7 camera.
File is opened only the first time (or when filename is new), and
pointers and things are remembered from one call to the next.
CATEGORY:
Image Processing
CALLING SEQUENCE:
IDL> image = cineload( filename, frame )
INPUTS:
filename - a .cin file
frame - absolute frame number in file desired. 0 is always the first
OUTPUTS
image - a [n,y] or [3,n,y] image
optional:
fps - frames per second
exposure - exposore time
KEYWORD PARAMETERS (optional):
input:
init - first call for this filename
verbose - print out lots of info
debug - will stop within routine if error detected.
output:
bitcount -
outMsg -
status - if odd, then OK
EXAMPLE:
IDL> filename = '/p/nstxcam-archive/Phantom710-9205/2010/nstx_5_139475.cin'
IDL> cine_time, filename, times
IDL> img = cineload(filename, 0) ; get the first frame
NOTES:
MODIFICATION HISTORY:
27-Feb-2013 error message, and assume FirstFrame=0, if frame outside
range in file. This is necessary for some apps when the
first frame in the file is not 0.
03-Jan-2013 fixed exposure output
22-Jun-2010 don't return image as UINT if only 8 bits
02-Apr-2010 flip Miro files if gt 137000, according to Lane
01-Jul-2009 merged "memory feature" of cine_time.pro with this
12-Nov-2008 Hide firstFrame ne 0 within this routine, so calling program
can ask for first frame.
10-Nov-2008 don't force frame=0 when /INIT [BD]
02-Jul-2008 added capability for MIRO color cameras [BD]
19-Apr-2007 added keyword INIT in case frames don't start at 1 [BD]
IDL> img = CINELOAD(GETENV("NSTXUSR")+'/miro/MIRO_130363.cin', 100, /debug)
IDL> img = CINELOAD(GETENV("NSTXUSR")+'/phantom4/NSTX_130363.cin', 100, /debug)
WRITTEN by Ricky Maqueda, Bill Davis & Werner Boeglin
Source: src/idl_cvs/cinerate.pro
NAME:
cinerate
PURPOSE:
Return framing rate from a .cin file from a Phantom 7 camera.
CATEGORY:
Image Processing
CALLING SEQUENCE:
IDL> rate= cinerate( filename )
RETURNED:
rate - frames per second
INPUTS:
filename - a .cin file
KEYWORD PARAMETERS:
OUTPUT:
serialNum - serial number of camera
warning - if set to 0, will not pop dialog up for messages
EXAMPLE:
IDL> cine_time,'/p/camdata/dust/nstx121048.cin', time
NOTES:
MODIFICATION HISTORY:
Written by Bill Davis 17-Jul
Source: src/idl_cvs/cinethumbnails.pro
NAME:
cineThumbNails
PURPOSE:
Plot thumbnails of many frames from a .cin file
CATEGORY:
Fast Cameras
CALLING SEQUENCE:
IDL> cinethumbnails, shot
INPUTS:
shot - optional alternate to filename; if more than one cine file found
you will get a dialog box (if no shot or filename entered, will be prompted)
KEYWORD PARAMETERS:
Inputs:
(Optional)
filename - optional name of cine file (fastest when this used)
t1 - start time of thumbnails (sec.)
t2 - end time of thumbnails (sec.)
nWanted - # of thumbnails (defaults to 108)
edge - if set, will show plasma edge on picture (separatrix) (NOT WORKING)
deltaT - time between thumbnails
minVal - min value to use in byte scaling (default=0)
maxVal - max value to use in byte scaling (default depends on camera type)
>>> if = 0, each frame will be byte scaled.
bytescale - if set, bytescale frames
gamma - gamma to apply to image (Default=0.55)
ctb - color table for non-color image
saturation - (Default=0.3)
xsize - horizontal size of plot window (defaults to 640, but will let you manually expand)
ysize - vertical size of plot window (defaults to 512, but will let you manually expand)
label - if=0 will not label each frame with time in msec
title - if=0 will not print file name at top right of frame
horizontal_flip - if set, flip images horizontally
vertical_flip - if set, flip images vertically
RotCCW - rotate image Counter-ClockWise
RotCW - rotate image ClockWise
nRows - # of rows of thumbnails
top2bottom - if=0, time will go from bottom to top
border - # of pixels between images (default=1)
verbose - if set, will print many informational messages
debug - if set, debug output will be printed
Outputs:
(none)
OUTPUTS:
just plots to graphic window
EXAMPLES:
!P.FONT=0
setup_ps, 'Thumbs_138117.ps', printer = 'postscript color'
cinethumbnails, /horiz, /rotccw, ctb=3, $
'/p/nstxcam-archive/Phantom710-9205/2010/nstx_5_138117.cin', $
minVal=20, maxVal=230, nWanted=40, /edge, $
t1=0.242,t2=0.248, xsize=900, ysize=580, nsmooth=3, thick=3
unsetup_ps
cinethumbnails, /horiz, /rotccw, ctb=3, $
'/p/nstxcam-archive/Phantom710-9205/2010/nstx_5_139050.cin', $
t1=0.399,t2=0.455, xsize=900, ysize=580,/debug
IDL> i = 0
IDL> i = i+1
IDL> cinethumbnails, '/p/nstxcam-archive/Phantom710-9205/2010/nstx_5_138120.cin', $
t1=0.219+i*0.001, t2=0.219+(i+1)*0.001, /horizontal_flip, /RotCCW, ctb=3, $
xsize=1024, ysize=780
IDL> mk_jpeg,'~/sh138120_'+strtrim(219+i,2)+'ms.jpg'
IDL> cinethumbnails, '/p/nstxcam/Miro2-7988/2010/nstx_2_137600.cin'
(expand window manually)
IDL> cinethumbnails, 137726, xsize=1600,ysize=1000, t1=.03, t2=.31, nwanted=45
(select the Miro file)
IDL> cinethumbnails,'/p/nstxcam/Phantom73-6663/2010/nstx_3_137726.cin',maxval=0, $
t1=.100,t2=.274 ; (will byte scale each frame)
IDL> cinethumbnails,'/p/nstxcam/Phantom710-9206/2010/nstx_1_137726.cin',maxval=2000, $
t1=.246,t2=.267,nw=23
; to test separtrix drawing
IDL> cinethumbnails, '/p/nstxcam/Phantom710-9205/2010/nstx_5_139444.cin', $
t1=.255,t2=.285, /horizontal_flip, /RotCCW, ctb=3, $
nwanted=20, /bytescale, /edge
; or from CMOD:
IDL> cinethumbnails, $
'/p/gpi/szweben/Phantom_Data/2009_Phantom_data/1091216/shot_1091216028.cin', $
t1=.0,t2=.02, /horizontal_flip, ctb=3, nwanted=20, /bytescale, /edge
IDL> cinethumbnails, '/p/nstxcam/Phantom73-8032/2010/nstx_4_137702.cin'
IDL> mk_jpeg, 'mythumbs.jpg' ; make a jpeg file of whatever is plotted
NOTES:
see http://nstx.pppl.gov/nstx/Software/Applications/cinethumbnails.html
for examples
MODIFICATION HISTORY:
07-Mar-2013 added keywords top2bot (now default), nrows, and border (def=1)
26-Feb-2013 mods to work from a web page. Added medsmooth keyword.
12-Dec-2011 put flip and rotate in for doing blob work. Also adding option to show
separatrix and limiter shadow
14-Dec-2010 made to work with monochrome files (not True Color)
Written by Bill Davis, 12-Apr-2010
Source: src/idl_cvs/cine_load.pro
A MORE GENERAL VERSION OF THIS IS CALLED CINELOAD.PRO, which works for
8-bit files, as well.
NAME:
cine_load
PURPOSE:
Read a frame from a .cin file from a Phantom 7 camera.
CATEGORY:
Image Processing
CALLING SEQUENCE:
IDL> image = cine_load( filename, framenum, exposure)
INPUTS:
KEYWORD PARAMETERS:
INPUT:
filename - a .cin file
framenum - integer of frame number
verbose - if set, will print informational output
status - 1=OK, 0 means problem
OUTPUT:
fps - frames per seconc
exposure - in microseconds (probably)
OUTPUTS:
none.
COMMON BLOCKS:
none
EXAMPLE:
IDL> cine_time,'/p/camdata/dust/nstx121048.cin',time
IDL> img=cine_load( GETENV("NSTXUSR")+'/phantom4/MIRO_130289.cin', 100 )
for MIRO file:
IDL> img=cine_load( '/p/camdata/dust/nstx121048.cin', 10, fps, exposure)
help
EXPOSURE ULONG = 9
FPS ULONG = 68000
IMG UINT = Array[128, 128]
TIME DOUBLE = Array[27201]
NOTES:
MODIFICATION HISTORY:
17-Jun-2008 check for existence of file
16-mar-2007 moved file info reas into initial file access code so don't have
to be repeated for every frame
29-Jan-2007 better error handling
Written by Bill Davis, for Lane Roquemore, 31-May-2006
from cine_display_range.pro written by Ricky Maqueda.
Source: src/idl_cvs/cine_snum.pro
NAME:
cine_snum
PURPOSE:
Return camera serial number from a .cin file from a Phantom camera.
CATEGORY:
Image Processing
CALLING SEQUENCE:
IDL> serialNumber = cine_snum( filename )
INPUTS:
KEYWORD PARAMETERS:
INPUT:
filename - a .cin file
OUTPUT:
serialNumber - serial number of camera
EXAMPLE:
IDL> print, cine_snum('/p/nstxcam/Miro2-7988/2010/nstx_2_137839.cin')
MODIFICATION HISTORY:
Written May-2010 by Bill Davis
from program written by Ricky Maqueda.
Source: src/idl_cvs/cine_time.pro
NAME:
cine_time
PURPOSE:
Read time from a .cin file from a Phantom 7 camera.
CATEGORY:
Image Processing
CALLING SEQUENCE:
IDL> cine_time, filename, times[, frames, xsize=xsize, ysize=ysize]
INPUTS:
KEYWORD PARAMETERS:
INPUT:
filename - a .cin file
OUTPUT:
times - array of times in seconds of frames
frames - array of frame numbers
firstImage - first image number
imageSize - image size in bytes
xsize - horizontal size of an image
ysize - vertical size of an image
serialNum - serial number of camera
warning - if set to 0, will not pop dialog up for messages
EXAMPLE:
IDL> cine_time,'/p/camdata/dust/nstx121048.cin', time
NOTES:
MODIFICATION HISTORY:
19-Aug-2012 fixed dt being 2usec, 3usec, 2usec, etc. for Phantoms with 400,000 rate
16-Aug-2010 added warning keyword, so doesn't pop dialog box on wall if error
22-Jun-2010 don't make image UINT if only 8 bits
05-May-2010 added keyword serialNum
02-Apr-2010 flip Miro files if gt 137000, according to Lane
01-Jul-2009 merged "memory feature" of cineload.pro with this
17-Jul-2008 return FirstImage (first frame)
17-Jun-2008 check for existence of file
27-Apr-2007 commented out time-correction code which was giving -NaN for
$NSTXUSR/phantom4/flipped_123648.cin (exposure time was changed)
Written by Bill Davis, for Lane Roquemore, 31-May-2006
from program written by Ricky Maqueda.
Source: src/idl_cvs/cleanplot.pro
NAME:
CLEANPLOT
PURPOSE:
Reset all system variables (!P,!X,!Y,!Z) to their default values
CATEGORY:
Plotting
EXPLANATION:
Reset all system variables (!P,!X,!Y,!Z) which are set by the user
and which affect plotting to their default values.
CALLING SEQUENCE:
Cleanplot
INPUTS:
None
OUTPUTS:
None
SIDE EFFECTS:
The system variables that concern plotting are reset
to their default values. A message is output for each
variable changed. The CRANGE, S, WINDOW, and REGION fields of the
!X, !Y, and !Z system variables are not checked since these are
set by the graphics device and not by the user.
PROCEDURE:
This does NOT reset the plotting device.
This does not change any system variables that don't control plotting.
RESTRICTIONS:
If user default values for !P, !X, !Y and !Z are different from
the defaults adopted below, user should change P_old etc accordingly
MODIFICATION HISTORY:
Written IDL Version 2.3.0 W. Landsman & K. Venkatakrishna May '92
Handle new system variables in V3.0.0 W. Landsman Dec 92
Assume user has at least V3.0.0 W. Landsman August 95
V5.0 has 60 instead of 30 TICKV values W. Landsman Sep. 97
Change !D.N_COLORS to !D.TABLE_SIZE for 24 bit displays
W. Landsman April 1998
Source: src/idl_cvs/clearplt.pro
NAME:
CLEARPLT
PURPOSE:
This procedure will clear or zero all or a selection
of the system plot variables
CATEGORY:
Plotting
CALLING SEQUENCE:
clearplt,/all ;clear the !p, !x, !y, !z
clearplt,/x,/z ;clear the !x and !z variables
clearplt,/x ;only clear the !x variable
clearplt,/x,/invert ;clear all except the !x
INPUTS:
KEYWORDS:
x,y,z,p = clear the appropriate variable
all = clear all, this is equivalent to /x,/y,/z,/p
invert = invert the logic. Clear all unselected variables.
Therefore "clearplt,/all,/invert" does nothing.
OUTPUTS: none
COMMON BLOCKS:
none.
SIDE EFFECTS:
The sytem plot variables are changed.
MODIFICATION HISTORY:
20-Apr-99 [BD] more things cleared for !P
Written by: Trevor Harris, Physics Dept., University of Adelaide,
July, 1990.
Source: src/idl_cvs/clickonw.pro
NAME:
clickonw
PURPOSE:
Allow recording of click locations on Tiff files.
e.g., can be used for tracking dust particles from fast camera
images of plasmas
CATEGORY:
Image Processing
CALLING SEQUENCE:
IDL> clickonw, filename
INPUTS:
filename - an image file, such tiff, pbm, gif, etc.
(or will pop dialog box for TIFF file)
KEYWORD PARAMETERS:
(optional)
drawXSize - the horizontal size in pixels of the image window
INTERP - if =0, pixels will be blown up as is, rather than being smoothed
colorTable - default to IDL color table 3 (hot metal)
startTime - start time in seconds
radius - 1/2 of square in pixels drawn around click point, setting the area
to be used for the maxval calculation.
GROUP_LEADER - Group_Leader ID
OUTPUTS:
none.
COMMON BLOCKS:
none
ROUTINES USED:
MK_COLOR, usingXwindows
EXAMPLE:
IDL> clickonw ; you will be prompted for an image file
NOTES:
use fcplayer for files from Phantom 7 and Miro cameras.
MODIFICATION HISTORY:
29-Jun-2006 Fixed the back button when reading individual files
20-Apr-2006 Written by Bill Davis, PPPL
Source: src/idl_cvs/colorbar.pro
NAME:
COLORBAR
PURPOSE:
The purpose of this routine is to add a color bar to the current
graphics window.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
CATEGORY:
Graphics, Widgets.
CALLING SEQUENCE:
COLORBAR
INPUTS:
None.
KEYWORD PARAMETERS:
ANNOTATECOLOR: The name of the "annotation color" to use. The names are those for
FSC_COLOR, and using the keyword implies that FSC_COLOR is also in
your !PATH. If this keyword is used, the annotation color is loaded
*after* the color bar is displayed. The color will be represented
as theColor = FSC_COLOR(ANNOTATECOLOR, COLOR). This keyword is provide
to maintain backward compatibility, but also to solve the problem of
and extra line in the color bar when this kind of syntax is used in
conjunction with the indexed (DEVICE, DECOMPOSED=0) model is used:
LoadCT, 33
TVImage, image
Colorbar, Color=FSC_Color('firebrick')
The proper syntax for device-independent color is like this:
LoadCT, 33
TVImage, image
Colorbar, AnnotateColor='firebrick', Color=255
BOTTOM: The lowest color index of the colors to be loaded in
the bar.
CHARSIZE: The character size of the color bar annotations. Default is !P.Charsize.
COLOR: The color index of the bar outline and characters. Default
is !P.Color..
DIVISIONS: The number of divisions to divide the bar into. There will
be (divisions + 1) annotations. The default is 6.
FONT: Sets the font of the annotation. Hershey: -1, Hardware:0, True-Type: 1.
FORMAT: The format of the bar annotations. Default is '(I0)'.
INVERTCOLORS: Setting this keyword inverts the colors in the color bar.
MAXRANGE: The maximum data value for the bar annotation. Default is
NCOLORS.
MINRANGE: The minimum data value for the bar annotation. Default is 0.
MINOR: The number of minor tick divisions. Default is 2.
NCOLORS: This is the number of colors in the color bar.
NODISPLAY: COLORBAR uses FSC_COLOR to specify some of it colors. Normally,
FSC_COLOR loads "system" colors as part of its palette of colors.
In order to do so, it has to create an IDL widget, which in turn
has to make a connection to the windowing system. If your program
is being run without a window connection, then this program will
fail. If you can live without the system colors (and most people
don't even know they are there, to tell you the truth), then setting
this keyword will keep them from being loaded, and you can run
COLORBAR without a display.
POSITION: A four-element array of normalized coordinates in the same
form as the POSITION keyword on a plot. Default is
[0.88, 0.10, 0.95, 0.90] for a vertical bar and
[0.10, 0.88, 0.90, 0.95] for a horizontal bar.
RANGE: A two-element vector of the form [min, max]. Provides an
alternative way of setting the MINRANGE and MAXRANGE keywords.
REVERSE: Setting this keyword reverses the colors in the colorbar.
RIGHT: This puts the labels on the right-hand side of a vertical
color bar. It applies only to vertical color bars.
TICKNAMES: A string array of names or values for the tick marks.
TITLE: This is title for the color bar. The default is to have
no title.
TOP: This puts the labels on top of the bar rather than under it.
The keyword only applies if a horizontal color bar is rendered.
VERTICAL: Setting this keyword give a vertical color bar. The default
is a horizontal color bar.
MATCH: If set will match color bar to extent of plot.
COMMON BLOCKS:
None.
SIDE EFFECTS:
Color bar is drawn in the current graphics window.
RESTRICTIONS:
The number of colors available on the graphics display device (not the
PostScript device) is used unless the NCOLORS keyword is used.
Requires the FSC_COLOR program from the Coyote Library:
http://www.dfanning.com/programs/fsc_color.pro
EXAMPLES:
To display a horizontal color bar above a contour plot, type:
LOADCT, 5, NCOLORS=100
CONTOUR, DIST(31,41), POSITION=[0.15, 0.15, 0.95, 0.75], $
C_COLORS=INDGEN(25)*4, NLEVELS=25
COLORBAR, NCOLORS=100, POSITION=[0.15, 0.8, 0.95, 0.90]
To display a vertical color bar in the lower right of a contour plot, type:
IDL> device, decompose=0
IDL> loadct, 3
IDL> contour, dist(100), /fill, nlevels=100, zstyle=1
IDL> colorbar, pos=[.92,.1,.95,.4], /vert, title='Kev'
MODIFICATION HISTORY:
Written by: David W. Fanning, 10 JUNE 96.
10/27/96: Added the ability to send output to PostScript. DWF
11/4/96: Substantially rewritten to go to screen or PostScript
file without having to know much about the PostScript device
or even what the current graphics device is. DWF
1/27/97: Added the RIGHT and TOP keywords. Also modified the
way the TITLE keyword works. DWF
7/15/97: Fixed a problem some machines have with plots that have
no valid data range in them. DWF
12/5/98: Fixed a problem in how the colorbar image is created that
seemed to tickle a bug in some versions of IDL. DWF.
1/12/99: Fixed a problem caused by RSI fixing a bug in IDL 5.2. Sigh... DWF.
3/30/99: Modified a few of the defaults. DWF.
3/30/99: Used NORMAL rather than DEVICE coords for positioning bar. DWF.
3/30/99: Added the RANGE keyword. DWF.
3/30/99: Added FONT keyword. DWF
5/6/99: Many modifications to defaults. DWF.
5/6/99: Removed PSCOLOR keyword. DWF.
5/6/99: Improved error handling on position coordinates. DWF.
5/6/99. Added MINOR keyword. DWF.
5/6/99: Set Device, Decomposed=0 if necessary. DWF.
2/9/99: Fixed a problem caused by setting BOTTOM keyword, but not NCOLORS. DWF.
8/17/99. Fixed a problem with ambiguous MIN and MINOR keywords. DWF
8/25/99. I think I *finally* got the BOTTOM/NCOLORS thing sorted out. :-( DWF.
10/10/99. Modified the program so that current plot and map coordinates are
saved and restored after the colorbar is drawn. DWF.
3/18/00. Moved a block of code to prevent a problem with color decomposition. DWF.
4/28/00. Made !P.Font default value for FONT keyword. DWF.
9/26/00. Made the code more general for scalable pixel devices. DWF.
1/16/01. Added INVERTCOLORS keyword. DWF.
5/11/04. Added TICKNAME keyword. DWF.
9/29/05. Added REVERSE keywords, which does the *exact* same thing as
INVERTCOLORS, but I can never remember the latter keyword name. DWF.
1/2/07. Added ANNOTATECOLOR keyword. DWF.
4/14/07. Changed the default FORMAT to I0. DWF.
5/1/07. Unexpected consequence of default format change is colorbar annotations
no longer match contour plot levels. Changed to explicit formating of
colorbar axis labels before PLOT command. DWF.
5/25/07. Previous change has unanticipated effect on color bars using
logarithmic scaling, which is not really supported, but I have an
article on my web page describing how to do it: http://www.dfanning.com/graphics_tips/logcb.html.
Thus, I've fixed the program to accommodate log scaling, while still not OFFICIALLY
supporting it. DWF.
10/3/07. Method used to calculate TICKNAMES produces incorrect values in certain cases when
the min and max range values are integers. Now force range values to be floats. DWF.
10/17/07. Accidentaly use of INTERP keyword in CONGRID results in wrong bar values for
low NCOLORS numbers when INVERTCOLORS or REVERSE keyword is used. Removed INTERP keyword. DWF.
11/10/07. Finished fixing program to accommodate log scaling in ALL possible permutations. DWF.
8 Feb 2008. Added CRONJOB keyword and decided to use month names when I write the date. DWF.
8 Feb 2008. Renamed CRONJOB to NODISPLAY to better reflect its purpose. DWF.
21 May 2008. Changed the default CHARSIZE to !P.CHARSIZE from 1.0. DWF.
30 Oct 2008. Fixed a problem with the FONT keyword not being recognized in certain
configurations.
13-Dec-2010 Default range to !Z.CRANGE (set when contour was last called) [BD]
19-Jul-2011 Added Match keyword to make vertical colorbar match in height to plot
window. Also, default to having number on outside of colorbar when
vertical and on the right. [BD]
23-Sep-2013 show every other tic value when numbers large [BD]
Source: src/idl_cvs/colorbarbd.pro
NAME:
COLORBARbd
PURPOSE:
The purpose of this routine is to add a color bar to the current
graphics window. (this is a mod by BD to handle veritcal plot ticknames better)
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
CATEGORY:
Graphics, Widgets.
CALLING SEQUENCE:
COLORBAR
INPUTS:
None.
KEYWORD PARAMETERS:
ANNOTATECOLOR: The name of the "annotation color" to use. The names are those for
FSC_COLOR, and using the keyword implies that FSC_COLOR is also in
your !PATH. If this keyword is used, the annotation color is loaded
*after* the color bar is displayed. The color will be represented
as theColor = FSC_COLOR(ANNOTATECOLOR, COLOR). This keyword is provide
to maintain backward compatibility, but also to solve the problem of
and extra line in the color bar when this kind of syntax is used in
conjunction with the indexed (DEVICE, DECOMPOSED=0) model is used:
LoadCT, 33
TVImage, image
Colorbar, Color=FSC_Color('firebrick')
The proper syntax for device-independent color is like this:
LoadCT, 33
TVImage, image
Colorbar, AnnotateColor='firebrick', Color=255
BOTTOM: The lowest color index of the colors to be loaded in
the bar.
CHARSIZE: The character size of the color bar annotations. Default is !P.Charsize.
COLOR: The color index of the bar outline and characters. Default
is !P.Color..
DIVISIONS: The number of divisions to divide the bar into. There will
be (divisions + 1) annotations. The default is 6.
FONT: Sets the font of the annotation. Hershey: -1, Hardware:0, True-Type: 1.
FORMAT: The format of the bar annotations. Default is '(I0)'.
INVERTCOLORS: Setting this keyword inverts the colors in the color bar.
MAXRANGE: The maximum data value for the bar annotation. Default is
NCOLORS.
MINRANGE: The minimum data value for the bar annotation. Default is 0.
MINOR: The number of minor tick divisions. Default is 2.
NCOLORS: This is the number of colors in the color bar.
NODISPLAY: COLORBAR uses FSC_COLOR to specify some of it colors. Normally,
FSC_COLOR loads "system" colors as part of its palette of colors.
In order to do so, it has to create an IDL widget, which in turn
has to make a connection to the windowing system. If your program
is being run without a window connection, then this program will
fail. If you can live without the system colors (and most people
don't even know they are there, to tell you the truth), then setting
this keyword will keep them from being loaded, and you can run
COLORBAR without a display.
POSITION: A four-element array of normalized coordinates in the same
form as the POSITION keyword on a plot. Default is
[0.88, 0.10, 0.95, 0.90] for a vertical bar and
[0.10, 0.88, 0.90, 0.95] for a horizontal bar.
RANGE: A two-element vector of the form [min, max]. Provides an
alternative way of setting the MINRANGE and MAXRANGE keywords.
REVERSE: Setting this keyword reverses the colors in the colorbar.
RIGHT: This puts the labels on the right-hand side of a vertical
color bar. It applies only to vertical color bars.
TICKNAMES: A string array of names or values for the tick marks.
TITLE: This is title for the color bar. The default is to have
no title.
TOP: This puts the labels on top of the bar rather than under it.
The keyword only applies if a horizontal color bar is rendered.
VERTICAL: Setting this keyword give a vertical color bar. The default
is a horizontal color bar.
MATCH: If set will match color bar to extent of plot.
COMMON BLOCKS:
None.
SIDE EFFECTS:
Color bar is drawn in the current graphics window.
RESTRICTIONS:
The number of colors available on the graphics display device (not the
PostScript device) is used unless the NCOLORS keyword is used.
Requires the FSC_COLOR program from the Coyote Library:
http://www.dfanning.com/programs/fsc_color.pro
EXAMPLES:
To display a horizontal color bar above a contour plot, type:
LOADCT, 5, NCOLORS=100
CONTOUR, DIST(31,41), POSITION=[0.15, 0.15, 0.95, 0.75], $
C_COLORS=INDGEN(25)*4, NLEVELS=25
COLORBAR, NCOLORS=100, POSITION=[0.15, 0.8, 0.95, 0.90]
To display a vertical color bar in the lower right of a contour plot, type:
IDL> device, decompose=0
IDL> loadct, 3
IDL> contour, dist(100), /fill, nlevels=100, zstyle=1
IDL> colorbar, pos=[.92,.1,.95,.4], /vert, title='Kev'
MODIFICATION HISTORY:
Written by: David W. Fanning, 10 JUNE 96.
10/27/96: Added the ability to send output to PostScript. DWF
11/4/96: Substantially rewritten to go to screen or PostScript
file without having to know much about the PostScript device
or even what the current graphics device is. DWF
1/27/97: Added the RIGHT and TOP keywords. Also modified the
way the TITLE keyword works. DWF
7/15/97: Fixed a problem some machines have with plots that have
no valid data range in them. DWF
12/5/98: Fixed a problem in how the colorbar image is created that
seemed to tickle a bug in some versions of IDL. DWF.
1/12/99: Fixed a problem caused by RSI fixing a bug in IDL 5.2. Sigh... DWF.
3/30/99: Modified a few of the defaults. DWF.
3/30/99: Used NORMAL rather than DEVICE coords for positioning bar. DWF.
3/30/99: Added the RANGE keyword. DWF.
3/30/99: Added FONT keyword. DWF
5/6/99: Many modifications to defaults. DWF.
5/6/99: Removed PSCOLOR keyword. DWF.
5/6/99: Improved error handling on position coordinates. DWF.
5/6/99. Added MINOR keyword. DWF.
5/6/99: Set Device, Decomposed=0 if necessary. DWF.
2/9/99: Fixed a problem caused by setting BOTTOM keyword, but not NCOLORS. DWF.
8/17/99. Fixed a problem with ambiguous MIN and MINOR keywords. DWF
8/25/99. I think I *finally* got the BOTTOM/NCOLORS thing sorted out. :-( DWF.
10/10/99. Modified the program so that current plot and map coordinates are
saved and restored after the colorbar is drawn. DWF.
3/18/00. Moved a block of code to prevent a problem with color decomposition. DWF.
4/28/00. Made !P.Font default value for FONT keyword. DWF.
9/26/00. Made the code more general for scalable pixel devices. DWF.
1/16/01. Added INVERTCOLORS keyword. DWF.
5/11/04. Added TICKNAME keyword. DWF.
9/29/05. Added REVERSE keywords, which does the *exact* same thing as
INVERTCOLORS, but I can never remember the latter keyword name. DWF.
1/2/07. Added ANNOTATECOLOR keyword. DWF.
4/14/07. Changed the default FORMAT to I0. DWF.
5/1/07. Unexpected consequence of default format change is colorbar annotations
no longer match contour plot levels. Changed to explicit formating of
colorbar axis labels before PLOT command. DWF.
5/25/07. Previous change has unanticipated effect on color bars using
logarithmic scaling, which is not really supported, but I have an
article on my web page describing how to do it: http://www.dfanning.com/graphics_tips/logcb.html.
Thus, I've fixed the program to accommodate log scaling, while still not OFFICIALLY
supporting it. DWF.
10/3/07. Method used to calculate TICKNAMES produces incorrect values in certain cases when
the min and max range values are integers. Now force range values to be floats. DWF.
10/17/07. Accidentaly use of INTERP keyword in CONGRID results in wrong bar values for
low NCOLORS numbers when INVERTCOLORS or REVERSE keyword is used. Removed INTERP keyword. DWF.
11/10/07. Finished fixing program to accommodate log scaling in ALL possible permutations. DWF.
8 Feb 2008. Added CRONJOB keyword and decided to use month names when I write the date. DWF.
8 Feb 2008. Renamed CRONJOB to NODISPLAY to better reflect its purpose. DWF.
21 May 2008. Changed the default CHARSIZE to !P.CHARSIZE from 1.0. DWF.
30 Oct 2008. Fixed a problem with the FONT keyword not being recognized in certain
configurations.
13-Dec-2010 Default range to !Z.CRANGE (set when contour was last called) [BD]
19-Apr-2011 handle values like 1e16. Make "nicer" intervals for tickmarks [BD]
fix use of maxrange and minrange
19-Jul-2011 Added Match keyword to make vertical colorbar match in height to plot
window. Also, default to having number on outside of colorbar when
vertical and on the right.
Source: src/idl_cvs/colorsearch.pro
NAME:
colorSearch
PURPOSE:
Return color index (or closest available) from the color name.
CATEGORY:
Colors, Graphics
CALLING SEQUENCE:
index = colorSearch( colorName )
INPUT:
colorName: A string with the name of the color. 'WHITE','BLACK','YELLOW',
'RED','GREEN','BLUE','MAGENTA','YELLOW','ORANGE', 'PURPLE',
'DarkGreen','LTBLUE', 'GREY', 'GOLD','GreenYellow','PaleGoldenrod','BROWN',
'LightSeaGreen', 'SALMON', 'MediumVioletRed'
(colorName is NOT case sensitive)
Synonyms are handled as follows:
'GREY' = 'GRAY'
'DARKGRAY' = 'GRAY'
'CHARCOAL' = 'GRAY'
'AQUAMARINE' = 'GREEN'
'SKYBLUE' = 'LTBLUE'
'LT_BLUE' = 'LTBLUE'
'CYAN' = 'LTBLUE'
'DKBLUE' = 'BLUE'
'DARKBLUE' = 'BLUE'
'DK_BLUE' = 'BLUE'
'VIOLET' = 'MAGENTA'
or, if colorName =
'FOREGROUND' then simply return, !p.color
'BACKGROUND' then simply return, !p.background
KEYWORD PARAMETERS:
INIT - if set, will load color table 39 (rainbow with Black and white),
and !p.color will be set to black, and !p.background to white.
*** NOTE that the SET_PLOT command can change !p.color and !p.background.
debug - if set, will print informational messages
quiet - if set, will not warn if color found is not close to that asked for
status - if = 1, then color was found, else 0
RESTRICTIONS:
If match is not found it will return the index of the "closest" table location, and
status=0, and, if /quiet is not set, it will print a warning.
Note that the SET_PLOT command (from IDL Help):
"sets the default color !P.COLOR to the maximum color index minus one or,
in the case of devices with white backgrounds, such as PostScript, to 0 (black)."
After calling SET_PLOT,'X' or SET_PLOT,'Z' you will have to re-call a=colorSearch( /init )
to return to plotting black lines on a white background.
EXAMPLES:
plot, indgen(10), color=colorSearch( /init )
oplot, indgen(10)/2, color=colorSearch('red')
names = colorsearch( /RETURNnames )
dum = mk_color(table=32)
plot, indgen(280), ystyle=3, /nodata
for i=0, n_elements( names )-1 do oplot, [0,255], [colorsearch(names[i]),colorsearch(names[i])], $
color=colorsearch(names[i])
for i=0, n_elements( names )-1 do xyouts, 256,colorsearch(names[i]), names[i], color=colorsearch(names[i])
MODIFICATION HISTORY:
26-Jan-2007 Written by Bill Davis, PPPL
Source: src/idl_cvs/color_resource_example.pro
NAME:
color_resource_example
PURPOSE:
Example of color buttons on a widget.
CATEGORY:
GUI, Color, Example
CALLING SEQUENCE:
IDL> color_resource_example
INPUTS:
none.
KEYWORD PARAMETERS:
none.
OUTPUTS:
none.
EXAMPLE:
IDL> color_resource_example
NOTES:
For IDL color widgets, you need corresponding lines in your
~/.Xresources file (on the computer that is managing your X windows!),
e.g., :
Idl*colorbuttons*blue*background:blue
Idl*colorbuttons*red*background: red
Idl*colorbuttons*lightblue*background: lightblue
Idl*colorbuttons*green*background: green
Idl*colorbuttons*purple*background: purple
Idl*colorbuttons*yellow*background: yellow
Idl*colorbuttons*white*background: white
Idl*colorbuttons*gold*background: gold
Idl*colorbuttons*black*background: black
Idl*colorbuttons*magenta*background: magenta
Idl*colorbuttons*orange*background: orange
LIMITATIONS:
This works consistantly on PPPL Solaris 2.6 computers.
Bug On Linux, the colors initially work,
but disappear on subsequent execution!
MODIFICATION HISTORY:
18-Apr-03 Written by Bill Davis, PPPL
Source: src/idl_cvs/color_status_example.pro
NAME:
color_status_example
PURPOSE:
Example of color status fields on a widget.
CATEGORY:
GUI, Example, Color, Monitoring Application
EXPLANATION:
Makes two rows, each with two buttons to send a color to an
adjacent status field. The status field is just a window in which
the appropriate colors are drawn. MK_COLOR, or a similar routine,
should be used for consistant color display.
CALLING SEQUENCE:
IDL> color_status_example
INPUTS:
none.
KEYWORD PARAMETERS:
none.
OUTPUTS:
none.
COMMON BLOCKS:
info
ROUTINES USED:
MK_COLOR
EXAMPLE:
IDL> color_status_example
NOTES:
The status fields are initially the background color.
A real program might want to save !D.WINDOW before the TV commands
and restore it immediately afterwards.
MODIFICATION HISTORY:
11-May-00 Written by Bill Davis, PPPL
Source: src/idl_cvs/combine_structs.pro
NAME:
COMBINE_STRUCTS
PURPOSE:
takes two arrays of structures str1,str2 which have the
same number of elements but possibly different tags
and makes another structure which has the same number of elements
but the tags of both str1,str2 and has their respective tags
values copied into it
CATEGORY:
Programming
CALLING SEQUENCE
combine_structs, struct1, struct2, newstruct, structyp=structyp
INPUTS:
struct1,struc2: The two structures to be combined. If structure arrays,
Must contain the same number of structs.
KEYWORD PARAMETERS:
structyp: a string with the name of the new structure.
if already defined the program will crash.
Author Dave Johnston UofM
Source: src/idl_cvs/compw.pro
NAME:
compw
PURPOSE:
Plot two signals and the difference.
CATEGORY:
Plotting
CALLING SEQUENCE:
compw
compw, xsize=800, ysize=600
compw, shot=120200, sig1='\wf::ipf2l', sig2='\wf::ipf2u'
compw, shot=120200
compw,sig1='\operations::bdot_l1dmivvhn1_raw',shot=110091, $
t1=.4, t2=.41
COMMON BLOCKS:
USE:
NOTES:
Your display may have to be set to 256 colors to see the crosshairs.
see http://w3.pppl.gov/~pshare/help/xtc.htm to setup XTC.
LIMITATIONS:
You need IDL version 5, or greater to run this application.
MODIFICATION HISTORY:
03-Dec-2007 read widget fields when plot button clicked. Reset cross-hair
dimensions when window resized
29-Nov-2007 Change plot & oplot to vplot & voplot [BD]
08-May-2003 Created from FireTips test [BD]
Source: src/idl_cvs/convangle.pro
NAME:
convangle
PURPOSE:
convert angle from one scheme to another. For example, some routines
have 0 horizontally to the left, with angles increasing in a clockwise
direction. and others have zero to the right, with angles increasing
in a counter-clockwise direction.
CATEGORY:
Utility
CALLING SEQUENCE:
IDL> angle_out = convangle(angle_in)
INPUTS:
angle_in - input angle
KEYWORD PARAMETERS:
Inputs:
degIn - if set, assume input angle is in degrees (DEFAULT)
degOut - if set, assume output angle is in degrees
(if not set, same as degIn)
radIn - if set, assume input angle is in radians
radOut - if set, assume output angle is in radians
zeroLeft - if set, zero degrees is horizontally to the left
zeroRight - if set, zero degrees is horizontally to the right
minDeg - minimum # of degrees to return, if angle < this, add 180 degrees
maxDeg - maximum # of degrees to return , if angle > this, subtract 180 degrees
verbose - if set, will print many informational messages
debug - if set, debug output will be printed
OUTPUTS:
angle_out - converted angle, based on keywords.
EXAMPLES:
IDL> print, convangle( !PI/2, /radIn, /degOut )
90.0000
IDL> print, convangle( 45, /degIn, /InZeroLeft, /OutZeroRight )
135
IDL> print, convangle( !PI/4, /radIn, /InZeroLeft, /OutZeroRight, /degOut )
135.000
IDL> print, convangle( 110, /degIn, /InZeroLeft, /OutZeroRight )
70
IDL> print, convangle( 30, /degIn, /InZeroRight, /OutZeroLeft )
150
IDL> print, convangle( 30*!PI/180, /radIn, /InZeroRight, /OutZeroLeft, /degOut )
150.000
IDL> print, convangle( 30*!PI/180, /radIn, /InZeroRight, /OutZeroLeft )*180/!PI
150.000
IDL> print, convangle( 20, /degIn, /InZeroLeft, /OutZeroright, maxDeg=135 )
-20
IDL> print, convangle( 120, /degIn, /InZeroLeft, /OutZeroright, maxDeg=135 )
60
IDL> print, convangle( 230, /degIn, /InZeroLeft, /OutZeroright, minDeg=-45 )
130
NOTES/LIMITATIONS:
if zero degrees is to the left, assume positive angles in Clockwise dir
if zero degrees is to the right, assume positive angles in
Counter-Clockwise dir
MODIFICATION HISTORY:
06-Feb-2013 Written by Bill Davis, PPPL
Source: src/idl_cvs/convolve.pro
NAME:
CONVOLVE
PURPOSE:
Convolution of an image with a Point Spread Function (PSF)
CATEGORY:
Image Processing, Math
EXPLANATION:
The default is to compute the convolution using a product of
Fourier transforms (for speed).
CALLING SEQUENCE:
psf = psf_Gaussian( NPIXEL=21, FWHM=5, /NORMALIZE )
imconv = convolve( image1, psf, FT_PSF = psf_FT )
or:
correl = convolve( image1, image2, /CORREL )
or:
correl = convolve( image, /AUTO )
INPUTS:
image = 2-D array (matrix) to be convolved with psf
psf = the Point Spread Function, (size < or = to size of image).
OPTIONAL INPUT KEYWORDS:
FT_PSF = passes out/in the Fourier transform of the PSF,
(so that it can be re-used the next time function is called).
FT_IMAGE = passes out/in the Fourier transform of image.
/CORRELATE uses the conjugate of the Fourier transform of PSF,
to compute the cross-correlation of image and PSF,
(equivalent to IDL function convol() with NO rotation of PSF)
/AUTO_CORR computes the auto-correlation function of image using FFT.
/NO_FT overrides the use of FFT, using IDL function convol() instead.
(then PSF is rotated by 180 degrees to give same result)
METHOD:
When using FFT, PSF is centered & expanded to size of image.
HISTORY:
written, Frank Varosi, NASA/GSFC 1992.
Converted to IDL V5.0 W. Landsman September 1997
Source: src/idl_cvs/copy_struct.pro
NAME:
COPY_STRUCT
PURPOSE:
Copy all fields with matching tag names from one structure to another
CATEGORY:
Programming
EXPLANATION
Fields with matching tag names are copied from one structure array to
another structure array of different type.
This allows copying of tag values when equating the structures of
different types is not allowed, or when not all tags are to be copied.
Can also recursively copy from/to structures nested within structures.
Note that the number of elements in the output structure array
is automatically adjusted to equal the length of input structure array.
If this not desired then use pro copy_struct_inx which allows
specifying via subscripts which elements are copied where in the arrays.
CALLING SEQUENCE:
copy_struct, struct_From, struct_To, NT_copied
copy_struct, struct_From, struct_To, EXCEPT=["image","misc"]
copy_struct, struct_From, struct_To, /RECUR_TANDEM
INPUTS:
struct_From = structure array to copy from.
struct_To = structure array to copy values to.
KEYWORDS:
EXCEPT_TAGS = string array of tag names to ignore (to NOT copy).
Used at all levels of recursion.
SELECT_TAGS = tag names to copy (takes priority over EXCEPT).
This keyword is not passed to recursive calls in order
to avoid the confusion of not copying tags in sub-structures.
/RECUR_FROM = search for sub-structures in struct_From, and then
call copy_struct recursively for those nested structures.
/RECUR_TO = search for sub-structures of struct_To, and then
call copy_struct recursively for those nested structures.
/RECUR_TANDEM = call copy_struct recursively for the sub-structures
with matching Tag names in struct_From and struct_To
(for use when Tag names match but sub-structure types differ).
OUTPUTS:
struct_To = structure array to which new tag values are copied.
NT_copied = incremented by total # of tags copied (optional)
INTERNAL:
Recur_Level = # of times copy_struct calls itself.
This argument is for internal recursive execution only.
The user call is 1, subsequent recursive calls increment it,
and the counter is decremented before returning.
The counter is used just to find out if argument checking
should be performed, and to set NT_copied = 0 first call.
EXTERNAL CALLS:
pro match (when keyword SELECT_TAGS is specified)
PROCEDURE:
Match Tag names and then use corresponding Tag numbers.
HISTORY:
written 1989 Frank Varosi STX @ NASA/GSFC
mod Jul.90 by F.V. added option to copy sub-structures RECURSIVELY.
mod Aug.90 by F.V. adjust # elements in TO (output) to equal
# elements in FROM (input) & count # of fields copied.
mod Jan.91 by F.V. added Recur_Level as internal argument so that
argument checking done just once, to avoid confusion.
Checked against Except_Tags in RECUR_FROM option.
mod Oct.91 by F.V. added option SELECT_TAGS= selected field names.
mod Aug.95 by W. Landsman to fix match of a single selected tag.
mod Mar.97 by F.V. do not pass the SELECT_TAGS keyword in recursion.
Source: src/idl_cvs/cp2jscopefile.pro
NAME:
cp2jScopeFile
PURPOSE:
Copy an MDSplus Scope input file to one that will work with jScope
CATEGORY:
MDSplus, SCOPE
CALLING SEQUENCE:
cp2jScopeFile, fileName, outfile=outfile
INPUTS:
filename - name of scope input filename (else will get a dialog box)
RETURNED:
KEYWORDS:
COMMON BLOCKS:
none
METHOD:
insert lines in variable addLines after line 2 of input file
EXAMPLE:
(list files changed within the last 1000 days)
find . -name "*.scope" -mtime -1000 -print > dirls.txt
find . -name "*.dat" -mtime -1000 -print >> dirls.txt
idl
IDL> files = read_list('dirls.txt')
IDL> for i=0,n_elements( files )-1 do $
IDL> cp2jScopeFile, files[i], outDir='/p/nstxusr/util/jscp'
IDL>
NOTES:
LIMITATIONS:
MODIFICATION HISTORY:
06-Apr-2010 debugged.
03-Nov-2009 Written by Bill Davis
Source: src/idl_cvs/create_locus_table.pro
NAME:
create_locus_table
PURPOSE:
Create a table in the Locus database following the convention
of data columns named xx0, xx1, xx2, etc.
CATEGORY:
SQL
CALLING SEQUENCE:
IDL> create_locus_table, table, nvars
INPUTS:
table - table name to create in Locus database
nvars - number of variable in table (not counting shot & times)
KEYWORD PARAMETERS:
Optional Inputs:
database - if not present, will default to 'locus'
columns - if not present, will be named 'xx0', 'xx1', 'xx2', etc. as needed
by Locus. These are in addition to the required columns, shot, time, etc.
verbose - if set, will print many informational messages
debug - if set, debug output will be printed
Outputs:
status - if odd, then success
OUTPUTS:
EXAMPLE:
IDL> create_locus_table, 'metals', 7
or
IDL> columns=['Zn','Ar','Li','Al','C']
IDL> create_locus_table, 'metals', n_elements(columns), columns=columns
NOTES:
You need to have permission to create tables in the database
(else send email to dbadmin).
You will need a file called locus.sybase_login in your home
directory -- it can be created with commands similar to those in
/p/nstxusr/util/setup/mkmdsplusdbfile.csh
MODIFICATION HISTORY:
19-Oct-2009 Written by Bill Davis, PPPL
Source: src/idl_cvs/cw_animate_dups.pro
NAME:
CW_ANIMATE_DUPS
PURPOSE:
This widget displays an animated sequence of images using
X-windows Pixmaps. This is a compound widget, based on the
XINTERANIMATE procedure, with the following advantages:
- It can be included in other applications.
- Multiple copies can be run simultaneously.
The speed and direction of the display can be adjusted using
the widget interface.
CATEGORY:
Image display, compound widgets.
CALLING SEQUENCE:
To initially create:
widget = CW_ANIMATE_DUPS(PARENT, SIZEX, SIZEY, NFRAMES)
To reinitialize when another animation is loaded:
CW_ANIMATE_DUPS_INIT, ANIMATEBASE, SIZEX, SIZEY, NFRAMES
To load a single image:
CW_ANIMATE_DUPS_LOAD, WIDGET, IMAGE = IMAGE, FRAME = FRAME_INDEX
To load a single image that is already displayed in an existing window:
CW_ANIMATE_DUPS_LOAD, WIDGET, FRAME = FRAME_INDEX, $
WINDOW = [WINDOW_NUMBER [, X0, Y0, SX, SY]]
(This technique is much faster than reading back from the window.)
To display the animation after all the images have been loaded:
CW_ANIMATE_DUPS, WIDGET [, RATE]
To get a copy of the vector of Pixmaps being used by the widget.
If this routine is called, the widget does not destroy the pixmaps
when it is destroyed. The user can then provide them to a later
call to CW_ANIMATE_DUPS to re-use them while skipping the Pixmap creation
and rendering step:
CW_ANIMATE_DUPS_GETP, widget, PIXMAPS
INPUTS:
CW_ANIMATE_DUPS:
PARENT: The ID of the parent widget.
SIZEX: The width of the displayed image.
SIZEY: The height of the displayed image.
NFRAMES: The number of frames in the animation sequence.
CW_ANIMATE_DUPS_INIT:
ANIMATEBASE: The ID of the base animation widget.
SIZEX: The width of the displayed image.
SIZEY: The height of the displayed image.
NFRAMES: The number of frames in the animation sequence.
CW_ANIMATE_DUPS_LOAD:
WIDGET: The ID of the widget (as created with CW_ANIMATE_DUPS)
into which the image should be loaded.
CW_ANIMATE_DUPS_RUN:
WIDGET: The ID of the widget (as created with CW_ANIMATE_DUPS)
into which the image should be loaded.
RATE: A value between 0 and 100 that represents the
speed of the animation as a percentage of the
maximum display rate. The fastest animation has
a value of 100 and the slowest has a value of 0.
The default animation rate is 100.
STOP: If this keyword is set, the animation is stopped.
NFRAMES: Specifies the number of frames to animate, must
<= the number specified in CW_ANIMATE_DUPS().
KEYWORD PARAMETERS:
CW_ANIMATE_DUPS:
PIXMAPS: This keyword provides the new widget with a vector
of pre-existing pixmap (off screen window) IDs.
This vector is usually obtained from a call to
CW_ANIMATE_DUPS_GETP applied to a previous animation
widget.
UVALUE: A user supplied value to be stored in the widget's
user value field.
UNAME: A user supplied string name to be stored in the
widget's user name field.
NO_KILL: If NOT set, an "End Animation" button is added to the
animation base. If set the button is not added.
OPEN_FUNC: A user supplied string that specifies a callback
function name. When a value is specified for this
keyword, an "Open..." pushbutton is added to the
window. When the "Open..." pushbutton is clicked
the OPEN_FUNC function is called to load new
animation data.
INFO_FILE: A filename containing text to be displayed by
XDISPLAYFILE when user selects the help button.
CW_ANIMATE_DUPS_INIT:
PIXMAPS: This keyword provides the new widget with a vector
of pre-existing pixmap (off screen window) IDs.
This vector is usually obtained from a call to
CW_ANIMATE_DUPS_GETP applied to a previous animation
widget.
CW_ANIMATE_DUPS_LOAD:
CYCLE: If set, cycle. Normally, frames are displayed
going either forward or backwards. If CYCLE is
set, reverse direction after the last frame in
either direction is displayed.
FRAME: The frame number to be loaded. This is a value
between 0 and NFRAMES. If not supplied, frame 0
is loaded.
IMAGE: The image to be loaded.
ORDER: Set this keyword to display images from the top
down instead of the default bottom up. This keyword
is only used when loading images with the IMAGE
keyword.
TRACK: If set, the frame slider tracks the current frame.
Default is not to track.
WINDOW: When this keyword is specified, an image is copied
from an existing window to the animation pixmap.
When using X windows, this technique is much faster
than reading from the display and then loading with
the IMAGE keyword.
The value of this parameter is either an IDL window
number (in which case the entire window is copied),
or a vector containing the window index and the
rectangular bounds of the area to be copied. For
example:
WINDOW = [Window_Number, X0, Y0, Sx, Sy]
XOFFSET: The horizontal offset, in pixels from the left of
the frame, of the image in the destination window.
YOFFSET: The vertical offset, in pixels from the bottom of
the frame, of the image in the destination window.
OUTPUTS:
No explicit outputs.
SIDE EFFECTS:
If the widget is realized before calls to CW_ANIMATE_DUPS_LOAD, the frames
are displayed as they are loaded. This provides the user with an
indication of how things are progressing.
When the widget is destroyed, it destroys the pixmaps used in the
animation, unless they were previously obtained via CW_ANIMATE_DUPS_GETP
and the KILL_ANYWAY keyword was not set.
The only event returned by this widget indicates that the user
has pressed the DONE button. The parent application should use
this as a signal to kill the animation widget via WIDGET_CONTROL.
RESTRICTIONS:
If more than one animation widget is running at a time, they
will fight for resources and run slower.
PROCEDURE:
When initialized, this procedure creates pixmaps containing the
frames of the animation sequence. Once the images are loaded,
they are displayed by copying the images from the pixmap or buffer
to the visible draw widget.
EXAMPLE:
Assume the following event handler procedure exists:
PRO EHANDLER, EV
WIDGET_CONTROL, /DESTROY, EV.TOP
end
Enter the following commands to open the file ABNORM.DAT (a series
of images of a human heart) and load the images it contains into
an array H:
OPENR, 1, FILEPATH('abnorm.dat', SUBDIR = 'images')
H = BYTARR(64, 64, 16)
READU, 1, H
CLOSE, 1
H = REBIN(H, 128, 128, 16)
Create an instance of the animation widget at load the frames:
base = widget_base()
animate = CW_ANIMATE_DUPS(base, 128, 128, 16)
WIDGET_CONTROL, /REALIZE, base
for i=0,15 do CW_ANIMATE_DUPS_LOAD, animate, FRAME=i, IMAGE=H[*,*,I]
Start the animation:
CW_ANIMATE_DUPS_RUN, animate
XMANAGER, "CW_ANIMATE_DUPS Demo", base, EVENT_HANDLER = "EHANDLER"
Pressing the DONE button kills the application.
MODIFICATION HISTORY:
AB, June 1992 Heavily based on the XINTERANIMATE procedure.
SR, September 1992 Fixed a problem when a paused animation's
frame selection was moved and the resulting
frame change ended up in another animation.
SR, November 1992 Fixed a problem when a single paused animation
would fail when the frame selection slider
event tried to set do a bad drawing window.
DMS/AB, March, 1993 Got rid of state caching. Got rid of
XMANAGER background tasks in favor of new
"WIDGET_CONTROL,timer=" feature.
ACY, October 1993 Set RETAIN=2 for draw widget to prevent
clipping by an overlapping window when
loading frames.
DMS, Dec, 1993 Added STOP and NFRAMES keywords to CW_ANIMATE_DUPS_RUN.
Added KILL_ANYWAY keyword to CW_ANIMATE_DUPS_GETP.
WSO, Jan, 1995 Added OPEN_FUNC keyword and updated UI.
ACY, Jan, 1997 Added INFO_FILE keyword to allow user-supplied
files for help text
JLP, Jan, 2000 Allow TrueColor images as input to CW_ANIMATE_DUPS_LOAD.
WMD, Jul, 2010 Add NDUPS field when writing MPEGS so playback can be slower.
WMD, Aug, 2010 Added button for writing QuickTime movies; "jmovie" script
needs to be known when spawned. At PPPL jmovie is aliased to
/p/nstxusr//util/scripts/javamoviemaker.csh which uses
/u/efeibush/w3_html/makemovie/jpegtomovie.jar
Source: src/idl_cvs/cw_bgroup3_6.pro
NAME:
CW_BGROUP3_6
PURPOSE:
CW_BGROUP3_6 is a compound widget that simplifies creating
a base of buttons. It handles the details of creating the
proper base (standard, exclusive, or non-exclusive) and filling
in the desired buttons. Events for the individual buttons are
handled transparently, and a CW_BGROUP3_6 event returned. This
event can return any one of the following:
- The Index of the button within the base.
- The widget ID of the button.
- The name of the button.
- An arbitrary value taken from an array of User values.
CATEGORY:
Compound widgets.
CALLING SEQUENCE:
Widget = CW_BGROUP3_6(Parent, Names)
To get or set the value of a CW_BGROUP3_6, use the GET_VALUE and
SET_VALUE keywords to WIDGET_CONTROL. The value of a CW_BGROUP3_6
is:
-----------------------------------------------
Type Value
-----------------------------------------------
normal None
exclusive Index of currently set button
non-exclusive Vector indicating the position
of each button (1-set, 0-unset)
----------------------------------------------- INPUTS:
Parent: The ID of the parent widget.
Names: A string array, containing one string per button,
giving the name of each button.
KEYWORD PARAMETERS:
BUTTON_UVALUE: An array of user values to be associated with
each button and returned in the event structure.
COLUMN: Buttons will be arranged in the number of columns
specified by this keyword.
EVENT_FUNCT: The name of an optional user-supplied event function
for buttons. This function is called with the return
value structure whenever a button is pressed, and
follows the conventions for user-written event
functions.
EXCLUSIVE: Buttons will be placed in an exclusive base, with
only one button allowed to be selected at a time.
FONT: The name of the font to be used for the button
titles. If this keyword is not specified, the default
font is used.
FRAME: Specifies the width of the frame to be drawn around
the base.
IDS: A named variable into which the button IDs will be
stored, as a longword vector.
LABEL_LEFT: Creates a text label to the left of the buttons.
LABEL_TOP: Creates a text label above the buttons.
MAP: If set, the base will be mapped when the widget
is realized (the default).
NONEXCLUSIVE: Buttons will be placed in an non-exclusive base.
The buttons will be independent.
NO_RELEASE: If set, button release events will not be returned.
RETURN_ID: If set, the VALUE field of returned events will be
the widget ID of the button.
RETURN_INDEX: If set, the VALUE field of returned events will be
the zero-based index of the button within the base.
THIS IS THE DEFAULT.
RETURN_NAME: If set, the VALUE field of returned events will be
the name of the button within the base.
ROW: Buttons will be arranged in the number of rows
specified by this keyword.
SCROLL: If set, the base will include scroll bars to allow
viewing a large base through a smaller viewport.
SET_VALUE: The initial value of the buttons. This is equivalent
to the later statement:
WIDGET_CONTROL, widget, set_value=value
SPACE: The space, in pixels, to be left around the edges
of a row or column major base. This keyword is
ignored if EXCLUSIVE or NONEXCLUSIVE are specified.
UVALUE: The user value to be associated with the widget.
XOFFSET: The X offset of the widget relative to its parent.
XPAD: The horizontal space, in pixels, between children
of a row or column major base. Ignored if EXCLUSIVE
or NONEXCLUSIVE are specified.
XSIZE: The width of the base.
X_SCROLL_SIZE: The width of the viewport if SCROLL is specified.
YOFFSET: The Y offset of the widget relative to its parent.
YPAD: The vertical space, in pixels, between children of
a row or column major base. Ignored if EXCLUSIVE
or NONEXCLUSIVE are specified.
YSIZE: The height of the base.
Y_SCROLL_SIZE: The height of the viewport if SCROLL is specified.
OUTPUTS:
The ID of the created widget is returned.
SIDE EFFECTS:
This widget generates event structures with the following definition:
event = { ID:0L, TOP:0L, HANDLER:0L, SELECT:0, VALUE:0 }
The SELECT field is passed through from the button event. VALUE is
either the INDEX, ID, NAME, or BUTTON_UVALUE of the button,
depending on how the widget was created.
RESTRICTIONS:
Only buttons with textual names are handled by this widget.
Bitmaps are not understood.
MODIFICATION HISTORY:
15 June 1992, AB
7 April 1993, AB, Removed state caching.
Source: src/idl_cvs/cw_field.pro
NAME:
CW_FIELD
PURPOSE:
This widget cluster function manages a data entry field widget.
The field consists of a label and a text widget. CW_FIELD's can
be string fields, integer fields or floating-point fields. The
default is an editable string field.
CATEGORY:
Widgets
CALLING SEQUENCE:
Result = CW_FIELD(Parent)
INPUTS:
Parent: The widget ID of the widget to be the field's parent.
KEYWORD PARAMETERS:
TITLE: A string containing the text to be used as the label for the
field. The default is "Input Field:".
VALUE: The initial value in the text widget. This value is
automatically converted to the type set by the STRING,
INTEGER, and FLOATING keywords described below.
UVALUE: A user value to assign to the field cluster. This value
can be of any type.
UNAME: A user supplied string name to be stored in the
widget's user name field.
FRAME: The width, in pixels, of a frame to be drawn around the
entire field cluster. The default is no frame.
RETURN_EVENTS: Set this keyword to make cluster return an event when a
is pressed in a text field. The default is
not to return events. Note that the value of the text field
is always returned when the WIDGET_CONTROL, field, GET_VALUE=X
command is used.
ALL_EVENTS: Like RETURN_EVENTS but return an event whenever the
contents of a text field have changed.
COLUMN: Set this keyword to center the label above the text field.
The default is to position the label to the left of the text
field.
ROW: Set this keyword to position the label to the left of the text
field. This is the default.
XSIZE: An explicit horizontal size (in characters) for the text input
area. The default is to let the window manager size the
widget. Using the XSIZE keyword is not recommended.
YSIZE: An explicit vertical size (in lines) for the text input
area. The default is 1.
STRING: Set this keyword to have the field accept only string values.
Numbers entered in the field are converted to their string
equivalents. This is the default.
FLOATING: Set this keyword to have the field accept only floating-point
values. Any number or string entered is converted to its
floating-point equivalent.
INTEGER: Set this keyword to have the field accept only integer values.
Any number or string entered is converted to its integer
equivalent (using FIX). For example, if 12.5 is entered in
this type of field, it is converted to 12.
LONG: Set this keyword to have the field accept only long integer
values. Any number or string entered is converted to its
long integer equivalent (using LONG).
FONT: A string containing the name of the X Windows font to use
for the TITLE of the field.
FIELDFONT: A string containing the name of the X Windows font to use
for the TEXT part of the field.
NOEDIT: Normally, the value in the text field can be edited. Set this
keyword to make the field non-editable.
OUTPUTS:
This function returns the widget ID of the newly-created cluster.
COMMON BLOCKS:
None.
PROCEDURE:
Create the widgets, set up the appropriate event handlers, and return
the widget ID of the newly-created cluster.
EXAMPLE:
The code below creates a main base with a field cluster attached
to it. The cluster accepts string input, has the title "Name:", and
has a frame around it:
base = WIDGET_BASE()
field = CW_FIELD(base, TITLE="Name:", /FRAME)
WIDGET_CONTROL, base, /REALIZE
MODIFICATION HISTORY:
01-Jun-2006 added double keyword [BD]
11-Mar-2004 Added ALIGN_CENTER & ALIGN_RIGHT [BD]
July 2001 CT, RSI, Fix bug in previous mod. If user passes in a
numeric VALUE but forgets to set the /FLOAT, we still need
to convert to a string before passing onto WIDGET_TEXT.
March 2001: CT, RSI, Pass keywords directly into WIDGET_BASE,
without assigning default values, since the defaults are
handled by WIDGET_BASE. Avoids assigning defaults if user passes
in undefined variables.
Written by: Keith R. Crosley June 1992
KRC, January 1993 -- Added support for LONG
integers.
AB, 7 April 1993, Removed state caching.
JWG, August 1993, Completely rewritten to make
use of improved TEXT widget functionality
ACY, 25 March, 1994, fix usage of FRAME keyword
KDB, May 1994, Initial value =0 would result
in a null text field. Fixed
keyword check.
Source: src/idl_cvs/cw_field_bd.pro
NAME:
CW_FIELD_BD
PURPOSE:
This widget cluster function manages a data entry field widget.
The field consists of a label and a text widget. CW_FIELD's can
be string fields, integer fields or floating-point fields. The
default is an editable string field.
CATEGORY:
Widgets
CALLING SEQUENCE:
Result = CW_FIELD_BD(Parent)
INPUTS:
Parent: The widget ID of the widget to be the field's parent.
KEYWORD PARAMETERS:
TITLE: A string containing the text to be used as the label for the
field. The default is "Input Field:".
VALUE: The initial value in the text widget. This value is
automatically converted to the type set by the STRING,
INTEGER, and FLOATING keywords described below.
UVALUE: A user value to assign to the field cluster. This value
can be of any type.
UNAME: A user supplied string name to be stored in the
widget's user name field.
FRAME: The width, in pixels, of a frame to be drawn around the
entire field cluster. The default is no frame.
RETURN_EVENTS: Set this keyword to make cluster return an event when a
is pressed in a text field. The default is
not to return events. Note that the value of the text field
is always returned when the WIDGET_CONTROL, field, GET_VALUE=X
command is used.
ALL_EVENTS: Like RETURN_EVENTS but return an event whenever the
contents of a text field have changed.
COLUMN: Set this keyword to center the label above the text field.
The default is to position the label to the left of the text
field.
ROW: Set this keyword to position the label to the left of the text
field. This is the default.
XSIZE: An explicit horizontal size (in characters) for the text input
area. The default is to let the window manager size the
widget. Using the XSIZE keyword is not recommended.
YSIZE: An explicit vertical size (in lines) for the text input
area. The default is 1.
STRING: Set this keyword to have the field accept only string values.
Numbers entered in the field are converted to their string
equivalents. This is the default.
FLOATING: Set this keyword to have the field accept only floating-point
values. Any number or string entered is converted to its
floating-point equivalent.
INTEGER: Set this keyword to have the field accept only integer values.
Any number or string entered is converted to its integer
equivalent (using FIX). For example, if 12.5 is entered in
this type of field, it is converted to 12.
LONG: Set this keyword to have the field accept only long integer
values. Any number or string entered is converted to its
long integer equivalent (using LONG).
FONT: A string containing the name of the X Windows font to use
for the TITLE of the field.
FIELDFONT: A string containing the name of the X Windows font to use
for the TEXT part of the field.
NOEDIT: Normally, the value in the text field can be edited. Set this
keyword to make the field non-editable.
OUTPUTS:
This function returns the widget ID of the newly-created cluster.
COMMON BLOCKS:
None.
PROCEDURE:
Create the widgets, set up the appropriate event handlers, and return
the widget ID of the newly-created cluster.
EXAMPLE:
The code below creates a main base with a field cluster attached
to it. The cluster accepts string input, has the title "Name:", and
has a frame around it:
base = WIDGET_BASE()
field = CW_FIELD(base, TITLE="Name:", /FRAME)
WIDGET_CONTROL, base, /REALIZE
MODIFICATION HISTORY:
01-Jun-2006 added double keyword [BD]
11-Mar-2004 Added ALIGN_CENTER & ALIGN_RIGHT [BD]
July 2001 CT, RSI, Fix bug in previous mod. If user passes in a
numeric VALUE but forgets to set the /FLOAT, we still need
to convert to a string before passing onto WIDGET_TEXT.
March 2001: CT, RSI, Pass keywords directly into WIDGET_BASE,
without assigning default values, since the defaults are
handled by WIDGET_BASE. Avoids assigning defaults if user passes
in undefined variables.
Written by: Keith R. Crosley June 1992
KRC, January 1993 -- Added support for LONG
integers.
AB, 7 April 1993, Removed state caching.
JWG, August 1993, Completely rewritten to make
use of improved TEXT widget functionality
ACY, 25 March, 1994, fix usage of FRAME keyword
KDB, May 1994, Initial value =0 would result
in a null text field. Fixed
keyword check.
Source: src/idl_cvs/cw_pdlist.pro
NAME:
CW_PDList
PURPOSE:
A compound widget that simplifies creating
pulldown menus. It has a simpler interface than the XPDMENU
procedure, which it is intended to replace. Events for the
individual buttons are handled transparently, and a CW_PDList
event returned. This event can return any one of the following:
- The Index of the button within the base.
- The widget ID of the button.
- The name of the button.
- The fully qualified name of the button. This allows
different sub-menus to contain buttons with the same
name in an unambiguous way. CATEGORY:
Compound widgets.
CALLING SEQUENCE:
widget = CW_PDList(Parent, Desc)
INPUTS:
Parent: The ID of the parent widget.
Desc: An array of strings or structures. Each element contains
a menu description with two fields, a flag field, and
the name of the item. If a structure, each element
is defined as follows:
{ CW_PDList_S, flags:0, name:'' }
The name tag gives the name of button. The flags
field is a two-bit bitmask that controls how the button is
interpreted:
Value Meaning
-------------------------------------------
0 This button is neither the beginning
nor the end of a pulldown level.
1 This button is the root of a
sub-pulldown menu. The sub-buttons
start with the next button.
2 This button is the last button at the
current pulldown level. The next button
belongs to the same level as the current
parent button.
If none or empty string is specified as a
the name, the button is not created, but
the next button belongs to the upward level.
3 This button is the root of a sub-pulldown
menu, but it is also the last entry of
the current level.
4 Same as 0, above, except that this button will
be preceeded by a separator as with the SEPARATOR
keyword to WIDGET_BUTTON.
5 Same as 1, above, except that this button will
be preceeded by a separator.
6 Same as 2, above, except that this button will
be preceeded by a separator.
7 Same as 3, above, except that this button will
be preceeded by a separator.
If Desc is a string, each element contains the flag field
followed by a backslash character, followed by the menu item's
contents. See the example below.
EVENT PROCEDURES: An event procedure may be specified for an
element and all its children, by including a third field
in Desc, if Desc is a string array. Events for buttons without
an event procedure, are dispatched normally.
See the example below.
KEYWORD PARAMETERS:
DELIMITER: The character used to separate the parts of a
fully qualified name in returned events. The
default is to use the '.' character.
FONT: The name of the font to be used for the button
titles. If this keyword is not specified, the
default font is used.
HELP: If MBAR is specified and one of the buttons on the
menubar has the label "help" (case insensitive) then
that button is created with the /HELP keyword to
give it any special appearance it is supposed to
have on a menubar. For example, Motif expects
help buttons to be on the right.
IDS: A named variable into which the button IDs will
be stored as a longword vector.
MBAR: if constructing a menu-bar pulldown, set this
keyword. In this case, the parent must be the
widget id of the menu bar of a top-level base,
returned by WIDGET_BASE(..., MBAR=mbar).
RETURN_ID: If present and non-zero, the VALUE field of returned
events will be the widget ID of the button.
RETURN_INDEX: If present and non-zero, the VALUE field of returned
events will be the zero-based index of the button
within the base. THIS IS THE DEFAULT.
RETURN_NAME: If present and non-zero, the VALUE field of returned
events will be the name of the selected button.
RETURN_FULL_NAME: If present and non-zero, the VALUE field of returned
events will be the fully qualified name of the
selected button. This means that the names of all
the buttons from the topmost button of the pulldown
menu to the selected one are concatenated with the
delimiter specified by the DELIMITER keyword. For
example, if the top button was named COLORS, the
second level button was named BLUE, and the selected
button was named LIGHT, the returned value would be
COLORS.BLUE.LIGHT
This allows different submenus to have buttons with
the same name (e.g. COLORS.RED.LIGHT).
UVALUE: The user value to be associated with the widget.
UNAME: The user name to be associated with the widget.
XOFFSET: The X offset of the widget relative to its parent.
YOFFSET: The Y offset of the widget relative to its parent.
OUTPUTS:
The ID of the top level button is returned.
SIDE EFFECTS:
This widget generates event structures with the following definition:
event = { ID:0L, TOP:0L, HANDLER:0L, VALUE:0 }
VALUE is either the INDEX, ID, NAME, or FULL_NAME of the button,
depending on how the widget was created.
RESTRICTIONS:
Only buttons with textual names are handled by this widget.
Bitmaps are not understood.
EXAMPLE:
The following is the description of a menu bar with two buttons,
"Colors" and "Quit". Colors is a pulldown containing the colors
"Red", "Green", Blue", "Cyan", and "Magenta". Blue is a sub-pulldown
containing "Light", "Medium", "Dark", "Navy", and "Royal":
; Make sure CW_PDList_S is defined
junk = { CW_PDList_S, flags:0, name:'' }
; The description
desc = [ { CW_PDList_S, 1, 'Colors' }, $
{ CW_PDList_S, 0, 'Red' }, $
{ CW_PDList_S, 0, 'Green' }, $
{ CW_PDList_S, 5, 'Blue\BLUE_EVENT_PROC' }, $
{ CW_PDList_S, 0, 'Light' }, $
{ CW_PDList_S, 0, 'Medium' }, $
{ CW_PDList_S, 0, 'Dark' }, $
{ CW_PDList_S, 0, 'Navy' }, $
{ CW_PDList_S, 2, 'Royal' }, $
{ CW_PDList_S, 4, 'Cyan' }, $
{ CW_PDList_S, 2, 'Magenta\MAGENTA_EVENT_PROC' }, $
{ CW_PDList_S, 2, 'Quit' } ]
The same menu may be defined as a string by equating the Desc parameter
to the following string array:
desc =[ '1\Colors' , $
'0\Red' , $
'0\Green' , $
'5\Blue\BLUE_EVENT_PROC' , $
'0\Light' , $
'0\Medium' , $
'0\Dark' , $
'0\Navy' , $
'2\Royal' , $
'4\Cyan' , $
'2\Magenta\MAGENTA_EVENT_PROC' , $
'2\Quit' ] The following small program can be used with the above description
to create the specified menu: base = widget_base()
menu = CW_PDList(base, desc, /RETURN_FULL_NAME)
WIDGET_CONTROL, /REALIZE, base
repeat begin
ev = WIDGET_EVENT(base)
print, ev.value
end until ev.value eq 'Quit'
WIDGET_CONTROL, /DESTROY, base
end
Note that independent event procedures were specified for
the multiple Blue buttons (blue_event_proc), and the Magenta button
(magenta_event_proc).
MODIFICATION HISTORY:
18 June 1992, AB
16 Jan 1995, DMS, Added MBAR keyword, event procedures,
and menu descriptor strings.
2 July 1995, AB, Added HELP keyword.
3 September 1996, LP, Added button-less end of current level
Apirl, 2003 copied from CW_PDMENU. added xsize & event_pro keywords.
setting showSelection keyword will cause the menu
selection to be displayed as the title of the button [BD]
Source: src/idl_cvs/cw_pdmenu.pro
NAME:
CW_PDMENU
PURPOSE:
CW_PDMENU is a compound widget that simplifies creating
pulldown menus. It has a simpler interface than the XPDMENU
procedure, which it is intended to replace. Events for the
individual buttons are handled transparently, and a CW_PDMENU
event returned. This event can return any one of the following:
- The Index of the button within the base.
- The widget ID of the button.
- The name of the button.
- The fully qualified name of the button. This allows
different sub-menus to contain buttons with the same
name in an unambiguous way. CATEGORY:
Compound widgets.
CALLING SEQUENCE:
widget = CW_PDMENU(Parent, Desc)
INPUTS:
Parent: The ID of the parent widget.
Desc: An array of strings or structures. Each element contains
a menu description with two fields, a flag field, and
the name of the item. If a structure, each element
is defined as follows:
{ CW_PDMENU_S, flags:0, name:'' }
The name tag gives the name of button. The flags
field is a two-bit bitmask that controls how the button is
interpreted:
Value Meaning
-------------------------------------------
0 This button is neither the beginning
nor the end of a pulldown level.
1 This button is the root of a
sub-pulldown menu. The sub-buttons
start with the next button.
2 This button is the last button at the
current pulldown level. The next button
belongs to the same level as the current
parent button.
If none or empty string is specified as a
the name, the button is not created, but
the next button belongs to the upward level.
3 This button is the root of a sub-pulldown
menu, but it is also the last entry of
the current level.
4 Same as 0, above, except that this button will
be preceeded by a separator as with the SEPARATOR
keyword to WIDGET_BUTTON.
5 Same as 1, above, except that this button will
be preceeded by a separator.
6 Same as 2, above, except that this button will
be preceeded by a separator.
7 Same as 3, above, except that this button will
be preceeded by a separator.
If Desc is a string, each element contains the flag field
followed by a backslash character, followed by the menu item's
contents. See the example below.
EVENT PROCEDURES: An event procedure may be specified for an
element and all its children, by including a third field
in Desc, if Desc is a string array. Events for buttons without
an event procedure, are dispatched normally.
See the example below.
KEYWORD PARAMETERS:
DELIMITER: The character used to separate the parts of a
fully qualified name in returned events. The
default is to use the '.' character.
FONT: The name of the font to be used for the button
titles. If this keyword is not specified, the
default font is used.
HELP: If MBAR is specified and one of the buttons on the
menubar has the label "help" (case insensitive) then
that button is created with the /HELP keyword to
give it any special appearance it is supposed to
have on a menubar. For example, Motif expects
help buttons to be on the right.
IDS: A named variable into which the button IDs will
be stored as a longword vector.
MBAR: if constructing a menu-bar pulldown, set this
keyword. In this case, the parent must be the
widget id of the menu bar of a top-level base,
returned by WIDGET_BASE(..., MBAR=mbar).
RETURN_ID: If present and non-zero, the VALUE field of returned
events will be the widget ID of the button.
RETURN_INDEX: If present and non-zero, the VALUE field of returned
events will be the zero-based index of the button
within the base. THIS IS THE DEFAULT.
RETURN_NAME: If present and non-zero, the VALUE field of returned
events will be the name of the selected button.
RETURN_FULL_NAME: If present and non-zero, the VALUE field of returned
events will be the fully qualified name of the
selected button. This means that the names of all
the buttons from the topmost button of the pulldown
menu to the selected one are concatenated with the
delimiter specified by the DELIMITER keyword. For
example, if the top button was named COLORS, the
second level button was named BLUE, and the selected
button was named LIGHT, the returned value would be
COLORS.BLUE.LIGHT
This allows different submenus to have buttons with
the same name (e.g. COLORS.RED.LIGHT).
UVALUE: The user value to be associated with the widget.
UNAME: The user name to be associated with the widget.
XOFFSET: The X offset of the widget relative to its parent.
YOFFSET: The Y offset of the widget relative to its parent.
OUTPUTS:
The ID of the top level button is returned.
SIDE EFFECTS:
This widget generates event structures with the following definition:
event = { ID:0L, TOP:0L, HANDLER:0L, VALUE:0 }
VALUE is either the INDEX, ID, NAME, or FULL_NAME of the button,
depending on how the widget was created.
RESTRICTIONS:
Only buttons with textual names are handled by this widget.
Bitmaps are not understood.
EXAMPLE:
The following is the description of a menu bar with two buttons,
"Colors" and "Quit". Colors is a pulldown containing the colors
"Red", "Green", Blue", "Cyan", and "Magenta". Blue is a sub-pulldown
containing "Light", "Medium", "Dark", "Navy", and "Royal":
; Make sure CW_PDMENU_S is defined
junk = { CW_PDMENU_S, flags:0, name:'' }
; The description
desc = [ { CW_PDMENU_S, 1, 'Colors' }, $
{ CW_PDMENU_S, 0, 'Red' }, $
{ CW_PDMENU_S, 0, 'Green' }, $
{ CW_PDMENU_S, 5, 'Blue\BLUE_EVENT_PROC' }, $
{ CW_PDMENU_S, 0, 'Light' }, $
{ CW_PDMENU_S, 0, 'Medium' }, $
{ CW_PDMENU_S, 0, 'Dark' }, $
{ CW_PDMENU_S, 0, 'Navy' }, $
{ CW_PDMENU_S, 2, 'Royal' }, $
{ CW_PDMENU_S, 4, 'Cyan' }, $
{ CW_PDMENU_S, 2, 'Magenta\MAGENTA_EVENT_PROC' }, $
{ CW_PDMENU_S, 2, 'Quit' } ]
The same menu may be defined as a string by equating the Desc parameter
to the following string array:
desc =[ '1\Colors' , $
'0\Red' , $
'0\Green' , $
'5\Blue\BLUE_EVENT_PROC' , $
'0\Light' , $
'0\Medium' , $
'0\Dark' , $
'0\Navy' , $
'2\Royal' , $
'4\Cyan' , $
'2\Magenta\MAGENTA_EVENT_PROC' , $
'2\Quit' ] The following small program can be used with the above description
to create the specified menu: base = widget_base()
menu = cw_pdmenu(base, desc, /RETURN_FULL_NAME)
WIDGET_CONTROL, /REALIZE, base
repeat begin
ev = WIDGET_EVENT(base)
print, ev.value
end until ev.value eq 'Quit'
WIDGET_CONTROL, /DESTROY, base
end
Note that independent event procedures were specified for
the multiple Blue buttons (blue_event_proc), and the Magenta button
(magenta_event_proc).
MODIFICATION HISTORY:
18 June 1992, AB
16 Jan 1995, DMS, Added MBAR keyword, event procedures,
and menu descriptor strings.
2 July 1995, AB, Added HELP keyword.
3 September 1996, LP, Added button-less end of current level
Apirl, 2003 added xsize & event_pro keywords. [BD]
July, 2003 removed setting ids in structure in UVALUE