Source: src/idl_cvs/ndecimals.pro
NAME:
ndecimals
PURPOSE:
returns the number of non-zero digits after decimal point.
ignores insigificant bits (in principle)
CATEGORY:
Math, Graphics
CALLING SEQUENCE:
n = ndecimals( num )
INPUTS:
num - a number
KEYWORD PARAMETERS:
Optional Inputs:
nSignificantDigits - max number of decimals to consider
(defaults to 3 decimals)
EXAMPLE:
IDL> print, ndecimals(1.40001)
1
IDL> print, ndecimals(1.123001,nsig=2)
2
IDL> print, ndecimals(1.123001 )
3
IDL> print, ndecimals('36.123456')
6
HISTORY:
21-Sep-2012 fixed bug for 1.434001 & '36.123456'
03-Mar-2011 Written [BD]
Source: src/idl_cvs/nearesti.pro
NAME:
NEARESTI
PURPOSE:
Return index of input array closest to the value of "pt"
CATEGORY:
Search
CALLING SEQUENCE:
i=NEARESTI(array,pt)
INPUTS:
array - an array of numbers
pt - a number
OUTPUTS:
iclosest - the index of the array value closet to "pt"
COMMON BLOCKS:
NOTES:
limited by precision. e.g.,
IDL> print, nearesti([2,3], 2.5000001)
0
MODIFICATION HISTORY:
16-Jul-02 WMD Handle really big "pt"
03-Dec-99 WMD make input a scalar, if necessary
17-Jul-97 WMD more like Harris Library version - faster
29-Mar-88 WMD Written
Source: src/idl_cvs/nearesti_array.pro
NAME:
NEARESTI_ARRAY
PURPOSE:
Return indices of big input array closest to the values
in the little input array.
CATEGORY:
Search, Arrays
CALLING SEQUENCE:
i=NEARESTI_ARRAY(bigArray,littleArray)
INPUTS:
bigArray - an array of numbers to look in
littleArray - an array to look for matches in bigArray
OUTPUTS:
ret_indices - the indices of bigarray closest to values of littleArray
COMMON BLOCKS:
NOTES:
MODIFICATION HISTORY:
09-Oct-2009 make loop index a LONG
17-Jul-97 WMD Written
Source: src/idl_cvs/nextgoodshot.pro
NAME:
nextGoodShot
PURPOSE:
find the next shot that has more than a certain Ip.
CATEGORY:
MDSplus, Shot Number
CALLING SEQUENCE:
nextShot = nextGoodShot( StartShot )
INPUTS:
StartShot - shot number to start from in
KEYWORD PARAMETERS:
Inputs:
goodValue - value required for tag for next good shot (default=30000 Amps)
Backwards - look backwards for good shots
MaxShots - Maximum number of shots to search over
(default=1000 or end). IF MAXSHOTS=1 JUST PROCESS SHOT1
Server - MDS server (default is NSTX)
TagToUse - Tag to use for IP check (default to \OPERATIONS::CAL_IROGEVVUL1)
Verbose - if set, print debugging information
OUTPUTS:
nextShot - next Shot number, based on criterion
IF no good shot meeting criterion is found, -1 is returned
EXAMPLE:
IDL> ishot = NextGoodshot( laopenStathot, goodValue = 100. )
COMMON BLOCKS:
NOTES:
this routine just works for NSTX and DIII-D (uses gadat at GA).
RESTRICTIONS:
LASTSHOT() may sometimes return a small number during test periods
MODIFICATION HISTORY:
02-Nov-2009 better debug statements
10-Mar-06 Default to \WF::IP. Check for different tree for backup tag.
15-Aug-05 add LastIpTime keyword [BD].
28-Sep-01 Return status. Assume values read are in Amps.
Use \ENGINEERING::IP2 as a backup value
28-Nov-00 Changed Ip to look for \ENGINEERING::PPCC_IP1
20-Sep-99 Add MaxShots keyword
18-Sep-99 Keep going after 1 missing shot, but stop after 5
16-Sep-99 Added TagToUse keyword & medsmooth to remove spikes [BD]
Written by Bill Davis March, 1999
Source: src/idl_cvs/nicenumber.pro
NAME:
NICENUMBER
PURPOSE:
Find a "nice" number close to the given number. Actually, this
is for older digitizers, so "rounds" to numbers like
1, 2, 2.5, 5, etc.
CATEGORY:
Math
CALLING SEQUENCE:
n = nicenumber(x)
INPUTS:
x = given number. in
KEYWORD PARAMETERS:
Keywords:
/FLOOR finds next nice number le to X.
/CEIL finds the next nice number ge to X.
MINOR=m Returned suggested minor tick spacing.
OUTPUTS:
n = nice number close to x. out
1, 2, 2.5, or 5 scaled to size of x.
COMMON BLOCKS:
NOTES:
Notes:
Default operation is useful for finding tick spacings:
dx = nicenumber((xmx-xmn)/nticks).
/FLOOR and /CEIL are useful for scaling data plots:
xmn = nicenumber(min(x),/floor)
xmx = nicenumber(max(x),/ceil)
plot, x, y, xrange=[xmn,xmx], . . .
/floor and /ceil may not give values related to the
step size, dx. The following method will:
ceil(t/dx)*dx is a multiple of dx on the high side of t.
floor(t/dx)*dx is a multiple of dx on the low side of t.
Use DT_NICENUMBER.PRO to "round" to a specific number of digits.
MODIFICATION HISTORY:
20-Apr-2011 fix for array starting with zero, like;
[ 0.0, 5.0e+15, 1.0e+16 ]
17-Feb-00 handle 190KHz ! (Bill Davis)
R. Sterner, 6 Feb, 1990
R. Sterner, 27 Jan, 1993 --- dropped reference to array.
R. Sterner, 12 Feb, 1993 --- returned 1 element array as a scalar.
Copyright (C) 1990, 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/nnet.pro
NAME:
NNET.PRO
PURPOSE:
Neural network classifier. This is a standard 3-layer
back-propagation net.
CALLING SEQUENCE:
NNET, bias_hid, w_hid, bias_out, w_out, input, h_output, $
output, first, second, third
INPUTS:
bias_hid - Bias weights on the hidden neurons (DP vector [n_hid]).
w_hid - weights between input & hidden layers (DP array [n_in,n_hid]).
bias_out - Bias weights on the output neurons (DP vector [n_out]).
w_out - weights between hidden & output layers (DP array [n_hid,n_out]).
input - input values (DP vector [n_in]).
OUTPUTS:
h_output - computed values of hidden layer neurons (DP vector [n_hid]).
output - computed values of output neurons (DP vector [n_out]).
first - index of output neuron with highest value.
second - index of second place neuron.
third - index of third place neuron (if there are more than two output
neurons).
KEYWORD PARAMETERS
None.
EXAMPLE:
IDL> nnet, bias_hid, w_hid, bias_out, w_out, input, hout, output
- input is the pattern you want to classify. Must be a normalized
float or DP vector or the same size as the training patterns used
to train the weights.
HISTORY:
Version 1.0 T. Beck
Advanced Computer Concepts, Inc. 21 Apr 1999
Source: src/idl_cvs/nodename.pro
NAME:
nodename
PURPOSE:
Return nodename on Linux computer
CATEGORY:
Utility, OS-specific
CALLING SEQUENCE:
IDL> node = nodename(parts=parts, domain=domain)
INPUTS:
none
KEYWORD PARAMETERS:
parts - parts of name between periods
domain - everything after first '.'
OUTPUTS:
nodename, e.g. sunfire16.pppl.gov
COMMON BLOCKS:
nodename_local
EXAMPLE:
IDL> opt = nodename( /HLP )
LIMITATIONS:
Just tested on Redhat Linux
NOTES:
since spawn operation is slow, save node name in common for
subsequent calls.
MODIFICATION HISTORY:
26-Sep-2007 Written by Bill Davis, PPPL
Source: src/idl_cvs/nodesearch.pro
NAME:
nodesearch
PURPOSE:
Search MDS Plus Trees for a node
CATEGORY:
Utility
CALLING SEQUENCE:
IDL> result=nodesearch(searchnode, path=path])
INPUTS:
searchnode and optional variable to return an array of full paths containing
node name
KEYWORD PARAMETERS:
fullpath
OUTPUTS:
status of function
COMMON BLOCKS:
none
EXAMPLE:
IDL> result=nodesearch('xray', fullpath=path)
NOTES:
tree must be open before nodesearch can be called
will return 0 if node is found and -1 if it is not found in the current tree
MODIFICATION HISTORY:
01-Dec-00 Added capability for wildcards in search string
7-Feb-00 Written by Dana Mastrovito, PPPL
Source: src/idl_cvs/nonalphanum.pro
NAME: nonAlphaNum
PURPOSE: find position of first character which are not alphanumeric
(0-9, a-z, A-Z & _)
if none found, returns strlen(input)
CATEGORY:
Strings, Character Search
CALLING SEQUENCE:
pos = nonAlphaNum( mdsSigName )
MODIFICATION HISTORY:
2001 Written by Bill Davis
Source: src/idl_cvs/nonnumber.pro
NAME: nonNumber
PURPOSE: find position of first character which is not a number
(0-9). if none found, returns -1.
CATEGORY:
Strings, Character Search
CALLING SEQUENCE:
pos = nonNumber( mdsSigName )
EAMPLE:
IDL> a='user/core.3889'
IDL> print,nonnumber(a,/reverse)
9
IDL> print,strmid(a,0,nonnumber(a,/reverse)+1)
user/core.
MODIFICATION HISTORY:
01-Nov-2004 Written by Bill Davis
Source: src/idl_cvs/nonvarpos.pro
NAME:
nonVarPos
PURPOSE:
find position of characters which are not valid for MDSplus names
CATEGORY:
MDSplus, Character Search, Strings
CALLING SEQUENCE:
posArray = nonVarPos( inStr )
RETURNED:
posArray = array of positions of characters which are not
valid characters for an MDSplus tag name
-1 if none found
KEYWORDS:
(OPTIONAL)
GOOD - if set, will retrun positions of good characters
noNum - if set, don't count numbers as good characters
MODIFICATION HISTORY:
01-May-01 - Added keywords
2001 Written by Bill Davis
Source: src/idl_cvs/nsearch.pro
NAME:
nsearch
PURPOSE:
Search MDS Plus Trees for a node
CATEGORY:
MDSplus
CALLING SEQUENCE:
IDL> result=nsearch(searchnode[, fullpath=path])
INPUTS:
searchnode and optional variable to return an array of full paths
containing node name
KEYWORD PARAMETERS:
fullpath - full path of node found
OUTPUTS:
status of function (-1 if not found, 0 if found)
COMMON BLOCKS:
none
EXAMPLE:
IDL> result=nsearch('xray', fullpath=path)
NOTES:
tree must be open before nsearch can be called.
will return 0 if node is found and -1 if it is not found in the current
tree.
MODIFICATION HISTORY:
12-Feb-00 strip tree info, if in node name [BD]
7-Feb-00 Written by Dana Mastrovito, PPPL
Source: src/idl_cvs/nstxcorner.pro
NAME:
nstxcorner
PURPOSE:
write NSTX in upper left-hand corner of a plot
CATEGORY:
NSTX, Plotting
CALLING SEQUENCE:
IDL> nstxcorner
MODIFICATION HISTORY:
21-Aug-00 Written by Bill Davis, PPPL
Source: src/idl_cvs/nstxlogo.pro
NAME:
nstxlogo
PURPOSE:
draw NSTX logo in upper left-hand corner of a plot
CATEGORY:
NSTX, Plotting
CALLING SEQUENCE:
IDL> nstxlogo
KEYWORD PARAMETERS:
Optional Keywords:
CHARSIZE -Character size of NSTX characters (def=1.5)
XLOC - X location of middle of logo, in normal coordinates
YLOC - Y location of middle of logo, in normal coordinates
iBar - if set, draw center stack as an "I" rather than ")("
right -if set, drawn on the right
blue - if set, color table value for NSTX text
red - if set, color table value for bars and circles
bottom - if set, drawn on the bottom
EXAMPLE:
IDL> !y.omargin=[0,1.5]
IDL> plot,indgen(11)
IDL> nstxlogo
LIMITATONS:
This was designed to work with the default IDL font (-1).
NOTES:
You will probably want to leave extra room at the top of your plot, e.g.
IDL> !y.omargin=[0,1.5]
MODIFICATION HISTORY:
18-Dec-2009 Added Center keyword
25-Feb-03 Made circles same font as others
14-May-01 Changed the look - no X.
01-Nov-00 Cleaned up location. Default size to 1.5
21-Aug-00 Written by Bill Davis, PPPL
Source: src/idl_cvs/nstxlogs_get.pro
NAME:
nstxlogs_get
PURPOSE:
Get info on NSTX shots from the ENTRIES table in the NSTXLOGS database
CATEGORY:
NSTX, Database
CALLING SEQUENCE:
IDL> info = nstxlogs_get(shot=shot, rundate=rundate, username=username, $
xp=xp )
INPUTS:
(none required)
KEYWORD PARAMETERS:
(all optional)
rundate - run date (YYYYMMDD), e.g., 20010802
shot - e.g., 105535
text - text that is contained in the entry
topic - per Logbook, e.g., "SESSION LEADER", "PHYS OPS", "CHI", "EFIT", "IMPURITIES"
'MAGNETCIS" ETC.
username - person, e.g. 'KAYE'
xp - Experimental proposal number, e.g., 917
(see http://nstx.pppl.gov/nstx/Software/WebTools/shotlists.html)
outFile - string (if not present, data listed to screen)
quiet - if set, will not print things to screen
status - if an even number, then there was a problem.
OUTPUTS:
info - structure containing columns from ENTRIES table
data to screen or file, if desired
NOTES:
Will need red permission for NSTX databases (send email request to
dbadmin) and sybase files. Source /p/nstxusr/util/setup/mkmdsplusdbfile.csh
EXAMPLE:
IDL> info = nstxlogs_get( shot=130000 )
IDL> info = nstxlogs_get( rundate=20060621 )
MODIFICATION HISTORY:
17-Sep-2009 Written by Bill Davis, PPPL
Source: src/idl_cvs/nstx_xp.pro
NAME:
nstx_xp
PURPOSE:
return the NSTX XP for an NSTX shot
CATEGORY:
NSTX, Database
CALLING SEQUENCE:
IDL> info = nstx_xp( shot )
INPUTS:
shot - e.g., 105535
KEYWORD PARAMETERS:
none
OUTPUTS:
info - structure containing columns from ENTRIES table
NOTES:
Will need read permission for NSTX databases (send email request to
dbadmin) and sybase files. Execute /p/nstxusr/util/setup/mkmdsplusdbfile.csh
EXAMPLE:
IDL> print, nstx_xp( 130000 )
829
MODIFICATION HISTORY:
17-Sep-2009 Written by Bill Davis, PPPL
Source: src/idl_cvs/numberpos.pro
NAME:
numberPos
PURPOSE:
find position of first character which is a number
if none found, returns strlen(input)
CATEGORY:
Strings, Character Search
CALLING SEQUENCE:
pos = numberPos( mdsSigName )
MODIFICATION HISTORY:
15-Jul-2008 Written by Bill Davis
Source: src/idl_cvs/numlines.pro
NAME:
NUMLINES
PURPOSE:
Return the number of lines in a file
CATEGORY:
Files
CALLING SEQUENCE:
nl = NUMLINES( filename )
INPUT:
filename = name of file, scalar string
OUTPUT:
nl = number of lines in the file, scalar longword
Set to -1 if the number of lines could not be determined
METHOD:
If Unix then spawn to wc; otherwise read 1 line at a time and count
PROCEDURE CALLS:
OS_FAMILY() - Determine if a unix system; Users with IDL V4.0 or later
can replace this with !VERSION.OS_FAMILY
MODIFICATION HISTORY:
W. Landsman February 1996
07-Oct-98 BD Added StopOnError Keyword
in unix, handle stuff printed from .cshrc when spawning wc
Source: src/idl_cvs/nwords.pro
NAME:
NWORDS
PURPOSE:
Return the number of words in the given text string or string array.
CATEGORY:
Strings
CALLING SEQUENCE:
n = nwords(txt)
INPUTS:
txt = text string to examine. in
KEYWORD PARAMETERS:
Keywords:
DELIMITER = d. Set delimiter character (def = space).
OUTPUTS:
n = number of words found. out
COMMON BLOCKS:
NOTES:
Notes: See also getwrd.
MODIFICATION HISTORY:
20-Feb-2006 if string is a Delete Character, don't count as a word.
(Sometimes returned from database apps.)
20-Apr-2004 if a non-character, return number of array elements
09-Jun-2000 do not count blank or null elements in an array
Bill Daivs, Sep. '97, made to handle string arrays
R. Sterner, 7 Feb, 1985.
Johns Hopkins University Applied Physics Laboratory.
RES 4 Sep, 1989 --- converted to SUN.
Copyright (C) 1985, 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/onalpha.pro
NAME:
OnAlpha
PURPOSE:
Tests for running on an alpha computer. You can specify the
the desired Alpha computer. Optionally beeps, and prints a
message and returns an error if not on the desired Alpha computer.
CATEGORY:
OS Specific
CALLING SEQUENCE:
IDL> OK = OnAlpha('KEES')
INPUTS:
(Optional)
compWanted - string of VMS alpha system, e.g., 'mel' (default='KEES')
KEYWORD PARAMETERS:
(Optional)
NOBEEP - if set, no beep when not on desired alpha
QUIET - if set, no message is printed to the terminal
OUTPUTS:
OK = If = 1, then on desired alpha, else 0 out
COMMON BLOCKS:
NONE
EXAMPLE:
IDL> OK = onAlpha( )
NOTES:
MODIFICATION HISTORY:
30-May-00 Since Multinet recently added places, remove need for
it.
20-Oct-99 Written by Bill Davis, PPPL
Source: src/idl_cvs/oncomputer.pro
NAME:
onComputer
PURPOSE:
Return 1 if on the specified computer.
First uses enironmental variable HOST has the computer name.
CATEGORY:
System
CALLING SEQUENCE:
IDL> OK = onComputer( computerName )
INPUTS:
computerName - name of computer (best not to have domain included)
this not case sensitive.
KEYWORD PARAMETERS:
var - Environmental variable to check for computer name.
(defaults to 'HOST'). If HOST not defined, will still work on Linux
HLP - When set, help information is printed.
verbose - if set, will print many informational messages
debug - if set, debug output will be printed
OUTPUTS:
OK = 1 if environmental variable "camac_server" is non-blank
EXAMPLE:
NOTES:
When the routine is called with no parameters, or with the
keyword hlp set, help information is printed.
MODIFICATION HISTORY:
08-Jan-2009 Written by Bill Davis, PPPL
Source: src/idl_cvs/onesurf.pro
NAME:
ONESURF
PURPOSE:
This function returns a 24-bit image of a surface with various
combinations of colour, shading and grids. The colour coding can
tied to the surface height or to an independent array. A grid can
be overlaid on the surface or used to mask a coloured or shaded plot
so as to produce a coloured and/or shaded grid. Light shading can
be applied to both the coloured and gridded surface, or just the
coloured surface, leaving the grid unshaded.
The plotting is done on the current device, which can be any
device which supports the TVRD command: eg screen windows, pixmaps,
or the z-buffer.
The light shading parameters are determined by previous calls to
SET_SHADING. The viewing position and 3d-2d scaling are handled by
the usual graphics keywords - see the documentation for SURFACE and
SHADE_SURF in the IDL user's guide.
The image returned by ONESURF is a pixel-interleaved 24-bit
image of type bytarr(3, xsize, ysize), where xsize and ysize
are the dimensions of the current graphics window.
CATEGORY:
Graphics, Surface Plotting
CALLING SEQUENCE:
result = ONESURF(SURFDATA)
INPUTS:
SURFDATA: a two-dimensional array of type byte containing the
data to be plotted.
KEYWORD PARAMETERS:
COLOUR: Set this keyword to include colour coding in the plot
The default is no colour-coding.
COLDATA: A variable or array of type byte containing the colour
data to be used when plotting a colour plot.
If COLDATA is a scalar then it is assumed to be an index to
a colour in COLMAP which is used to give a single colour to
whole surface.
If COLDATA is a vector of at least three elements its first
three elements are treated as a rgb colour triple and used
to give a single colour to the whole surface.
If COLDATA is two-dimensional it is treated as an array of
colour indices of COLMAP and used to give each data point
it's own colour. If COLDATA has different dimensions to
SURFDATA, CONGRID is used to stretch or squeeze a copy of
COLDATA to fit.
If COLOUR is set but COLDATA is undefined or does not satisfy
any of the above conditions, a BYTSCL'ed version of SURFDATA is
used to produce a plot coloured according to height.
COLMAP: The colour map to use for plotting of the colour data.
If a number is given the corresponding inbuilt IDL colour
map is used. Otherwise COLMAP should be an array of three
byte vectors [red, green, blue] such as those returned by
the TVLCT, /get procedure. If COLMAP is not set, the
current colour map is used. Note that ONESURF maintains
the current colour map even if a different map is specified
for the plot.
SHADE: Set this keyword to perform light shading.
SHADE = 0: no shading
SHADE = 1: shade everything
SHADE = 2: don't shade the grid
The default is no shading
GRID: Set this keyword to apply grids to the surface
GRID = 0: no grid
GRID = 1: overlay a grid on the surface
GRID = 2: use the grid as a mask
The default is no grid
CGRID: The colour to use for overlaid grids. If CGRID is a number
it is treated as an index in the colour table given by COLMAP.
If CGRID is an three-element vector of bytes it is treated
as the rgb values for a colour. If it is anything else or
undefined the grid is plotted white.
_EXTRA: Used to pass extra plot parameters to both SHADE_SURF and
SURFACE. _EXTRA provides a convenient way of passing
common parameters such as viewing angle and plot position.
Note that only keywords valid for both SHADE_SURF and SURFACE
can be used.
If EXTRA_SHADE is set, _EXTRA is ignored for the shaded plots,
similarly with EXTRA_SURF and surface plots.
Some keywords (eg, SHADES, COLOR, NODATA, NOERASE) will
interfere with the plotting done by ONESURF and lead to
unpredictable results.
_EXTRA is itself passed to SHADE_SURF and SURFACE using
the _EXTRA keyword, so keywords which expect a data value
to be changed (eg [XYZ]TICK_GET) will not work.
Useable keywords are: AX, AZ, MAX_VALUE, MIN_VALUE, SAVE,
[XY]TYPE, CHARSIZE, CHARTHICK, CLIP, DATA, DEVICE, FONT,
NOCLIP, NORMAL, POSITION, SUBTITLE, T3D, THICK, TICKLEN,
TITLE, [XYZ]CHARSIZE, [XYZ]GRIDSTYLE, [XYZ]MARGIN, [XYZ]MINOR
[XYZ]RANGE, [XYZ]STYLE, [XYZ]THICK, [XYZ]TICKFORMAT,
[XYZ]TICKLEN, [XYZ]TICKNAME, [XYZ]TICKS, [XYZ]TICKV,
[XYZ]TITLE, ZVALUE.
EXTRA_SHADE: Used to pass extra plot parameters to the SHADE_SURF
procedure only. EXTRA_SHADE is passed to SHADE_SURF
using the _EXTRA keyword so keywords such as IMAGE
which expect a variable to be altered will not work.
As with _EXTRA, setting the SHADES keyword can lead
to unpredictable results. EXTRA_SURF should be an
anonymous structure.
EXTRA_SURF: Used to pass extra plot parameters to the SURFACE
procedure only. Restrictions are as for _EXTRA and
EXTRA_SHADE. If EXTRA_SHADE is set, but EXTRA_SURF
is not, EXTRA_SURF is made equal to _EXTRA, and vice
versa.
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
None.
EXAMPLE:
Create an image of a surface coloured according to height using
the current colour map, with light shading and no grid:
image = onesurf(surfdata, /colour, /shade)
Create a shaded green grid on a shaded surface:
image = onesurf(surfdata, /shade, /grid, cgrid=[0,255,0])
Create a shaded view of a surface, coloured according to a second
array using colour map 25, overlaid with a grey, unshaded grid:
image = onesurf(surfdata, /colour, colmap=25, coldata=second_array, $
shade=2, /grid, cgrid=[127,127,127])
MODIFICATION HISTORY:
Part of Struan's Surface Tutorial:
http://www.sljus.lu.se/stm/IDL/Surf_Tips/
Written by: Struan Gray, Sljusfysik, Lunds Universitet, 970305.
970313 SMG - added _extra, extra_surf and extra_shade keywords
for better control of graphics keywords.
Source: src/idl_cvs/oplotdash.pro
NAME:
oplotdash
PURPOSE:
Overplot a variety of dashed lines, even if terminal
emulator doesn't for different linestyles
CATEGORY:
2-D Plotting
CALLING SEQUENCE:
IDL> oplotdash, x, y, dashfracdashfrac=, blankfrac=blankfrac
INPUTS:
x - x data to overplot
y - y data to overplot
KEYWORD PARAMETERS:
Optional:
dashfrac - fraction of distance (0-1) dash will be (def=0.01)
blankfrac - fraction of distance (0-1) blank will be
smallFrac - fraction of distance (0-1) for a small dash, or a dot.
OUTPUTS:
COMMON BLOCKS:
NONE
NOTES:
This will probably be slow for large numbers of points.
EXAMPLE:
x = findgen(100)
y = sin(x/5)
plot, x, y, title='My Plot', xtitle='Seconds', ytitle='Function', $
charsize=1.5
oplotdash, x, y/2, dashfrac=.02, blankfrac=.01
TVIMAGE, bytscl(dist(100,50)), x, y, POSITION=thisPosition, $
/KEEP_ASPECT_RATIO
oplotdash, x, y/2, dashfrac=.02, blankfrac=.01
MODIFICATION HISTORY:
06-Mar-2013 made to work when other graph type drawn first
16-Apr-2012 Written by Bill Davis, PPPL
Source: src/idl_cvs/oplotsep.pro
NAME:
oplotsep
PURPOSE:
Overplot separatrix and limiter onto grid with GPI images
already drawn. Works with 2010 NSTX shots.
CALLING SEQUENCE:
IDL> oplotsep, shot, time, fit=fit
INPUTS:
shot - NSTX shot number
time - shot time in seconds
KEYWORD PARAMETERS:
Inputs:
manifold - show manifold
sepColor - color you want separatrix drawn in, 'e.g. 'green'
DEFAULT = 'white'
charsize - size of characters on plot
verbose - if set, will print many informational messages
debug - if set, debug output will be printed
OUTPUTS:
xLim_out - x pixels for drawing limiter
zLim_out - z pixels for drawing limiter
outXsep - x values of separatrix to plot in camera viewport
outZsep - z values of separatrix to plot in camera viewport
rsep - r values of right half of separatrix
zsep - z values of right half of separatrix
status - if odd, then success
EXAMPLE:
IDL> nx = 64 & ny = 80
IDL> x = findgen( nx )+1 & y = findgen( ny )+1
IDL> in_pos = [.1,.4,.9,.9] ; draw in top part of screen, say
IDL> Right_Aspect, x, y, IN_POS=in_pos, POSITION=out_pos
IDL> plot, x, y, /nodata, pos=out_pos
IDL> tvimage, 255-bytscl(dist(nx,ny)), x, y, position=getpos()
IDL> plot, x, y, /nodata, pos=out_pos, /noerase ; redraw ticks
IDL> oplotsep, 139442, 0.4, position=out_pos if image expanded:
IDL> mag = 3
IDL> nx = 64*mag & ny = 80*mag
IDL> x = findgen( nx )+1 & y = findgen( ny )+1
IDL> x = x/mag & y = y/mag
IDL> window, xsize=nx, ysize=ny
IDL> image = 255-bytscl(dist(nx,ny))
IDL> pos = [0,0,1,1]
IDL> plot, x, y, /nodata, pos=pos
IDL> tvimage, image, x, y
IDL> oplotsep, 139442, 0.4
IDL>
IDL>
IDL>
MODIFICATION HISTORY:
13-Sep-2013 use ph7_projection for R,Z to i,j conversion
WRITTEN 19-Mar-2013 by Bill Davis for Stewart Zweben
Source: src/idl_cvs/os_family.pro
NAME:
OS_FAMILY
PURPOSE:
Return the current operating system as in !VERSION.OS_FAMILY
CATEGORY:
OS Specific
CALLING SEQUENCE:
result = OS_FAMILY()
INPUTS:
None
OUTPUTS:
result - scalar string containing one of the four values
'Windows','MacOS','vms' or 'unix'
NOTES:
OS_FAMILY is assumed to be 'unix' if !VERSION.OS is not 'windows',
'MacOS' or 'vms'
To make procedures from IDL V4.0 and later compatibile with earlier
versions of IDL, replace calls to !VERSION.OS_FAMILY with OS_FAMILY().
PROCEDURES CALLED:
function tag_exists
REVISION HISTORY:
Written, W. Landsman
Source: src/idl_cvs/ovplot.pro
NAME:
ovplot
PURPOSE:
Just like oplot, except it calls vcomp to "visually compress"
an array for faster delivery of graphs at the expense of CPU time.
All data spikes should be retained.
CATEGORY:
Plotting
CALLING SEQUENCE:
ovplot, time, data, _extra=_extra
KEYWORDS
Just like for oplot
COMMON BLOCKS:
none
EXAMPLE:
IDL> vplot, time, data, title='whatever', xrange=[0,2]
IDL> ovplot, time, data/2.
NOTES:
VComp assumes equally spaced data, but might be OK for some cases.
Probably want to use VPlot for first plot, but not necessary.
LIMITATIONS:
This is compuationally intensive, so is not appropriate for
all applications, but for I/O-bound plotting can speed up 10x or more.
Will return y points for each x -- the min & max values.
IF nFinal GE N_ELEMENTS(inData)*2 will just return inputs
MODIFICATION HISTORY:
Written 20-May-01 by Bill Davis
Source: src/idl_cvs/padstrings.pro
NAME:
padstrings
PURPOSE:
pad column widths so each text field takes up same amount of
space. Remove any tabs.
CATEGORY:
Strings
CALLING SEQUENCE:
newStrArray = padstrings( strArrar, minWidth=minWidth )
INPUTS:
strArrar - Array of strings
KEYWORD PARAMETERS:
Inputs:
minWidth - minimum width of string, default to max in strArray
right - if set, will pad with blanks on right, rather than on left
OUTPUTS:
outArray - string array with smaller elements padded with blanks
EXAMPLE
IDL> in=['bbkbbk', 'dd', 'eeeeebbbbbb','dldl']
IDL> out = strArray( in )
IDL> for k=0,3 do help, out[k]
STRING = ' bbkbbk'
STRING = ' dd'
STRING = 'eeeeebbbbbb'
STRING = ' dldl'
MODIFICATION HISTORY:
Written 26-Mar-2010 by Bill Davis
Source: src/idl_cvs/parcheck.pro
NAME:
PARCHECK
PURPOSE:
To check that a procedure has been called with the minimum of allowed
number of parameters.
CATEGORY:
Error checking
CALLING SEQUENCE:
PARCHECK,NPARM,MINPARMS,CALLINGPRO
PARAMETERS:
NPARM (REQ) (I) (0) (I)
required input scalar giving the number of parameters
in the procedure call (i.e. n_params(0)).
MINPARMS (REQ) (I) (0 1) (I)
If scalar, the minimum number of parameters needed for the
procedure to execute properly.
If an array, it represents the allowed numbers of
parameters (e.g. if 3,4 or 6 parameters are allowed,
then set minparms([0,1,2]) = [3,4,6] ).
CALLINGPRO (REQ) (I) (0) (S)
Required string giving the name of the calling procedure.
EXAMPLES:
To determine if procedure pro, which contains a
call to parcheck has the minimum number of parameters
(i.e. 4):
PARCHECK,N_PARAMS(),4,'PRO'
If the same procedure can have 4,5,7, or 8 parameters
then use:
PARCHECK,N_PARAMS(),[4,5,7,8],'PRO'
PROCEDURE:
The input parameters to PARCHECK are first checked themselves
using PCHECK. If MINPARMS is a scalar it is compared to NPARM.
If NPARM < MINPARMS, then an error message is printed and the
procedure returns to the main level. If MINPARMS is a vector,
then NPARM is subtracted from each value of MINPARMS and the
resulting vector is checked for zeroes. If no values are zero,
then error messages are printed and the program returns to the
main level.
MODIFICATION HISTORY :
Mar 30 1987 cag gsfc initial program
Apr 1987 rwt gsfc add vector input for parameters
Mar 15 1988 cag gsfc add vax rdaf-style prolog
Jul 12 1989 jtb gsfc converted to sun/unix idl
Nov 2 1989 rwt gsfc correct print format syntax
May 10 1991 PJL GSFC corrected prolog format
Jun 21 1991 gra casa cleaned up; tested SUN, DEC, VAX;
updated prolog.
Jun 28 1991 PJL GSFC added npar test; tested on SUN and VAX;
updated prolog
Source: src/idl_cvs/pdsurface.pro
NAME:
pdsurface
PURPOSE:
This routine provides a graphical interface to the SURFACE and
SHADE_SurfRangeACE commands. Different controls are provided to change
the viewing angle and other plot parameters. The command used to
generate the resulting surface plot is shown in a text window.
CATEGORY:
Widgets.
CALLING SEQUENCE:
pdsurface, Data
INPUT PARAMETERS:
Data: The two-dimensional array to display as a wire-mesh or
shaded surface.
KEYWORD PARAMETERS:
GROUP: The widget ID of the widget that calls pdsurface. When this
keyword is specified, the death of the caller results in the
death of pdsurface.
BLOCK: Set this keyword to have XMANAGER block when this
application is registered. By default the Xmanager
keyword NO_BLOCK is set to 1 to provide access to the
command line if active command line processing is available.
Note that setting BLOCK for this application will cause
all widget applications to block, not only this
application. For more information see the NO_BLOCK keyword
to XMANAGER.
SIDE EFFECTS:
The XMANAGER is initiated if it is not already running.
RESTRICTIONS:
pdsurface does not accept any of the keywords that the IDL command
SURFACE does.
PROCEDURE:
Create and register the widget with the XMANAGER and then exit.
MODIFICATION HISTORY:
20-May-04 Better message when no analysis data, or times out-of-range
10-Feb-03 Made shaded surface the default [BD]
25-Feb-02 List shot date and time on plot [BD]
01-Feb-01 Added "Copy Plot to Tek Window" option
17-OCT-00 Added Max Power Density to plot option.
14-Sep-00 Added min & max R options & better shot buttons. [BD]
29-Aug-00 Made from RSI xsurface [BD]
Created from a template written by: Steve Richards, January, 1991.
Source: src/idl_cvs/pecomp.pro
NAME:
PECOMP
PURPOSE:
Interactively compare PCS and EFIT signals for a shot
CATEGORY:
EFIT, PCS
CALLING SEQUENCE:
IDL> pecomp, shot=shot
INPUTS:
shot = shot number
KEYWORD PARAMETERS:
Keywords:
print - print rather than display on screen
data - can pass in data
xsize
ysize
xrange - of plots
debug
bigCharSize
OUTPUTS:
COMMON BLOCKS:
NONE
EXAMPLE:
IDL> pecomp, shot=130000, bigCharSize=3
NOTES:
Use middle mouse button to select zoom region
MODIFICATION HISTORY:
18-Jul-2011 fixed bug in SPA plotted times
14-Jul-2011 added "SPA Current" and "Loop Voltage Diff" buttons
14-Jul-2011 removed ["RAI_PF4", "\IPF4"] coils plotting, since bombs
10-Nov-2008 made to work with skylark defs.
don't keep reading data when not there. [BD]
21-Feb-2008 Added "RAF_FLPPPU4" & "\F_FLPPPU4" per Dennis & Dave
14-Feb-2008 Add upper-lower loop voltage difference signals per
Dennis Mueller [BD]
04-Feb-2008 add switch to allow using eng_dev tree [Dana Mastrovito]
21-Jan-2008 Don't do an MDSconnect (use mdsopen instead of openMDSshot()) [BD]
12-Feb-2007 Always read shot number field before plotting, so not necessary.
Fix recently introduced errors.
Written by Bill Davis, PPPL, for Dave Gates
Source: src/idl_cvs/pickcolorname.pro
NAME:
PICKCOLORNAME
PURPOSE:
The purpose of this program is to provide a blocking
or modal widget interface for selecting a color "name".
The program uses colors familiar to the FSC_COLOR program,
and is often used to select a color name for passing to FSC_COLOR.
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, Color Specification.
CALLING SEQUENCE:
colorName = PickColorName(startColorName)
OPTIONAL INPUT PARAMETERS:
startColorName: A string with the "name" of the color. Colors available are these:
Almond Antique White Aquamarine Beige Bisque Black
Blue Blue Violet Brown Burlywood Cadet Blue Charcoal
Chartreuse Chocolate Coral Cornflower Blue Cornsilk Crimson
Cyan Dark Goldenrod Dark Gray Dark Green Dark Khaki Dark Orchid
Dark Red Dark Salmon Dark Slate Blue Deep Pink Dodger Blue Firebrick
Forest Green Gold Goldenrod Gray Green Green Yellow
Honeydew Hot Pink Indian Red Ivory Khaki Lavender
Lawn Green Light Coral Light Cyan Light Gray Light Salmon Light Sea Green
Light Yellow Lime Green Linen Magenta Maroon Medium Gray
Medium Orchid Moccasin Navy Olive Olive Drab Orange
Orange Red Orchid Pale Goldenrod Pale Green Papaya Peru
Pink Plum Powder Blue Purple Red Rose
Rosy Brown Royal Blue Saddle Brown Salmon Sandy Brown Sea Green
Seashell Sienna Sky Blue Slate Blue Slate Gray Snow
Spring Green Steel Blue Tan Teal Thistle Tomato
Turquoise Violet Violet Red Wheat White Yellow The color WHITE is used if this parameter is absent.
If the BREWER keyword is set, you can use the Brewer Color names:
WT1 WT2 WT3 WT4 WT5 WT6 WT7 WT8
TAN1 TAN2 TAN3 TAN4 TAN5 TAN6 TAN7 TAN8
BLK1 BLK2 BLK3 BLK4 BLK5 BLK6 BLK7 BLK8
GRN1 GRN2 GRN3 GRN4 GRN5 GRN6 GRN7 GRN8
BLU1 BLU2 BLU3 BLU4 BLU5 BLU6 BLU7 BLU8
ORG1 ORG2 ORG3 ORG4 ORG5 ORG6 ORG7 ORG8
RED1 RED2 RED3 RED4 RED5 RED6 RED7 RED8
PUR1 PUR2 PUR3 PUR4 PUR5 PUR6 PUR7 PUR8
PBG1 PBG2 PBG3 PBG4 PBG5 PBG6 PBG7 PBG8
YGB1 YGB2 YGB3 YGB4 YGB5 YGB6 YGB7 YGB8
RYB1 RYB2 RYB3 RYB4 RYB5 RYB6 RYB7 RYB8
TG1 TG2 TG3 TG4 TG5 TG6 TG7 TG8
INPUT KEYWORD PARAMETERS:
BOTTOM: The colors used in the program must be loaded somewhere
in the color table. This keyword indicates where the colors
start loading. By default BOTTOM is set equal to !D.Table_Size-NCOLORS-1.
BREWER: Set this keyword if you wish to use the Brewer Colors, as defined
in this reference:
http://www.personal.psu.edu/cab38/ColorBrewer/ColorBrewer_intro.html
COLUMNS: Set this keyword to the number of columns the colors should
be arranged in.
FILENAME: The string name of an ASCII file that can be opened to read in
color values and color names. There should be one color per row
in the file. Please be sure there are no blank lines in the file.
The format of each row should be:
redValue greenValue blueValue colorName
Color values should be between 0 and 255. Any kind of white-space
separation (blank characters, commas, or tabs) are allowed. The color
name should be a string, but it should NOT be in quotes. A typical
entry into the file would look like this:
255 255 0 Yellow
GROUP_LEADER: This identifies a group leader if the program is called
from within a widget program. Note that this keyword MUST be provided
if you want to guarantee modal widget functionality. (If you don't know
what this means, believe me, you WANT to use this keyword, always.)
INDEX: This keyword identifies a color table index where the selected color
is to be loaded when the program exits. The default behavior is to restore
the input color table and NOT load a color.
TITLE: This keyword accepts a string value for the window title. The default
is "Select a Color".
OUTPUT KEYWORD PARAMETERS:
CANCEL: On exit, this keyword value is set to 0 if the user selected
the ACCEPT button. IF the user selected the CANCEL button, or
closed the window in any other way, this keyword value is set to 1.
COMMON BLOCKS:
None.
SIDE EFFECTS:
Colors are loaded in the current color table. The input color table
is restored when the program exits. This will only be noticable on
8-bit displays. The startColorName is returned if the user cancels
or destroys the widget before a selection is made. Users should
check the CANCEL flag before using the returned color.
EXAMPLE:
To call the program from the IDL comamnd line:
IDL> color = PickColorName("red") & Print, color
To call the program from within a widget program:
color = PickColorName("red", Group_Leader=event.top) & Print, color
MODIFICATION HISTORY:
Written by: David W. Fanning, 31 August 2000.
Modified program to read colors from a file and to use more
colors on 24-bit platforms. 16 October 2000. DWF.
Added the COLUMNS keyword. 16 October 2000. DWF.
Fixed a small problem with mapping a modal widget. 2 Jan 2001. DWF
Now drawing small box around each color. 13 March 2003. DWF.
Added eight new colors. Total now of 104 colors. 11 August 2005. DWF.
Modified GUI to display system colors. 13 Dec 2005. DWF.
Added BREWER keyword to allow Brewer Colors. 15 May 2008. DWF.
Source: src/idl_cvs/pickplot.pro
NAME:
PickPlot
PURPOSE:
This function allows the user to interactively pick a plot file.
It will be plotted in a separate window. Postscript files (with a
"ps" extenstion will go to a gv window, and others will be
plotted with xv.
CATEGORY:
Widgets.
CALLING SEQUENCE:
pickplot
KEYWORD PARAMETERS:
FILE: A string value for setting the initial value of the
selection. Useful if there is a default file
PsPlotFILE: Name of file to copy clicked-on files to. "gv --watch"
will be looking for this file to change, so will effectively
plot the file clicked. Defaults to '~/PickPlot.ps'
PATH: The initial path to select files from. If this keyword is
not set, the current directory is used.
FILTER: A string value for filtering the files in the file list. This
keyword is used to reduce the number of files to choose from.
The user can modify the filter unless the FIX_FILTER keyword
is set. Example filter values might be "*.ps" or "*.pdf".
TITLE: A scalar string to be used for the window title. If it is
not specified, the default title is "Select File"
GROUP: The widget ID of the widget that calls PICKFILE. When this
ID is specified, a death of the caller results in the death of
the PICKFILE widget application.
OUTPUTS:
Copies selected file to ~/PickPlot.ps, which "gv --watch" is looking for
to plot.
COMMON BLOCKS:
None.
NOTES:
This probably only works on Linux/Unix.
You probably want the following line in your ~/.Xresources file:
gv.watchFileFrequency: 501
this will make gv check for file changes ever 501 ms, rather than 1000 ms.
SIDE EFFECTS:
This function initiates the XMANAGER if it is not already running.
RESTRICTIONS:
PICKFILE does not recognize symbolic links to other files in UNIX.
PickFile (probably) only works on Linux/Unix systems where gv is in the PATH.
MODIFICATION HISTORY:
Written 28-Oct-2009 by Bill Davis, PPPL. Based on BigPickPlot.pro
Source: src/idl_cvs/pingplot.pro
NAME:
pingplot
PURPOSE:
plot ping times to various computers (from sunfire13, probably).
CATEGORY:
Utility
CALLING SEQUENCE:
IDL> pingplot, ymax=100
INPUTS:
KEYWORD PARAMETERS:
(optional inputs)
infile - file produced by pingload.pro running from a cron job.
defaults to pingload_yyyymmdd.txt (e.g., pingload_20080218.txt)
dir - directory to find file (defaults to /u/bdavis/cvs/idl_cvs)
the following 3 all limit the y-axis:
yrange - 2-element array
ymax - scalar
limit - scalar (same as ymax)
daysAgo - how many days ago to get data to plot
host - for label of title (defaults to sunfire13)
verbose - if set, will print many informational messages
debug - if set, debug output will be printed, and will stop before exiting
OUTPUTS:
NONE
EXAMPLE:
IDL> pingplot, ymax=10
IDL> date2ymd,systime(),y,m,d, dateString=longDateString
IDL> filename = 'ping'+longDateString+'.jpg'
IDL> mk_jpeg, filename=filename
IDL> spawn, 'lpr -Pb143-x8550dt '+ filename
MODIFICATION HISTORY:
WRITTEN 08-Feb-2008 by Bill Davis
Source: src/idl_cvs/plasmaedge.pro
NAME:
plasmaedge
PURPOSE:
From EFIT or LRDfit, find R and Z values of last closed flux surface
(separatrix) for a particular NSTX shot and time. Optionally save to a
file.Also will plot limiters and last closed flux surface with axes.
Can also return R & Z of limiter interior.
CATEGORY:
EFIT, 2-D Plotting, NSTX
CALLING SEQUENCE:
IDL> plasmaEdge, shot, time, /plot, /debug
INPUTS:
shot = nstx shot number
time - time desired in seconds (will pick closest in tree)
KEYWORD PARAMETERS:
Optional Inputs:
efitVersion - 1-6. Defaults to 2
LRDfitVersion - alternate to above
BestFit - (DEFAULT) if set, will call bestFitAvail, which has preference
of LRDFIT04, any other LRDFIT, EFIT02, then highest EFIT.
noOpen - if set will not try to open a tree (assumes already open)
outfile - Defaults to 'PlasmaEdge___ms.txt', unless='NONE'
limiter - if set, will print R & Z values for limter shell
plot - if set will plot data
verbose - if set, will print many informational messages
debug - if set, debug output will be printed
Returned:
r_edge - r values of edge points
z_edge - z values of edge points
xLim - r values of limiter points
zLim - z values of limiter points
actualTime - actual time used, i.e., nearest EFIT or LRDfit time to
that requested
EXAMPLE:
IDL> plasmaEdge, 130376, .589, /plot, /debug
to get get R & Z data and limiter location:
IDL> plasmaEdge, 135036, .589, outfile='NONE', R_edge=R, Z_edge=Z, $
xLim=xLim, zLim=zLim
08-Dec-2011 BD added keyword BestFit, and made that the default!
default output file to 'NONE'
WRITTEN 03-Feb-2010 by Bill Davis
Source: src/idl_cvs/plot0check.pro
NAME:
plot0check
PURPOSE:
Plots blank axis if no data in !x.range or !y.range
CATEGORY:
Plotting, X-Y Plotting
CALLING SEQUENCE:
IDL> plot0check, x, y, ...
INPUTS:
x, y, .. = just like on the PLOT command.
KEYWORD PARAMETERS:
Keywords:
OUTPUTS:
none
COMMON BLOCKS:
NONE
EXAMPLE:
IDL>plot0check, x, y, line=1,color=1, /ylog
NOTES:
MODIFICATION HISTORY:
03-Oct-02 recover if x & y not right dimensions in 2-D plotting
18-May-01 Use Vcomp for "visual compression" if more points than resolution
20-Nov-00 Written by Bill Davis, PPPL
Source: src/idl_cvs/plot1sig.pro
NAME:
plot1sig
PURPOSE:
plot 1 NSTX signal for many shots stacked vertically
CATEGORY:
NSTX, X-Y Plotting, MDSplus
EXAMPLE:
IDL> shots = [ 111827, 111875, 111876, 112075, 112137 ]
IDL> signame = '\wf::ip'
IDL> plot1sig, shots, signame=signame
IDL>
Post script version:
IDL> shots=[112175,112171,112172]
IDL> !p.charsize=1.7
IDL> setup_ps, file='dalf.ps', printer='postscript'
IDL> device,set_font='Helvetica'
IDL> signames='\passivespec::bayc_dalf_haifa'
IDL> plot1sig,shots,0.,.6,signames=signames,tweenspace=.05
IDL> unsetup_ps
MODIFICATION HISTORY:
19-May-2004 Added _extra keyword and fixed ymaxes bug
19-Apr-2004 Written by Bill Davis for Stan Kaye
Source: src/idl_cvs/plot3_mpts.pro
NAME:
plot3_mpts
PURPOSE:
Make 3 Multi-point Thomson Scattering Plots: 2-D plots of electron Temp and Density
and a time history.
CATEGORY:
2-D Plotting, MPTS, GPI
CALLING SEQUENCE:
IDL> plot3_mpts, shot
INPUTS:
shot = NSTX shot number
KEYWORD PARAMETERS:
Inputs:
Plot_IP - if=0, do not have Ip plot on graph
Tplot = vector of times to plot profiles (default = all times)
(if multiple shots only first time point is used)
Temax = value of maximum Te to plot [ keV]
Nemax = value of maximum Ne to plot [1e13 /cm^3]
Pemax = value of maximum Pe to plot [kPa]
Nelmax = value of maximum NeL to plot [1e15 /cm^2]
Temin = value of minimum Te to plot [ keV]
Nemin = value of minimum Ne to plot [1e13 /cm^3]
Pemin = value of minimum Pe to plot [kPa]
Nelmin = value of minimum NeL to plot [1e15 /cm^2]
CHI = if set, changes plotting defaults to values appropriate
to lower temperature plasmas
Nospline = set to connect data with straight lines instead of splines.
Rrange = two element vector to set radial range of plot [Rmin, Rmax]
Fancy = sets Font to Triplex Roman
Tmin = minimum time to plot (def=0)
Tmax = set maximum value of time in plot
Pk = set Te(t) to peak value of spline
Efit = value of EFIT tree to use '1,2,3,4,5'
GPI = if set, will add trace of average light vs. time from GPI
camera frames.
NB = if set, add neutral beam power to time history plot
RF = if set, add HHFW power to time history plot
MHD = if set, add Mirnov trace to time history
Vloop = if set, add loop voltage to time history plot
Mld = if set, add microwave line density to time history
HA = if set, add hydrogen alpha signal to time history
USXR = if set, add ultra-soft x-ray signal to time history
Wmhd = if set, add EFIT Total energy (Wmhd) to time history
Tf = if set, add TF current to time history
Qmin = if set, add qmin to time history
Q95 = if set, add q95 to time history
noTimeLines - if set, will draw dotted lines on color contours showing
times of Thomson data
box -
c_colors - contour colors
charsize - sets size of characters in plot
contour - draw contour lines over color contours
ctb - the IDL color table (defaults to 3, hot metal)
deltaT -
efileType -
emailPsAddress -
fit - type of fit for separatrix plot
GPI - if set, plot GPI average in bottom plot
interp -
lastPoint -
lastTime -
mailPsFile -
nospline -
PlotsDesired -
psFileName -
r1 -
r2 -
rescale -
rf -
sep -
sh2 -
surf -
t1 -
t2 -
tRange -
xmargin - sent to plot command
XOR_cont - use XOR for color of contour lines
xpos -sent to plot command
xRange -
xsize -
ymargin - sent to plot command
ypos - sent to plot command
ysize -
OUTPUTS:
opt = returned value out
COMMON BLOCKS:
NONE
EXAMPLE:
To add GPI average to lowest plot:
IDL> plot3_mpts, 138846, /GPI,/box
IDL> wset, 32
IDL> plot3_mpts, 138846, /GPI,tmin=.45, tmax=.85, r1=1.2,r2=1.56, $
/contour, Plot_ip=0
IDL> for shot=138844,138847 do plot3_mpts, shot, /GPI, $
tmin=.45, tmax=.85, r1=1.2,r2=1.56, /contour, Plot_ip=0, $
efile='PDF'
IDL> for shot=138844,138847 do $
plot3_mpts, shot, /GPI, /Sep, $
tmin=.3, tmax=.9, r1=1.25,r2=1.5, /contour, $
Plot_ip=0, c_colors=[115,110,100,50,30,20,10], /debug
IDL> for shot=138844,138847 do $
plot3_mpts, shot, /GPI, /Sep, $
tmin=.45, tmax=.85, r1=1.35,r2=1.5, /contour, $
Plot_ip=0, c_colors=[115,110,100,50,30,20,10], /debug
to make a post script plot:
IDL> !p.font=0
IDL> setup_ps,'Plot3_MPTS.ps', printer='postscript color'
IDL> plot3_mpts, 138846, /GPI,tmin=.45, tmax=.85, r1=1.2, r2=1.56, $
/contour
IDL> unsetup_ps
NOTES:
MODIFICATION HISTORY:
30-May-2013 added GPI option for Stewart Zweben
31-Aug-2010 moved PNB read to end, because opening tree takes ~12s !
29-Jul-2010 added LastPoint and lastTime keywords
15-Jul-2010 added xmargin keyword for wall display
05-Nov-2009 handle no times or deltaT entered.
14-Apr-06 Added default to mail PDF file if e-mail checked and user specified.
26-Jan-06 No longer e-mail to 'USER' if username not specified
Tidy up screen message for postscript output
19-Jul-04 Added emailPsFile and emailPsAddress keywords
WRITTEN November, 2003, by Bill Davis.
Source: src/idl_cvs/plot7.pro
NAME:
plot7
PURPOSE:
plot 7 (or any number) NSTX signals on the same x-axis
CATEGORY:
NSTX, X-Y Plotting, MDSplus
USE: IDL> plot7, shot [, t1, t2]
to make 5 plots of same signal and different shots:
IDL> shots = [ 111827, 111875, 111876, 112075, 112137 ]
IDL> plot1sig,shots,signame='\wf::ip'
KEYWORDS:
all optional, but you won't like the defaults :-)
signames
labels
units
scale
ymins
ymaxes
tweenspace - fraction of screen between plots in vertical
nospace - if set, overrides tweenspace to make plots abut vertically
MODIFICATION HISTORY:
19-May-2004 Added _extra keyword & don't reverse incoming shot list
19-Apr-2004 Added support for many shots, and one signal.
11-Jan-01 Added ymin & ymax and made variables optional keywords
06-Oct-00 Written by Bill Davis for Franco Paoletti
Source: src/idl_cvs/plotblobvyvsbin.pro
NAME:
plotblobvyvsbin
PURPOSE:
plot a series of vertical velocity traces vs. time
from the blob database. Each trace will be from a horizontal
range
CATEGORY:
Blobs
CALLING SEQUENCE:
IDL> plotblobvyvsbin, shot=shot
KEYWORDS:
shot - shot (has to be in the database)
table - table in the database (name can be created from shot)
database - SQL database (default='blobs')
xBinSize - # of pixels to bin over in X (default=6)
tBinSize - time width over which to average velocities (default=0)
nSmooth - number of time points to smooth over before plotting
(default=21)
minHt - minimum normalized height for blobs to count (default=1.2)
needed - # of frames for which blob exists to count (default=2)
x1 - pixel location to start binning (defaults to min of center in data)
x2 - pixel location to stop binning
t1 - time to start data bining (default to start of times in database)
t2 - time to end binning (default to end of times in database)
VyMin - plot min (auto scales otherwise)
VyMax - plot max
colors - color indices for lines
charsize - character size for plot labels
yTitle - title for vertical axis
timeOffSet - time to add to camera times to get shot times (ms)
(can be automatically read from file for some shots)
jpeg - if set makes a jpeg in your home directory and prints the name
OUTPUTS:
just plotting
NOTES:
keywords for the PLOT command will be passed along
EXAMPLE:
IDL> plotblobvyvsbin, shot=1110114032, nSmooth=21
IDL> colors=[49,53,51,56,50,52]
IDL> plotblobvyvsbin, shot=1110114032, xbinsize=6, tBinSize=0.025, $
VyMin=-2, VyMax=3, xrange=[21,23],colors=colors, x1=25
IDL> plotblobvyvsbin, shot=1110114032, xbinsize=7, nsmooth=5, tbin=0.025, $
VyMin=-1, VyMax=1, xrange=[21,23],colors=colors, x1=25
IDL> plotblobvyvsbin, shot=1120223031, xbinsize=8, nsmooth=31, x1=32, /jpeg
WRITTEN 03-May-2012 by Bill Davis, PPPL, for Stewart Zweben
Source: src/idl_cvs/plotcolorfill.pro
NAME:
PLOTCOLORFILL
PURPOSE:
Plots colorful bar charts
CATEGORY:
Plotting
CALLING SEQUENCE:
PLOTCOLORFILL, x, y, COLOR=col, BOTTOM=bot, WIDTH=wid, ...
DESCRIPTION:
PLOTCOLORFILL plots a colorful vertical bar chart. This may be
useful in cases where two dimensions of information need to be
conveyed in one plot. [ I use it to show total intensity as a
function of time on the vertical axis, and temperature is coded
with color. ]
Most aspects of the bars are configurable. The color is specified
by an array of colors, one for each bar. [ Alternatively, a
single color for the entire plot can be given. ] Also, one color
can be designated as transparent.
Stacked bar charts can be constructed using two calls to
PLOTCOLORFILL. See the example.
INPUTS:
X, Y - Two arrays which give the X and Y position of the points.
In this style of plot, the x values should be monotonically
increasing, but not necessarily monospaced (see WIDTH).
OPTIONAL INPUTS:
NONE
INPUT KEYWORD PARAMETERS:
COLOR - an array giving the color of each bar, or alternatively a
scalar color for all of the bars. The current color table
is not changed. Default is color "1"
BOTTOM - normally the bottom of the bars is set to be zero. You
may either specify a scalar bottom value for all of the
bars, or an array giving the bottom of each bar
individually. See the example to see how stacked bar
charts can be constructed with this keyword.
WIDTH - sets the width of each bar, globally or individually.
Bars are centered on the "X" value, and extend 0.5 * WIDTH
to either side. Default is to assume monospacing, using
the separation between the first two x values.
TRANSPARENT - designates a color which is "transparent". Any bars
with this color are simply not plotted. Default is
no transparent color.
PANEL, SUBPANEL - An alternate way to more precisely specify the
plot and annotation positions. See SUBCELL.
Default is full-screen.
POSITION - Position of the bar chart in normal coordinates.
Overrides position given by PANEL/SUBPANEL.
XRANGE, YRANGE - gives plot range for each dimension, as for other
plot commands. Default is range of data.
Other keywords are passed to the plot command directly.
OUTPUTS:
NONE
PROCEDURE:
EXAMPLE:
Stacked barcharts can be constructed by first making one chart
with a flat bottom, and then a second chart whose bottom is top of
the first.
x = findgen(30)
y1 = x^2
y2 = 400.-x
c1 = bindgen(30)*3+1b
c2 = 100b-bindgen(30)*3+1b
plotcolorfill, x, y1, color=c1, bottom=0.
plotcolorfill, x, y1+y2, color=c2, bottom=y1, /noerase
SEE ALSO:
PLOTPAN
EXTERNAL SUBROUTINES:
SUBCELL, DEFSUBCELL, PLOTPAN
AUTHOR:
Craig B. Markwardt, NASA/GSFC Code 662, Greenbelt, MD 20770
craigm@lheamail.gsfc.nasa.gov
MODIFICATION HISTORY:
Written, CM, 1997
Source: src/idl_cvs/plotdash.pro
NAME:
plotdash
PURPOSE:
Plot a variety of dashed lines, even if terminal emulator doesn't for
different linestyles
CATEGORY:
2-D Plotting
CALLING SEQUENCE:
IDL> plotdash, x, y, dashfracdashfrac=, blankfrac=blankfrac
INPUTS:
x - x data to plot
y - y data to plot
KEYWORD PARAMETERS:
Optional:
dashfrac - fraction of distance (0-1) dash will be (def=0.01)
blankfrac - fraction of distance (0-1) blank will be
smallFrac - fraction of distance (0-1) for a small dash, or a dot.
OUTPUTS:
COMMON BLOCKS:
NONE
NOTES:
This will probably be slow for large numbers of points.
EXAMPLE:
x = findgen(100)
y = sin(x/5)
plotdash, x, y
plotdash, x, y, dashfrac=.02, blankfrac=.01
oplotdash, x, y/2, dashfrac=.02, blankfrac=.01, color=mk_color('red')
y = randomu(seed,100)
plotdash, x, y
plotdash, x, y, dashfrac=.02, smallFrac=0.005, blankfrac=.002
plotdash, x, y, dashfrac=.02, smallFrac=0.002, blankfrac=.005
MODIFICATION HISTORY:
17-Apr-2012 added smallFrac keyword, so can have dot-dash style lines
16-Apr-2012 Written by Bill Davis, PPPL
Source: src/idl_cvs/plothist.pro
NAME:
PLOTHIST
PURPOSE:
Plot the histogram of an array with the corresponding abcissa.
CATEGORY:
Plotting
CALLING SEQUENCE:
plothist, arr, xhist, yhist, [, BIN=, /FILL, /NOPLOT, /OVERPLOT, PEAK=,
...plotting keywords]
INPUTS:
arr - The array to plot the histogram of. It can include negative
values, but non-integral values will be truncated.
OPTIONAL OUTPUTS:
xhist - X vector used in making the plot
( = lindgen( N_elements(h)) * bin + min(arr) )
yhist - Y vector used in making the plot (= histogram(arr/bin))
OPTIONAL INPUT KEYWORDS:
BIN - The size of each bin of the histogram, scalar (not necessarily
integral). If not present (or zero), the bin size is set to 1.
/NOPLOT - If set, will not plot the result. Useful if intention is to
only get the xhist and yhist outputs.
/OVERPLOT - If set, will overplot the data on the current plot. User
must take care that only keywords valid for OPLOT are used.
PEAK - if non-zero, then the entire histogram is normalized to have
a maximum value equal to the value in PEAK. If PEAK is
negative, the histogram is inverted.
/FILL - if set, will plot a filled (rather than line) histogram.
The following keywords take effect only if the FILL keyword is set:
FCOLOR - color to use for filling the histogram
/FLINE - if set, will use lines rather than solid color for fill (see
the LINE_FILL keyword in the POLYFILL routine)
FORIENTATION - angle of lines for fill (see the ORIENTATION keyword
in the POLYFILL routine)
FPATTERN - the pattern to use for the fill (see the PATTERN keyword
in the POLYFILL routine)
FSPACING - the spacing of the lines to use in the fill (see the SPACING
keyword in the POLYFILL routine)
Any input keyword that can be supplied to the PLOT procedure (e.g. XRANGE,
LINESTYLE) can also be supplied to PLOTHIST.
EXAMPLE:
Create a vector of random 1000 values derived from a Gaussian of mean 0,
and sigma of 1. Plot the histogram of these values with a bin
size of 0.1
IDL> a = randomn(seed,1000)
IDL> plothist,a, bin = 0.1
MODIFICATION HISTORY:
09-Feb-2012 fixed use of xrange
08-Feb-2012 added ymax output keyword
Written W. Landsman January, 1991
Add inherited keywords W. Landsman March, 1994
Use ROUND instead of NINT W. Landsman August, 1995
Add NoPlot and Overplot keywords. J.Wm.Parker July, 1997
Add Peak keyword. J.Wm.Parker Jan, 1998
Add FILL,FCOLOR,FLINE,FPATTERN,FSPACING keywords. J.Wm.Parker Jan, 1998
Converted to IDL V5.0 W. Landsman 21-Jan-1998
Source: src/idl_cvs/plotnormalw.pro
NAME:
plotnormal
PURPOSE:
plot a normal curve on top of a histogram of data
CATEGORY:
Plotting, Statistics, GUI
CALLING SEQUENCE:
plotnormalw, data, BinSize=binsize, barFraction=barFrac, $
title=title, NormalOverlay=NormalOverlay, $
WindowTitle=WindowTitle, GROUP_LEADER=group_leader, $
XSIZE=xsize_in, YSIZE=ysize_in, xtitle=xtitle, ytitle=ytitle, $
_extra=_extra
INPUTS:
data - 1-d array
OUTPUTS:
plot in graphics widget
KEYWORDS:
barFraction - fraction of interval over which bar is drawn (0-1)
(default=0.5)
BinSize - The size of each bin of the histogram, scalar (not necessarily
integral). If not present (or zero), the bin size is set to 1.
NormalOverlay - if set, overlay a curve of the normal distribution
EXAMPLE:
IDL> data=randomN(seed, 100)
IDL> plotnormalw, data, binsize=.5
MODIFICATION HISTORY:
25-Apr-2003 don't try to plot null values (as defined by SQL, too)
March, 2003 Written by Bill Davis
Source: src/idl_cvs/plotnshots.pro
NAME:
plotnshots
PURPOSE: make scope-like plots with overlays from multiple shots.
CATEGORY:
Plotting
USAGE:
IDL> plotnshots, shots, t1=t1, t2=t2, signames=signames, $
tweenspace=tweenSpace, labels=labels, $
titles=titles, scales=scales, $
rightSpace=rightSpace, leftSpace=leftSpace, colSpace=colSpace, $
pcharsize=pcharsize, bgtime=bgtime, ncols=ncols, nrows=nrows, $
biglabel=biglabel, nSmooth=nSmooth, $
SigUnits=SigUnits, topLabel=topLabel, zeroPlot=zeroPlot, $
yMins=yMins, yMaxes=yMaxes, SERVERNAMES=serverNames, noLogo=noLogo, $
anyProblem=anyProblem, sameXlabels=sameXlabels
METHOD: Reads in all requested shots for a signal, so can autoscale plot
correctly. One big 1-D array created by appending new signals, so
signals with different # of points, sampling rate, etc., will work.
EXAMPLE:
IDL> plotnshots, [104500,104501], $
signames=['\wf::ip','\engineering::ip1']
LIMITATIONS:
If max of X-data is > 100, assume not time and plot separately.
HISTORY:
09-Oct-2012 added EveryOther keyword for Y-axes
24-Jul-2012 a serious bug fixed when plotting a row or column of 1 2-D signal
against another with different axes.
05-May-2011 added ability to call user-written IDL routines in place of
signal names.
26-May-2010 added xstart, xdelta, xInTimeFormat keywords for HH:MM display option
26-Apr-2010 check for availability of SIGMATH TDI before usings
make order of plots from scope like in scopes
22-Apr-2010 added dateOnPlot and showMissingTags keywords
31-Aug-2009 fixed logic when some tree names missing and multiple shots [BD]
15-Nov-2008 if ymins or ymaxes are a scalar, use for all signals [BD]
03-Jul-2008 put plot order back to list of devices, and to scope order
changed "tween" space to be constant.
19-May-08 Fixed xticklen and xgridstyle use
07-Nov-07 add option to have TOPLABEL='NONE' for no plot titles
03-Oct-07 added /noshot keyword to EvalScopeTitle call
10-Aug-07 if t2 < t1, set=t1
01-May-07 Added keyword 'ShowAllXvalues' to label all X axes
06-Apr-07 get right default axis if plotting second dimension of 2-D array
07-Mar-07 continued _extra keyword into all plotting routines, so things
thick=3 in the Expert Entry field on the web tools will work.
28-Jul-06 remove auto scale if limits 1.e-5 difference
01-Mar-06 set default to be suppresserrors=0 because typos causing confusion.
changed MISSING DATA label
30-Jan-06 (re-)fixed specifed colors for multiple shots.
27-Jan-06 use x signal from scope, if present
06-Sep-2005 added SuppressError keyword
03-Aug-2005 allow colors to be input as an array or executable string
20-May-02 - In autoscale X, force all x-axis to plot on largest x scale.
also changed value indicating time (actually, meaning ranges
won't be used) changed from 100 to 300.
02-Jul-01 - convert from plot2shots, and plot 2-D images when 1 shot
28-Jun-01 - added anyProblem keyword, and sameXlabels keyword to
allow forcing time axis ticknames on plot
18-May-01 - added vplot & ovplot for "visual compression"
06-Mar-01 - added Yrange & made t1 & t2 be arrays
06-Feb-02 - put back ability to display 2-D
Source: src/idl_cvs/plotnsigs.pro
NAME:
plotnsigs
PURPOSE:
make scope-like plots with overlays from multiple signals.
this is the version of plotnshots that overlays different signals
on the same axes
CATEGORY:
Plotting
USAGE:
IDL> plotnsigs, shots, t1=t1, t2=t2, signames=signames, $
tweenspace=tweenSpace, labels=labels, $
titles=titles, scales=scales, $
rightSpace=rightSpace, leftSpace=leftSpace, colSpace=colSpace, $
pcharsize=pcharsize, bgtime=bgtime, ncols=ncols, nrows=nrows, $
biglabel=biglabel, nSmooth=nSmooth, $
SigUnits=SigUnits, topLabel=topLabel, zeroPlot=zeroPlot, $
yMins=yMins, yMaxes=yMaxes, SERVER=server, noLogo=noLogo, $
anyProblem=anyProblem, sameXlabels=sameXlabels
METHOD: Reads in all requested shots for a signal, so can autoscale plot
correctly. One big 1-D array created by appending new signals, so
signals with different # of points, sampling rate, etc., will work.
EXAMPLE:
IDL> plotnsigs, [104500,104500,104501,104501], $
signames=['\wf::ip','\engineering::ip1','\wf::ip','\engineering::ip1']
LIMITATIONS:
If 2-D data, will just take the first row for multiple plots.
If max of X-data is > 100, assume not time and plot separately.
HISTORY:
15-Aug-2013 had to do more work on labels and many plots in a frame
01-Aug-2013 fix bug on last right axis when many shots on a frame
Allow use of ctb -1 for a better rainbow pallete.
25-Jul-2013 when many shots and many sigs, by default, make a frame for each
sig with all the shots.
07-Nov-07 add option to have TOPLABEL='NONE' for no plot titles
31-Jul-07 created from plotnshots [BD]
Source: src/idl_cvs/plotscope.pro
NAME:
plotscope
PURPOSE:
make scope-like plots, optionally with overlays from multiple shots.
CATEGORY:
MDSplus, SCOPE
CALLING SEQUENCE:
IDL> plotscope, shots=shots, scope=scope
INPUTS:
shots - scalar or array of shot numbers, e.g. [104500,104501]
scope - name of scope input filename (else will get a dialog box)
RETURNED:
None
KEYWORDS:
(All Optional) Inputs:
t1 - starting time desired. Defaults to scope value
t2 - ending time desired. Defaults to scope value
refshot - a reference shot to be overplotted.
SameXlabels - If set and non-zero, just label x-axis at bottom
(This reserves less vertical space between plots)
NRows - Maximum number of rows.
NCols - Number of columns (default is to compute from rows & # sigs)
nSmooth - # for median smoothing before using signal (default=0)
pCharSize - Value desired for !P.CHARSIZE, else guesses
Titles - string array of the plot titles from the scope file, else y-name
xMins - array of each plot's x-minimum from the scope file (else global, or 0)
xMaxes - array of each plot's x-maximum from the scope file (else global, or 0)
yMins - array of each plot's y-minimum from the scope file (else global, or 0)
yMaxes - array of each plot's y-maximum from the scope file (else global, or 0)
tweenspace - vertical space between plots in normalized coordinates
colSpace - horizontal space between plots in normalized coordinates
rightSpace - space on right in normalized coordinates
leftSpace - space on left in normalized coordinates
EXAMPLE:
(Send plots to a Tektronix window, say, from on a Mac from VersaTerm):
IDL> setup_tek
IDL> plotscope, shots=104500, refshot=104501, scope='WF'
IDL> unsetup_tek
(Make a scope-like plot without space between plots
-- the tick labels are outside their grids, unlike in Scope)
IDL> plotscope,shot=105830,scope='wf',tweenspace=0,colspace=0
COMMON BLOCKS:
none
NOTES:
LIMITATIONS:
MODIFICATION HISTORY:
24-Aug-01 Written by Bill Davis
Source: src/idl_cvs/plotsig1vssig2.pro
NAME:
plotSig1vsSig2
PURPOSE: plot 1 MDSplus signal vs. another
CATEGORY:
Plotting
USAGE:
IDL> plotSig1vsSig2, shots, t1=t1, t2=t2, signames=signames, $
labels=labels, $
titles=titles, scales=scales, $
rightSpace=rightSpace, leftSpace=leftSpace, colSpace=colSpace, $
pcharsize=pcharsize, $
biglabel=biglabel, nSmooth=nSmooth, $
SigUnits=SigUnits, topLabel=topLabel, zeroPlot=zeroPlot, $
yMins=yMins, yMaxes=yMaxes, SERVER=server, noLogo=noLogo, $
anyProblem=anyProblem, sameXlabels=sameXlabels EXAMPLE:
IDL> plotSig1vsSig2, 116116, signames=['\wf::ip','\wf::itf']
LIMITATIONS:
HISTORY:
06-Mar-06 Added HH:MM output option. Also, make title Y vs. X.
09-Sep-05 Converted from plotnshots [BD]
Source: src/idl_cvs/plotsummary.pro
NAME:
plotsummary
PURPOSE:
Plot vs. time a summary of a shot (Ip, D-alpha, Pinj) in a small frame
CATEGORY:
Plotting
CALLING SEQUENCE:
IDL> plotsummary, shot
INPUTS:
shot - shot # (defaults to current shot)
KEYWORD PARAMETERS:
Optional Keywords:
tois - times of interest at which a dashed vertical line will be drawn
xsize -
ysize -
verbose -
debug -
labelShot -
signames -
pos -
minIP -
x1 -
y1 -
xfrac -
yFrac -
charsize -
charThick -
thick -
xmargin -
widthFactor - if set, ysize = xsize * widthFactor
OUTPUTS:
NONE
COMMON BLOCKS:
NONE
EXAMPLE:
IDL> plotsummary, 119923
NOTES:
Used in animation generators, amoung others. Has thicker lines than
plotsummary4.pro.
webplotsum.pro is an upgrade of this routine.
MODIFICATION HISTORY:
pre-2008 Written by Bill Davis, PPPL
Source: src/idl_cvs/plotsummary4.pro
NAME:
PlotSummary4
PURPOSE:
Plot vs. time a summary of a shot (Ip, D-alpha, Pinj, Wmhd) in a small frame
CATEGORY:
Plotting
CALLING SEQUENCE:
IDL> PlotSummary4, shot
INPUTS:
shot - shot # (defaults to current shot)
KEYWORD PARAMETERS:
Optional Keywords:
tois - times of interest at which a dashed vertical line will be drawn
xsize -
ysize -
verbose -
debug -
labelShot -
signames -
pos -
minIP -
x1 -
y1 -
xfrac -
yFrac -
charsize -
charThick -
thick -
xmargin -
widthFactor - if set, ysize = xsize * widthFactor
OUTPUTS:
NONE
COMMON BLOCKS:
NONE
EXAMPLE:
IDL> plotsummary4, 119923
NOTES:
webplotsum.pro is an upgrade of this routine.
MODIFICATION HISTORY:
13-Mar-2008 handle missing ptot
04-Mar-2008 Written by Bill Davis, PPPL, for Stan Kaye
Source: src/idl_cvs/plotsym.pro
NAME:
PLOTSYM
PURPOSE:
Define useful plotting symbols not in the standard !PSYM definitions.
CATEGORY:
Plotting
EXPLANATION:
After a symbol has been defined with PLOTSYM, a plotting command should
follow with either PSYM = 8 or !P.PSYM = 8 (see USERSYM)
CALLING SEQUENCE:
PLOTSYM, PSYM,[ PSIZE, /FILL, THICK=]
INPUTS:
PSYM - The following integer values of PSYM will create the
corresponding plot symbols
0 - circle
1 - downward arrow (upper limit), base of arrow begins at plot value value
2 - upward arrow (lower limt)
3 - 5 pointed star
4 - triangle
5 - upside down triangle
6 - left pointing arrow
7 - right pointing arrow
8 - square
Arrows are defined such that their base begins at their origin.
OPTIONAL INPUTS:
PSIZE - Size of the plotting symbol in multiples of the default size
(default PSIZE=1). Does not need to be an integer
OPTIONAL INPUT KEYWORD:
FILL - Parameter indicating whether to fill the symbol (see USERSYM)
The default is 0, unfilled symbol. Does not affect arrows
or character symbols.
THICK - Thickness of unfilled symbols. Default is 1.
OUTPUTS:
None
EXAMPLES:
Plot Y vs. X with filled stars as the symbol, twice the default size
IDL> PLOTSYM, 3 ,2, /FILL ;Plotting symbol is a filled star,
;twice default size
IDL> PLOT,X,Y,PSYM=8 ;Set PSYM = 8 to get star symbol
Now plot Y vs. X with an open circle as the symbol
IDL> PLOTSYM, 0 ;Plotting symbol is a circle
IDL> PLOT,X,Y,PSYM=8
METHOD:
Appropriate X,Y vectors are used to define the symbol and passed to the
USERSYM command.
REVISION HISTORY
27-Jan-2010 added circle, square, triangle, arrow, and size keywords
25-Feb-2005 added keyword usersym, for sending to Legend, for example [BD]
Written W. Landsman June 1992
18-JAN-1996 Added a square symbol, HCW.
98Aug20 Added keyword thick parameter - RCB.
Source: src/idl_cvs/plottsfont0.pro
NAME:
plottsfont0
PURPOSE:
This procedure will plot the fitted profiles of
electron temperature,density, and presssure from the
NSTX Multi-Pulse Thomson Scattering (MPTS) diagnostic.
CALLING SEQUENCE:
plottsfont0,TS1[,TS2]
INPUTS:
TS1 = structure containing Thomson data for shot
TS2 = structure containing Thomson data for second shot (optional)
KEYWORDS:
(INPUT)
Tplot = vector of times to plot profiles (default = all times)
(if multiple shots only first time point is used)
/NB = if set, add neutral beam power to time history plot
/RF = if set, add HHFW power to time history plot
/MHD = if set, add Mirnov trace to time history
/Vloop = if set, add loop voltage to time history plot
/Mld = if set, add microwave line density to time history
/HA = if set, add hydrogen alpha signal to time history
/USXR = if set, add ultra-soft x-ray signal to time history
/Wmhd = if set, add EFIT Total energy (Wmhd) to time history
/Tf = if set, add TF current to time history
/Qmin = if set, add qmin to time history
/Q95 = if set, add q95 to time history
Temax = value of maximum Te to plot [ keV]
Nemax = value of maximum Ne to plot [1e13 /cm^3]
Pemax = value of maximum Pe to plot [kPa]
Nelmax = value of maximum NeL to plot [1e15 /cm^2]
Big = make single large plot of :
1 - Te, 2 - Ne, 3 - Pe, 4 - time history
/CHI = if set, changes plotting defaults to values appropriate
to lower temperature plasmas
/Nospline = set to connect data with straight lines instead of splines.
Rrange = two element vector to set radial range of plot [Rmin, Rmax]
Chrsz = sets size of characters in plot
/Fancy = sets Font to Triplex Roman
Tmax = set maximum value of time in plot
Pk = set Te(t) to peak value of spline
Efit = value of EFIT tree to use '1,2,3,4,5'
(OUTPUT)
Rescale = ratio of axis scales on time history plot
Pt = actual times selected for profile plots
ADDITIONAL FEATURES:
In the last plot, the time history of the line density from
integrating the Thomson data is displayed as a series of solid
symbols (circles). If multiple times are plotted, they are color
coded to symbols on the line density plot. The time history of the
central electron temperature is also plotted.
When using multiple shots, data from the first shot will be
plotted with solid lines, the second shot's data will be dashed.
EXAMPLES:
To restore data for a particular shot, the function TS.pro
can be used. To plot profiles at all times the Tplot keyword
can be set to All().
For example, to plot the Thomson data for shot 104313 at all
times along with the Neutral beam power and the Halpha data:
plottsfont0,ts(104313),tplot=all(),/nb,/ha
To plot the difference between two shots at the same time:
plottsfont0,ts(104487),ts(104485),tplot=.2,/rf
To make a larger plot of only the the electron temperature:
plottsfont0,ts(104487),ts(104485),tplot=.2,big=1
RESTRICTIONS:
This procedure will modify the color table by using the
command TEK_COLOR to change the first 16 (32?) colors.
MODIFICATION HISTORY:
26-Sep-2008 added font keyword for Roger Raman [BD]
Written by R. E. Bell, PPPL, 2000
Added CHI and NoSpline keywords, REB, 29-Aug-2001
Added Wmhd keyword, changed mhd scaling, REB, 26-Feb-2002
Updated TS function , REB, 31-Jan-2003
Modified treatement of MHD plot, REB, 31-Jan-2003
Modified to designate EFIT tree to use with EFIT keyword. REB 20-Oct-2003
Added X windows adjustment to 'Z' plot type, REB 17-Nov-2003
Fixed bugs in timing for multiple shots, REB 17-Nov-2003
Source: src/idl_cvs/plottswall.pro
NAME:
PLOTTSwall
PURPOSE:
This procedure will plot the fitted profiles of
electron temperature and density from the
NSTX Multi-Pulse Thomson Scattering (MPTS) diagnostic.
CALLING SEQUENCE:
PLOTTSwall,TS1[,TS2]
INPUTS:
TS1 = structure containing Thomson data for shot
TS2 = structure containing Thomson data for second shot (optional)
KEYWORDS:
(INPUT)
Tplot = vector of times to plot profiles (default = all times, multiple times: first time pt.)
T2plot = plot times for second shot (default to first time of Tplot if not specified)
/Plot_IP = if=0, do not have Ip plot on graph
/NB = if set, add neutral beam power to time history plot
/RF = if set, add HHFW power to time history plot
/MHD = if set, add Mirnov trace to time history
/Vloop = if set, add loop voltage to time history plot
/Mld = if set, add microwave line density to time history
/HA = if set, add hydrogen alpha signal to time history
/USXR = if set, add ultra-soft x-ray signal to time history
/Wmhd = if set, add EFIT Total energy (Wmhd) to time history
/Tf = if set, add TF current to time history
/Qmin = if set, add qmin to time history
/Q95 = if set, add q95 to time history
Temax = value of maximum Te to plot [ keV]
Nemax = value of maximum Ne to plot [1e13 /cm^3]
Pemax = value of maximum Pe to plot [kPa]
Nelmax = value of maximum NeL to plot [1e15 /cm^2]
Temin = value of minimum Te to plot [ keV]
Nemin = value of minimum Ne to plot [1e13 /cm^3]
Pemin = value of minimum Pe to plot [kPa]
Nelmin = value of minimum NeL to plot [1e15 /cm^2]
Big = make single large plot of :
1 - Te, 2 - Ne, 3 - Pe, 4 - time history
/CHI = if set, changes plotting defaults to values appropriate
to lower temperature plasmas
/Nospline = set to connect data with straight lines instead of splines.
Rrange = two element vector to set radial range of plot [Rmin, Rmax]
Chrsz = sets size of characters in plot
/Fancy = sets Font to Triplex Roman
Tmax = set maximum value of time in plot
Pk = set Te(t) to peak value of spline
Efit = value of EFIT tree to use '1,2,3,4,5'
(OUTPUT)
Rescale = ratio of axis scales on time history plot
Pt = actual times selected for profile plots
P2t = actual time selected for second shot
ADDITIONAL FEATURES:
In the last plot, the time history of the line density from
integrating the Thomson data is displayed as a series of solid
symbols (circles). If multiple times are plotted, they are color
coded to symbols on the line density plot. The time history of the
central electron temperature is also plotted.
When using multiple shots, data from the first shot will be
plotted with solid lines, the second shot's data will be dashed.
EXAMPLES:
RESTRICTIONS:
MODIFICATION HISTORY:
04-Jun-2013 add Plot_Ip keyword
13-Dec-2010 adjust shifts of colored labels for other device types
02-Aug-2010 color code Y-axes labels
30-Jul-2010 modified from plotts.pro by Bill Davis to pass _extra
keyword on plot 4.
Written by R. E. Bell, PPPL, 2000
Added CHI and NoSpline keywords, REB, 29-Aug-2001
Added Wmhd keyword, changed mhd scaling, REB, 26-Feb-2002
Updated TS function , REB, 31-Jan-2003
Modified treatement of MHD plot, REB, 31-Jan-2003
Modified to designate EFIT tree to use with EFIT keyword. REB 20-Oct-2003
Added X windows adjustment to 'Z' plot type, REB 17-Nov-2003
Fixed bugs in timing for multiple shots, REB 17-Nov-2003
Added keyword T2plot for selecting distinct time for second shot,
REB 31-Mar-2006
Added valid array to ts function, REB 12-Dec-2008
Source: src/idl_cvs/poly_smooth.pro
NAME:
poly_smooth
PURPOSE:
Reduce noise in 1-D data (e.g. time-series, spectrum)
but retain dynamic range of variations in the data by
applying a least squares smoothing polynomial filter,
also called the Savitzky-Golay smoothing filter.
The low-pass filter coefficients are computed by effectively
least-squares fitting a polynomial in moving window,
centered on each data point, so the new value will be the
zero-th coefficient of the polynomial. Approximate first derivates
of the data can be computed by using first degree coefficient of
each polynomial, and so on. The filter coefficients for a specified
polynomial degree and window width are computed independent of any
data, and stored in a common block. The filter is then convolved
with the data array to result in smoothed data with reduced noise,
but retaining higher order variations (better than averaging).
CATEGORY:
Smoothing, Math
CALLING SEQUENCE:
spectrum = poly_smooth( data, width, DEGREE=4 )
INPUTS:
data = 1-D array, such as a spectrum or time-series.
width = total number of data points to use in filter convolution,
(default = 5, using 2 past and 2 future data points),
must be larger than DEGREE of polynomials, and a guideline is
make WIDTH between 1 and 2 times the FWHM of desired features.
KEYWORDS:
DEGREE = degree of polynomials to use in designing the filter
via least squares fits, (default DEGREE = 2), and
the higher degrees will preserve sharper features.
NLEFT = # of past data points to use in filter convolution,
excluding current point, overrides width parameter,
so that width = NLEFT + NRIGHT + 1. (default = NRIGHT)
NRIGHT = # of future data points to use (default = NLEFT).
DERIV_ORDER = order of derivative desired (default = 0, no derivative).
COEFFICIENTS = optional output of the filter coefficients applied,
but they are all stored in common block for reuse, anyway.
RESULTS:
Function returns the data convolved with polynomial filter coefs.
COMMON BLOCKS:
common poly_smooth, degc, nlc, nrc, coefs, ordermax
PROCEDURE:
As described in Numerical Recipies, sec.14.8, Savitsky-Golay filter.
Matrix of normal eqs. is formed by starting with small terms
and then adding progressively larger terms (powers).
The filter coefficients of up to derivative ordermax are stored
in common, until the specifications change, then recompute coefficients.
Coefficients are stored in convolution order, zero lag in the middle.
MODIFICATION HISTORY:
Written, Frank Varosi NASA/GSFC 1993.
Source: src/idl_cvs/populateblobs.pro
NAME:
populateblobs
PURPOSE:
Read a file created from fcplayer.pro with columns of blob
characteristics vs time. compute frame-to-frame statistics like x & y
velocity and duration, based on "reasonableness" factors, like maximum
movement per frame allowed. Velocities are recomputed after parent-child
relationships determined, so the velocity tracks can be smoothed.
(loadblobs.pro can be used for all the steps needed to populate the
database.)
CATEGORY:
Blobs
CALLING SEQUENCE:
IDL> populateblobs, filename=filename, table=table
INPUTS:
-------
filename - name of input file produced from FCplayer.
database - SQL database (server maintained by Tom Carroll) for blobs,
DEF='blobs'
make - if set, will try to create datbase table (if already exists, will
complain, but no harm done)
table - table name in database of blobs for a period within a shot, or
shot - will assume table is named 'SH'+shot
maxJump - max # of pixel to change per frame to be considered same blob
(DEF=10)
minFrames - minimum # of contigous frames blob must be identified to
be considered (DEF=3)
maxArea max area change (sq. pixels) per frame to be considered same blob
outFileName - if present, will write data to a table-delimited file
rather than an SQL database
BlobCriteria - structure for blob criteria, like min normalized height, etc.
(just for writing to the output "database" file.)
verbose - if set, lots of information output listed
debug - if set, will output even more and may stop at some spots
EXAMPLES:
filename='shot_1120815034m_blobs_1150-1153ms.txt'
outfile='shot_1120815034m_out.txt'
populateblobs, filename=filename, table=table, /deletefirst, $
timeoffset=0, shot=1120815034, outfile=outfile, $
/verb, doRhos=0
filename='shot_1120224022x_blobs_1044-1048ms.txt'
table = 'SH1120224022x'
populateblobs, filename=filename, table=table, /verb, /deletefirst, $
timeoffset=0, shot=1120224022
filename='/u/bdavis/cvs/idl_cvs/shot_1120815021Fake_blobs_80-80ms.txt'
table = 'FakeShot'
populateblobs, filename=filename, table=table, /verb , /make
filename='/u/bdavis/cvs/idl_cvs/shot_1091216028_blobs_0-20ms.txt'
table = 'SH1091216028'
populateblobs, filename=filename, table=table, /verb , /make
filename='/u/bdavis/cvs/idl_cvs/shot_1091216029_blobs_0-20ms.txt'
table = 'SH1091216029'
populateblobs, filename=filename, table=table, /verb , /make
filename='nstx_5_138234_blobs_530-550ms.txt'
table = 'SH138234'
populateblobs, filename=filename, table=table, /verb , /make
filename='nstx_5_138128_blobs_280-300ms.txt'
table = 'SH138128'
populateblobs, filename=filename, table=table, /verb, /deleteFirst , /debug
filename='nstx_5_142200_blobs_280-300ms.txt'
table = 'SH138128'
populateblobs, filename=filename, table=table, /verb , /make
filename='nstx_5_141751_blobs_200-220ms.txt'
table = 'SH141751'
populateblobs, filename=filename, table=table, /verb , /make
--- to write out a file that Stewart can read in Kalideograph:
filename='nstx_5_138234_blobs.txt'
populateblobs, filename=filename, out=filename+'OUT', /verb
NOTES
see CheckBlobVel.txt for validation case
MODIFICATION HISTORY:
10-Oct-2012 BD compute XfromSep at each time step
20-Sep-2012 BD back to no negative ellipticity.
Tilt stored in degrees, from PI/2 (straight up) to -Pi/2 (down)
and zero tilt is horizontal
04-Sep-2012 BD changed def of ellipticity, so can have < 1.
ellip = Major Radius/Minor Radius, if tilt between pi/4 and
3pi/4, then make ellipticity negative.
29-Aug-2012 BD added ellip, ellipHM and Rho (R-Rsep at midplane)
17-May-2012 BD several updates to receive parameters to output to file
06-Jan-2012 BD changing velocities from pixels/frame to Km/s. Adding column
in databases for x distance to the separatrix.
WRITTEN 2-Feb-2011 by Bill Davis for Stewart Szweben
Source: src/idl_cvs/pppl_printers.pro
NAME:
PPPL_Printers
PURPOSE:
return an array of strings of printer descriptions at PPPL
CATEGORY:
Printing
CALLING SEQUENCE:
printer_list = PPPL_Printers()
INPUTS:
StartShot - shot number to start from in
KEYWORD PARAMETERS:
Inputs:
FILENAME - name of file to read printer descriptions from
an example of an entry in the file is:
crc-color - Color printer in B152
JUSTPRINTERS - if set, just return the names of the printers
OUTPUTS:
printer_list - String Array
EXAMPLE:
printer_list = PPPL_Printers()
COMMON BLOCKS:
NOTES:
On VMS, the file read is PRINTERS_VMS.txt, on Unix it is
PRINTERS_UNIX.txt. Returns a blank for other systems.
If environmental variable local_idl_dir is defined, this routine
will look for the file in this area
MODIFICATION HISTORY:
18-May-2004 add 'not implemented' for windows, and which not working
09-Jun-2003 If not on Unix or VMS, return a blank.
26-Mar-1999 Written by Bill Davis
Source: src/idl_cvs/prime.pro
NAME:
PRIME
PURPOSE:
Return an array with the specified number of prime numbers.
CATEGORY:
Math
EXPLANATATION:
This procedure is similar to PRIMES in the standard IDL distribution,
but stores results in a common block, and so is much faster
CALLING SEQUENCE:
p = prime(n)
INPUTS:
n = desired number of primes, scalar positive integer
OUTPUTS:
p = resulting array of primes, vector of positive integers
COMMON BLOCKS:
prime_com
NOTES:
Note: Primes that have been found in previous calls are
remembered and are not regenerated.
MODIFICATION HISTORY:
R. Sterner 17 Oct, 1985.
R. Sterner, 5 Feb, 1993 --- fixed a bug that missed a few primes.
Converted to IDL V5 March 1999
Copyright (C) 1985, 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/printscope.pro
NAME:
printscope
PURPOSE:
print scope-like output, using a scope file as input
CATEGORY:
MDSplus, Printing Plots
KEYWORD INPUTS:
shots - a string indicating shots,
e.g., 107694 108305 108330-108350
or 108100+20
(this returns shots 108100, 108101,...,108120)
scopeFile - if not specified will prompt
printer - if not specified will prompt on Unix
rightSpace - fractioanal space to right of last plot (0-1)
leftSpace - fractioanal space to left of first plot (0-1)
colSpace - fractioanal space between plot columns (0-1)
vertSpace - fractioanal space between plot rows (0-1)
t1 - start time of plots (sec)
t2 - end time of plots (sec)
nRows - # of rows of plots
nCols - # of columns of plots
noprint - if set, will not send plot to printer
EXAMPLE:
(on Unix:)
printscope,shots='109071-109075',scope='wf.scope',printer='nstx-xn4525'
or
printscope,shots='109071+5' ; (will be prompted for file & printer)
or
printscope, shots='109070+2',scope='/u/kaye/Scope/sk.scope', $
leftspace=.07, rightspace=0.005, $
tweenspace=0.008, vertSpace = 0.03, $
nrows=8, ncols=4, $
printer='nstx-xn4525', charsize=1.3
HISTORY:
Written by Bill Davis for Stan Kaye, jan, 2003
Source: src/idl_cvs/print_path.pro
NAME:
print_path
PURPOSE:
prints component directories of an IDL path string.
CATEGORY:
Utility, Programming
CALLING SEQUENCE:
print_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.
IF not present, uses !PATH
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: BREAK_PATH()
REVISION HISTORY:
Source: src/idl_cvs/progressw.pro
NAME:
progressw
PURPOSE:
show progress bar until done, or the user clicks the STOP button.
USE:
customize for your use for progress indications.
CATEGORY:
Demo; Real Time applications
CALLING SEQUENCE:
IDL> done = progressw( seconds )
INPUTS:
seconds - total seconds for finish
KEYWORD PARAMETERS:
Optional:
print - if set, will print time elapsed
waitSeconds - seconds to wait (pause) after a timer event is fielded
default = 1/2 second.
xsize - length in pixels of progress bar
ysize - width in pixels of progress bar
group_leader - higher level widget to place this on top of
OUTPUTS:
done - 1, if time expired, or 0 if user hit STOP
COMMON BLOCKS:
NONE
EXAMPLE:
IDL> done = ProgressW( 20 ) ; seconds expected for motor to run
IDL> IF NOT done THEN stopmotor
RELATED ROUTINE:
BarometerW
NOTES:
Only works on X.
MODIFICATION HISTORY:
19-Jul-00 Written by Bill Davis
Source: src/idl_cvs/proname.pro
NAME:
PRONAME
PURPOSE:
This function retrieves the name of the currently active procedure.
CATEGORY:
Programming
INPUTS:
none
OUTPUT:
The output is a string containing the name of the procedure
KEYWORD:
pr0; set kw to genetae a prompt corresponding to proname.
MODIFICATION HISTORY:
16-Aug-2010 fixed a case where name was 3rd word
10-Apr-2007 Added prompt 'pr0' keyword [BPL]
20-Aug-07 add checks for array length (when window too narrow,
array elements are not right)
Written by B.P. LeBlanc following a hint by Bill Davis, 01-DEC-2006
Source: src/idl_cvs/psf_gaussian.pro
NAME:
PSF_GAUSSIAN
PURPOSE:
Create a 1-d, 2-d, or 3-d Gaussian with specified FWHM, center
CATEGORY:
Math
EXPLANATION:
Return a point spread function having Gaussian profiles,
as either a 1D vector, a 2D image, or 3D volumetric-data.
CALLING SEQUENCE:
psf = psf_Gaussian( NPIXEL=, FWHM= , [/NORMALIZE, /ST_DEV, )
or:
psf = psf_Gaussian( parameters, NPIXEL = )
REQUIRED INPUT KEYWORD:
NPIXEL = number pixels for each dimension, specify as an array,
or just one number to make all sizes equal.
OPTIONAL KEYWORDS:
NDIMEN = dimension of result: 1 (vector), 2 (image), or 3 (volume),
default = 2 (an image result).
FWHM = the desired Full-Width Half-Max (pixels) in each dimension,
specify as an array, or single number to make all the same.
CENTROID = pixels numbers of PSF maximum ( 0.5 is center of a pixel ),
default is exact center of requested vector/image/volume.
STDEV = optional way to specify width by standard deviation param.
XY_CORREL = scalar between 0 and 1 specifying correlation coefficient
Use this keyword, for example, to specify an elliptical
gaussian oriented at an angle to the X,Y axis
/NORMALIZE causes resulting PSF to be normalized so Total( psf ) = 1.
INPUTS (optional):
parameters = an NDIMEN by 3 array giving for each dimension:
[ maxval, center, stdev ], overrides other keywords.
EXAMPLE:
Create a 31 x 31 array containing a normalized centered gaussian
with an X FWHM = 4.3 and a Y FWHM = 3.6
IDL> array = PSF_GAUSSIAN( Npixel=31, FWHM=[4.3,3.6], /NORMAL
EXTERNAL CALLS:
function Gaussian
HISTORY:
Written, Frank Varosi NASA/GSFC 1991.
Converted to IDL V5.0 W. Landsman September 1997
Source: src/idl_cvs/psiinterp.pro
NAME:
psiinterp
PURPOSE:
From EFIT or LRDfit, get psi of a flux surface contour at a
particular shot and time and R & Z. Then, find the R position of
that same psi value at Z=0.
CATEGORY:
EFIT, 2-D Plotting, NSTX
CALLING SEQUENCE:
IDL> PsiWant = psiinterp( shot, time, Rwant=Rwant, Zwant=Zwant )
INPUTS:
shot = nstx shot number
time - time desired in seconds (will pick closest in tree)
OUTPUTS:
PsiWant - psi at Rwant & Zwant
KEYWORD PARAMETERS:
Inputs:
Rwant & Zwant - arrays of R & Z at which Psi is wanted
efitVersion - 1-6. Defaults to 2 (if not available, the highest of
contiguous versions will be used. E.g., if 1,2,5 are
available and 3 is requested, 2 will be used).
LRDfitVersion - alternate to above
noOpen - if set will not try to open a tree (assumes already open)
plot - if set will plot data
verbose - if set, will print many informational messages
debug - if set, debug output will be printed
Output:
RatZ0 - R value at Z=0 of Psis at input R & Z
EXAMPLE:
IDL> Rwant = findgen(5)/4*0.5 + 1.1
IDL> Zwant = findgen(5)/4*0.5 + 0.3
IDL> PsiWant = psiinterp( 135036, .589, Rwant=Rwant, Zwant=Zwant, $
RatZ0=RatZ0, /plot, /debug )
IDL> XYOUTS, RatZ0, 0, 'X', align=center
to get get R & Z data:
IDL> PsiWant = psiinterp( 135036, .589, Rwant=1.4, Zwant=0.4 )
LIMITATIONS:
Takes the EFIT/LRDfit at the nearest time. Perhaps an interpolation
should be done when the desired time is between computed times.
06-Sep-2013 set /exact in call to followContour (was getting choppy results)
WRITTEN 12-Feb-2010 by Bill Davis
Source: src/idl_cvs/pswindow.pro
NAME:
PSWINDOW
PURPOSE:
This function is used to calculate the size of a PostScript
window that has the same aspect ratio (ratio of height to
width) as the current display graphics window. It creates
the largest possible PostScript output window with the
desired aspect ratio. This assures that graphics output
looks similar, if not identical, to PostScript output.
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.
CALLING SEQUENCE:
pageInfo = PSWINDOW()
INPUTS:
None.
KEYWORD PARAMETERS:
CM: Normally the structure value that is returned from this
function reports its values in inches. Setting this keyword
causes the return values to be in units of centimeters.
FUDGE: A quick way to set symetrical XFUDGE and YFUDGE factors.
If this keyword is set to a value, XFUDGE and YFUDGE keywords are
set to the same value.
LANDSCAPE: Normally this function assumes a PostScript window
in Portrait mode. Setting this keyword assumes you want
the graphic in Landscape mode.
MARGIN: The margin around the edges of the plot. The value must be
a floating point value between 0.0 and 0.5. It is expressed in
normalized coordinate units. The default margin is 0.15.
PAGESIZE: Set this keyword to a string indicating the type
of PostScript page size you want. Current values are "LETTER",
"LEGAL", and "A4". Default is "LETTER".
PRINTER: Set this keyword if the output will be used to
configure the PRINTER device, rather than the PS device.
(In the PRINTER device, offsets are always calculated from
the lower-left corner of the page and do not rotate in
Landscape mode, as they do with the PS device.) Note that
the PRINTER device is only able to accept these keywords
in IDL 5.1 and higher.
XFUDGE: Printers calculate the offset point from the printable
edge of the paper (sometimes), rather from the corner of the paper.
For example, on my Lexmark printer, both X and Y offsets are
calculated from a point 0.25 inches in from the edge. This keyword
allows you to set a "fudge" factor that will be subtracted from
the XOFFSET that is returned to the user. This allows you to create
output that is centered on the page. The fudge factor should be in
the same units as the returned size and offset values.
YFUDGE: Printers calculate the offset point from the printable
edge of the paper (sometimes), rather from the corner of the paper.
For example, on my Lexmark printer, both X and Y offsets are
calculated from a point 0.25 inches in from the edge. This keyword
allows you to set a "fudge" factor that will be subtracted from
the YOFFSET that is returned to the user. This allows you to create
output that is centered on the page. The fudge factor should be in
the same units as the returned size and offset values.
OUTPUTS:
pageInfo: The output value is a named structure defined like
this:
pageInfo = {PSWINDOW_STRUCT, XSIZE:0.0, YSIZE:0.0, $
XOFSET:0.0, YOFFSET:0.0, INCHES:0, PORTRAIT:0, LANDSCAPE:0}
The units of the four size fields are inches unless the CM
keyword is set.
The output can be used to immediately configure the PostScript
or Printer device, like this:
Set_Plot, 'PS' ; or 'PRINTER'
Device, _Extra=pageInfo
RESTRICTIONS:
The aspect ratio of the current graphics window is calculated
like this:
aspectRatio = FLOAT(!D.Y_VSIZE) / !D.X_VSIZE
EXAMPLE:
To create a PostScript output window with the same aspect
ratio as the curently active display window, type:
pageInfo = PSWINDOW()
SET_PLOT, 'PS'
DEVICE, _Extra=pageInfo
To configure the PRINTER device:
pageInfo = PSWINDOW(/Printer, Fudge=0.25)
SET_PLOT, 'PRINTER'
DEVICE, _Extra=pageInfo
MODIFICATION HISTORY:
Written by: David Fanning, November 1996.
Fixed a bug in which the YOFFSET was calculated incorrectly
in Landscape mode. 12 Feb 97.
Took out a line of code that wasn't being used. 14 Mar 97.
Added correct units keyword to return structure. 29 JUN 98. DWF
Fixed a bug in how landscape offsets were calculated. 19 JUL 99. DWF.
Fixed a bug in the way margins were used to conform to my
original conception of the program. 19 JUL 99. DWF.
Added Landscape and Portrait fields to the return structure. 19 JUL 99. DWF.
Added PageSize keyword, changed MARGIN keyword, and completely
rewrote most of the intenal code. 9 FEB 2000. DWF.
Fixed a bug in how I calculated the aspect ratio. 1 MAR 2000. DWF.
Added PRINTER keyword to return proper offset values for the
PRINTER device, where the offset location is not rotated. 1 MAR 2000. DWF.
Added PRINTER fudge factors to take into account that printer offsets are
calculated from the printable area of the paper, rather than the corner
of the paper. 8 AUG 2000. DWF.
07-Mar-02 made work for correctly for landscape/portrait
Source: src/idl_cvs/ps_form.pro
NAME:
PS_FORM
PURPOSE:
This function displays a form the user can interactively manipulate
to configure the PostScript device driver (PS) setup. The function returns
a structure of keywords that can be sent directly to the DEVICE command
via its _EXTRA keyword
CATEGORY:
Printing, Device Drivers, Hardcopy Output, PostScript Output
PROCEDURE:
This is a pop-up form widget. It is a modal or blocking widget.
Keywords appropriate for the PostScript (PS) DEVICE command are returned.
The yellow box in the upper right hand corner of the form represents the
PostScript page. The green box represents the "window" on the PostScript
page where the graphics will be drawn.
Use your LEFT mouse button to move the plot "window" around the page.
Use your RIGHT mouse button to draw your own plot window on the page.
The CREATE FILE and ACCEPT buttons are meant to indicate slightly
different operations, although this is sometimes confusing. My idea
is that PS_FORM is a *configuration* dialog, something the user displays
if he or she wants to change the way the PostScript device is configured.
Thus, in many of my widget programs if the user clicks a "Write PostScript File"
button, I just go ahead and write a PostScript file without displaying the
form. (I can do this because I always keep a copy of the current device
configuration in my info structure.) To get to the form, the user must
select a "Configure PostScript Device" button.
At that time, the user might select the ACCEPT button to just change
the PostScript device configurations. Or the user can select the
CREATE FILE button, which both accepts the configuration *and* creates
a PostScript file. If you find the CREATE FILE button confusing, you
can just edit it out of the form and use the ACCEPT button for the
same purpose.
HELP:
formInfo = PS_FORM(/Help)
USAGE:
The calling procedure for this function in a widget program will look something
like this:
info.ps_config = PS_FORM(/Initialize)
...
formInfo = PS_FORM(Cancel=canceled, Create=create, $
Defaults=info.ps_config, Parent=event.top)
IF NOT canceled THEN BEGIN
IF create THEN BEGIN
thisDevice = !D.Name
Set_Plot, "PS"
Device, _Extra=formInfo
Enter Your Graphics Commands Here!
Device, /Close
Set_Plot, thisDevice
ENDIF
info.ps_config = formInfo
ENDIF
OPTIONAL INPUT PARAMETERS:
XOFFSET -- Optional xoffset of the top-level base of PS_Form. Default is
to try to center the form on the display.
YOFFSET -- Optional yoffset of the top-level base of PS_Form. Default is
to try to center the form on the display.
INPUT KEYWORD PARAMETERS:
BITS_PER_PIXEL -- The initial configuration of the bits per pixel button.
BLOCKING -- Set this keyword to make this a blocking widget under IDL 5.0.
(All widget programs block under IDL 4.0.)
COLOR -- The initial configuration of the color switch.
DEFAULTS -- A stucture variable of the same type and structure as the
RETURN VALUE of PS_FORM. It will set initial conditions. This makes
it possible to start PS_FORM up again with the same values it had the
last time it was called. For example:
mysetup = PS_FORM()
newsetup = PS_FORM(Defaults=mysetup)
NOTE: Using the DEFAULTS keyword will nullify any of the other
DEVICE-type keywords listed above (e.g., XSIZE, ENCAPSULATED, etc.)
ENCAPSULATED -- The initial configuration of the encapsulated switch.
FILENAME -- The initial filename to be used on the form.
HELP -- Prints a helpful message in the output log.
INCHES -- The initial configuration of the inches/cm switch.
INITIALIZE -- If this keyword is set, the program immediately returns the
"localdefaults" structure. This gives you the means to configue the
PostScript device without displaying the form to the user. I use this
to write a PostScript file directly and also to initialize my info
structure field that contains the current PostScript form setup. Passing
the setup structure into PS_FORM via the DEFAULTS keyword gives my PS_FORM
a program "memory".
info.ps_setup = PS_FORM(/Initialize)
LANDSCAPE -- The initial configuration of the landscape/portrait switch.
LOCALDEFAULTS -- A structure like the DEFAULTS structure. Used if the
"Local Defaults" button is pressed in the form. This gives you the
opportunity to have a "local" as well as "system" default setup.
If this keyword is not used, the procedure PS_Form_Set_Personal_Local_Defaults
is called. Use this procedure (see below) to define your own local
defaults.
XOFFSET -- The initial XOffSet of the PostScript window.
YOFFSET -- The initial YOffSet of the PostScript window.
XSIZE -- The initial XSize of the PostScript window.
YSIZE -- The initial YSize of the PostScript window.
OUTPUT KEYWORD PARAMETERS
CANCEL -- This is an OUTPUT keyword. It is used to check if the user
selected the "Cancel" button on the form. Check this variable rather
than the return value of the function, since the return value is designed
to be sent directly to the DEVICE procedure. The varible is set to 1 if
the user selected the "Cancel" button. Otherwise, it is set to 0.
CREATE -- This output keyword can be used to determine if the user
selected the 'Create File' button rather than the 'Accept' button.
The value is 1 if selected, and 0 otherwise.
RETURN VALUE:
formInfo = { PS_FORM_INFO, $
xsize:0.0, $ ; The x size of the plot
xoff:0.0, $ ; The x offset of the plot
ysize:0.0, $ ; The y size of the plot
yoff:0.0 $ ; The y offset of the plot
filename:'', $ ; The name of the output file
inches:0 $ ; Inches or centimeters?
color:0, $ ; Color on or off?
bits_per_pixel:0, $ ; How many bits per image pixel?
encapsulated:0,$ ; Encapsulated or regular PostScript?
landscape:0 } ; Landscape or portrait mode?
MAJOR FUNCTIONS and PROCEDURES:
None. Designed to work originally in conjunction with XWindow,
a resizable graphics window.
MODIFICATION HISTORY:
Written by: David Fanning, RSI, March 1995.
Given to attendees of IDL training courses.
19-Dec-02 fix for vms directories [Bill Davis]
Modified to work when grapics device set to PostScript: 6 May 95.
Modified to configure initial conditions via keywords: 13 October 95.
Modified to load personal local defaults if LocalDefaults keyword not
used: 3 Nov 95.
Found and fixed bits_per_pixel error in Local Defaults setting
procedure: 3 Nov 95.
Modified to produce initial plot box with the same aspect ratio as
the current graphics window. (XSIZE or YSIZE keywords overrule this
behavior.) 22 Apr 96.
Fixed annoying behavior of going to default-sized plot box when selecting
the Landscape or Portrait option. Now keeps current plot box size.
22 Apr 96.
Made the size and offset text widgets a little bigger and changed the
size and offset formatting from F4.2 to F5.2 to accomodate larger plot
box sizes. 29 Apr 96.
Fixed a bug in the filename text widget that caused a crash when a CR
was hit. 3 Sept 96.
Added the Initialize keyword to immediately return the "localdefaults"
structure. 27 Oct 96.
Fixed another problem with the BITS_PER_PIXEL keyword. 27 Oct 96.
Made the return value a named structure of the name PS_FORM_INFO.
3 Nov 96.
Discovered and fixed a problem whereby YOFFSET was set incorrectly if
LOCALDEFAULTS was used instead of DEFAULTS keyword. 3 Nov 96.
Fixed bug in how Portrait mode was set using YSIZE and XSIZE keywords.
25 Nov 96.
Fixed a bug in how YOFFSET was calculated when in Landscape mode. 27 Nov 96.
Fixed a memory leak with the local defaults pointer. 25 Jan 97.
Added the CREATE keyword and modified the appearance of the form. 22 Apr 97.
Modifed subroutine names to avoid confusion. 22 Apr 97.
Fixed a bug I introduced when I added the CREATE keyword. 23 Apr 97.
Modified the program for IDL 5. 30 May 97, DWF.
Fixed Inches to CM exclusive button problem. 30 May 97, DWF.
Fixed a problem when the widget is killed with the mouse. 30 May 97. DWF
Added a Select Filename button. 12 Oct 97.
Modified program layout slightly. 12 Oct 97.
Added valid directory/file error checking for the filename. 12 Oct 97. DWF
Added further support for IDL 5 modal functionality. 20 Oct 97. DWF
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
2642 Bradbury Court
Fort Collins, CO 80521 USA
Phone: 970-221-0438
E-mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
Source: src/idl_cvs/ptr_free_recursively.pro
NAME:
PTR_FREE_RECURSIVELY
PURPOSE:
This routine when passed a pointer will free up any memory associated
with that pointer. This includes structures, which could contain
pointers, or other structures which could in turn contain more
pointers. It also destroys objects it comes across. It can also
cope with null pointers that are found on its travels.
CATEGORY:
programming
CALLING SEQUENCE:
Ptr_Free_Recursively, AValidPointer
INPUTS:
InitialPointer: The pointer whose 'heap memory hierachy' will be freed.
KEYWORD PARAMETERS:
None.
OUTPUTS:
None.
COMMON BLOCKS:
None, of course.
SIDE EFFECTS:
Well as far as I can see, there are none. But please try and find them
so I can improve the program.
RESTRICTIONS:
The program will destroy any objects it meets but if the cleanup
methods for those objects are not tight then there will be leakage.
There are no restrictions on the number of levels of referencing -
the routine is totally general.
Also you must have my modified version of coyotelist (DWF).
EXAMPLE:
First you have to have a valid pointer and while obviously your hierachy
doesn't have to be as complictated as this, the example shows just what
it can do.
ThisPointer = Ptr_New( [Ptr_New(), $
Ptr_New({h:'hello', point0:ptr_new(ptr_new(ptr_new($
{string:'hello', point1:ptr_new(),point2:ptr_new('hello')}))), $
point3:ptr_new(), b:'bye'}), $
Ptr_New('Hello'), $
Ptr_New({Object:Obj_New('Coyotelist'), Point4:Ptr_New(), $
Point5:[ptr_new('hello'),ptr_new('bye')]}) $
])
Ptr_Free_Recursively, ThisPointer
............and all your memory will be gone.
MODIFICATION HISTORY:
Written by: Phil Aldis
March 3rd, 1999: Fixed the last few bugs and attempted to make the comments
a bit clearer. PJA
AUTHOR:
Philip Aldis
14 Milton Road,
Bentley Heath,
B93 8AA.
Phone: 0044 1564 773437
E-Mail:philaldis@geocities.com
Source: src/idl_cvs/pwd.pro
NAME:
pwd
PURPOSE:
print the current working directory
CATEGORY:
Utility, Programming
OUTPUT:
cwd directory name string. if present in argument list
directory string is not printed to terminal.
AUTHOR: Paul Ricchiazzi jan93
Institute for Computational Earth System Science
University of California, Santa Barbara