[Previous]
[Next]
NAME:
physics_constant
PURPOSE:
Gets value of fundamental physics constant
CATEGORY:
gen/idl/toolbox
CALLING SEQUENCE:
FUNCTION physics_constant, char_string, $
unit=unit, uncertainty=uncertainty, name=name, $
exponent=exponent
INPUTS:
char_string scalar; type: string
string descriptof for constant
e.g. 'speed of light'
OPTIONAL INPUT PARAMETERS:
/exponent passes to flt_string
OUTPUTS:
value scalar or array[2]; type: double
value of constant
OPTIONAL OUTPUT PARAMETERS:
unit=unit scalar; type: string
unit of 'value' (mks units are used)
uncertainty=uncertainty
scalar; type: double
uncertainty in 'value'
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
BadValue, GetFileSpec, flt_string, txt_read, who_am_i
PROCEDURE:
Uses list of physical constants from
http://physics.nist.gov/cuu/Constants/Table/allascii.txt
renamed to
physics_constant.txt in the same directory as this function.
MODIFICATION HISTORY:
MAR-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
PlotBars
PURPOSE:
Plots bar graph
CALLING SEQUENCE:
PRO PlotBars, xin, yin, nvalid , $
sigma = sigma , $
xrange = xrange , $
yaxis = yaxis , $
ynozero = ynozero , $
ylog = ylog , $
yrange = yrange , $
ystyle = ystyle , $
ycolor = ycolor , $
color = color , $
changecolor = changecolor , $
barwidth = barwidth , $
use_min_barwidth= use_min_barwidth , $
shade = shade , $
hatch = hatch , $
cdf = cdf , $
ccdf = ccdf , $
relative = relative , $
nojoin = nojoin , $
noline = noline , $
low_margin = low_margin , $
vertical = vertical , $
horizontal = horizontal , $
fill_sparse = fill_sparse , $
_extra = _extra
INPUTS:
xin, yin one-dimensional arrays; must have the same size
nvalid identifies the array elements to be plotted as:
- an array of indices e.g. [0,1,2,7,8,9,10]
- a boolean array (containing only values 0 or 1)
of same size as xin and yin, e.g. [1,1,1,0,0,0,0,1,1,1,1]
if nvalid is absent, all finite function values are plotted
OPTIONAL INPUT PARAMETERS:
/use_min_barwidth
use a constant bar width based on the minimum distance
between data points.
barwidth scalar; type: float; default: 1
by default, bars are drawn with no intervening space, i.e.
the right side of one bar coincides with the left side of
its neighbour to the right; or, if /use_min_barwidth is set,
the default barwidth is the minimum distance between
neighbouring data points.
Barwidth is used as a scaling
factor for the bar width, e.g. barwidth=0.5 will leave
a space in between bars, equal to the width of the bars.
vertical=vertical
scalar; type: integer; default: 1
draw vertical bars (i.e. standard histogram style)
horizontal=horizontal
scalar; type: integer: default: 0
draw horizontal bars
shade=shade 1- or 2-element array; type: float; default: none
if set then the bars are shaded.
shade[0] is used for bars with good values
shade[1] is used for bars with bad values
hatch=hatch 1- or 2-element array; type: float; default: none
if set then the bars are hatched. The value determines
the distance between the hatch lines.
hatch[0] is used for bars with good values
hatch[1] is used for bars with bad values
/noline If either shade or hatch is set then this suppress
the bounding line for each bar.
This keyword is ignored if neither hatch nor shade is set.
/nojoin If barwidth is set to one (the default), then the
common boundaries between neighbouring bars in not drawn.
This keyword is ignored if barwidth not equal 1.
/cdf Plots a CDF (cumulative distribution function)
i.e. the yin array is summed left to right.
/ccdf Plots the CCDF (complementary cumulative distribution
function (i.e. the yin array is summed right to left.
/relative Plots a normalized CDF. The normalization factor is
the last element in the CDF.
INCLUDE
@compile_opt.pro ; On error, return to caller
CALLS: ***
BadValue, InitVar, IsType, PlotPrep, REVERSE, destroyvar, gridgen, plotbars_boundary
plotbars_collect, plotbars_plot, plotbars_shade, plotbars_sigma
CALLED BY:
plotcolumns
PROCEDURE:
MODIFICATION HISTORY:
OCT-2010, Paul Hick (UCSD/CASS)
JUL-2012, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added /use_min_barwidth
[Previous]
[Next]
NAME:
plotbars_boundary
PURPOSE:
(Internal use by plotbars only)
CATEGORY:
ucsd/gen/idl/toolbox/graphics
CALLING SEQUENCE:
FUNCTION plotbars_boundary, j, jfirst, jlast, fpnt, negative_side, positive_side, low_margin, $
nojoin = nojoin , $
bad_sequence = bad_sequence , $
cdf = cdf
INPUTS:
j
jfirst
jlast
fpnt
hegative_side
positive_side
low_margin
OPTIONAL INPUT PARAMETERS:
/nojoin
/bad_sequence
OUTPUTS:
rr[2,n]
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
InitVar
CALLED BY:
PlotBars
PROCEDURE:
MODIFICATION HISTORY:
MAY-2012, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
plotbars_collect
PURPOSE:
(internal use by plotbar only)
CATEGORY:
ucsd/gen/idl/toolbox/graphics
CALLING SEQUENCE:
PRO plotbars_collect, rr_all, rr
INPUTS:
rr_all[2,n]
rr[2,m]
OUTPUTS:
rr_all[2,k]
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
boost
CALLED BY:
PlotBars
PROCEDURE:
MODIFICATION HISTORY:
MAY-2012, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
plotbars_plot
PURPOSE:
(internal use by plotbar only)
CATEGORY:
ucsd/gen/idl/toolbox/graphics
CALLING SEQUENCE:
PRO plotbars_plot, rr, horizontal=horizontal, _extra=_extra
INPUTS:
rr[2,n]
OPTIONAL INPUT PARAMETERS:
/horizontal
_extra=_extra
OUTPUTS:
(none)
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
InitVar, IsType, destroyvar
CALLED BY:
PlotBars
PROCEDURE:
MODIFICATION HISTORY:
DEC-2010, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
plotbars_shade
PURPOSE:
(internal use by plot only)
CATEGORY:
ucsd/gen/idl/toolbox/graphics
CALLING SEQUENCE:
PRO plotbars_shade, rr, $
color = color , $
shading = shading , $
hatching = hatching , $
spacing = spacing , $
horizontal = horizontal
INPUTS:
rr[2,n]
OPTIONAL INPUT PARAMETERS:
color=color
shading=shading
/hatching
/spacing
/horizontal
OUTPUTS:
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
InitVar
CALLED BY:
PlotBars
PROCEDURE:
MODIFICATION HISTORY:
MAY-2012, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
plotbars_sigma
PURPOSE:
(internal use by plot bar only)
CATEGORY:
ucsd/gen/idl/toolbox/graphics
CALLING SEQUENCE:
PRO plotbars_sigma, opnt, fpnt, sigma, horizontal=horizontal
INPUTS:
opnt
fpnt
sigma
OPTIONAL INPUT PARAMETERS:
/horizontal
OUTPUTS:
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
InitVar
CALLED BY:
PlotBars
PROCEDURE:
MODIFICATION HISTORY:
MAY-2012, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
plotcolumns
PURPOSE:
Makes a stack plot.
Input is provided for n 'samples'. The samples are plotted
as n separate groups of columns (or one or more columns)
along the x-axis.
CALLS: ***
InitVar, IsType, LOADCT, PlotBars, REVERSE, SuperArray, WhatIs
Example: 10 samples describing the years 2001 through 2010.
The x-axis will have labels 2001, 2002, ..., 2010 with groups
of columns near each label.
Each sample (optionally) can cover a group with m 'members'.
The group of columns for each sample consists of m columns.
Example: each sample has 4 members, one for each quarter of
the year.
Each member in the sample has l categories. The l categories
are stacked on top of each other for each member column.
Example: categories 'coffee','tea','water','beer','soda'. The input
data could be ounces of liquid consumed for each category
per quarter for the years 2001 through 2010.
For the example:
xvalues = [2001,2002,...,2010] = array(10)
yvalues = array(10,4,5) ounces for 10 years, 4 quarter, 5 categories
group_names = ['Q1','Q2','Q3','Q4']
stack_names = ['coffee','tea','water','beer','soda']
CALLING SEQUENCE:
PRO plotcolumns, xvalues, yvalues, $
group_names = group_names , $
stack_names = stack_names , $
inter_group = inter_group , $
intra_group = intra_group , $
sort_stack = sort_stack , $
top_stacks = top_stacks , $
;align = align , $
colors = colors , $
legend = legend , $
silent = silent , $
inter_align = inter_align , $
_extra = _extra
INCLUDE:
@compile_opt.pro
INPUTS:
xvalues array[n]; type: string or numeric
yvalues array[n,m,l], array[n,l]; type: numeric
values for m 'groups' in l 'stacks'
for n 'samples'
OPTIONAL INPUTS:
group_names=group_names
array[m]; type: string; default: none
NOT USED YET
string labels for the 'm' groups
stack_names=stack_names
array[l]; type: string; default: none
string labels for the 'l' stacks
used in the legend (see below)
inter_group=inter_group
scalar; type: integer >= 0; default: 1
sets the space between the 'n' samples
in units of the column width.
intra_group=intra_group
scalar; type: integer >=0; default: inter_group
sets the space between the 'm' members
of a group in units of the column width.
sort_stacks=sort_stacks
scalar; type: integer; default: 0
allowed values: 0,1,2
1: sort the stacks in order of decreasing
value of the sums yvalues[*,0,l],
i.e. the sum of the values in group 0
2: sort the stacks in order of decreasing
value of the sums yvalues[*,*,l],
ie. the sum of the values in all groups
The first stack in this order will be
plotted at the bottom of each column.
top_stacks=top_stacks
scalar; type: integer; default: none
if the input array yvalues contains more than
'top_stacks' stacks (l > top_stacks), then
only 'top_stacks-1' stacks from yvalues are
used, and one stack is added containing the
sum of the stacks 'top_stacks-1' to 'l-1'.
If top_stacks is set then also 'sort_stacks'
is assumed set to at least 1.
colors=colors
array[l]; type: integer
the color indices to be used to color the
'l' stacks in each column
legend=legend
array[2], array[4] or array[6]
determines the layout of the legend of 'l'
colored blocks for each stack member, with
next to it the corresponding 'stack_name' string.
All numbers are in normal coordinates
legend[0:1]: upper-left corner of legend.
legend[2] : horizontal distance between
color block and label
legend[3] : vertical distance between color blocks
legend[4] : length of color block
legend[5] : height of color block
silent=silent
PROCEDURE:
The bargraph produced consists of m x n columns:
a group of m consecutive columns, repeated n times.
Each column shows the numbers for the l stacks
stacked on top of each other.
MODIFICATION HISTORY:
DEC-2012, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
PlotCurve
PURPOSE:
(Over)plot two arrays x, y. Connect only `valid' points.
CALLING SEQUENCE:
PRO PlotCurve, xin, y, nvalid, $
sigma = sigma , $
oplotx = oplotx , $
xrange = xrange , $
newyaxis = newyaxis , $
yaxis = yaxis , $
ynozero = ynozero , $
ylog = ylog , $
yrange = yrange , $
ystyle = ystyle , $
color = color , $
changecolor = changecolor, $
_extra = _extra , $
silent = silent , $
bar = bar , $
shade = shade , $
hatch = hatch , $
noline = noline
INPUTS:
x,y one-dimensional arrays; must have the same size
nvalid identifies the array elements to be plotted as:
- an array of indices e.g. [0,1,2,7,8,9,10]
- a boolean array (containing only values 0 or 1)
of same size as x and y, e.g. [1,1,1,0,0,0,0,1,1,1,1]
if nvalid is absent, all finite function values are plotted
OPTIONAL INPUT PARAMETERS:
/oplot if not set, then a new plot (with a new x-axis) is started)
(implicitly /newaxis is set and yaxis=-1, i.e. a y-axis
will be drawn on the left)
if set, then the arrays are overplotted on a previous plot
(the keywords /newyaxis and yaxis=yaxis can be used to add
additional y axes, if necessary)
/newyaxis
adds a new yaxis (if /oplot is NOT set, then /newaxis is assumed set)
yaxis=yaxis controls the position of a new y axis; yaxis is used only if /newaxis is set
yaxis=-1 : y-axis on left (default)
yaxis=0 : y-axis on right
0<yaxis<1: y-axis is placed in the right margin
(if this is used then ymargin must be made big enough
to hold the extra y axis).
sigma=sigma array; type: any
must have same size as x,y. Standard deviations of y-data
color=color scalar or array[2]; type: integer; default: [!p.color, !d.n_color-1]
color indices used to connect points.
color[0] is used to connect good data points
color[1] is used to connect bad data points (if /change is set)
/change by default, bad data points are not plotted. If /change is set
bad points are connected with color[1]
/bar if set then a bar graph is drawn
shade=shade scalar or array[2]; type: any; default: none
if /bar is set then shade[0] is used to shade good data bars
and (if /change) is set shade[1] is used to shade bad bars
hatch=hatch scalar or array[1]; type: any: default: none
if /bar is set then hatch[0] is used to shade good data bars
and (if /change) is set shade[1] is used to shade bad bars
/noline (only used if /bar is set)
Suppress line drawing (i.e. only shade or hatch)
IDL plot keywords:
xmargin, ymargin used only to start a new plot (/oplot NOT set)
yrange, ynozero used only if new y-axis is plotted
(/oplot NOT set, or /newaxis set)
ynozero is NOT used if yrange is specified
linestyle, xtitle, ytitle, psym, charsize
INCLUDE
@compile_opt.pro ; On error, return to caller
CALLED BY:
InSitu, PlotEarthSkymap, PlotEloTimeMap, PlotPolarSkymap, eclipsed_area
even_light_registration, jpl_test, qLine_Curve, smei_frm_summary, smei_hdr_plot
smei_plot_timeseries, smei_star_show, vu_insitucurve, vu_linecut, vu_losmap
vu_radialcut
COMMON BLOCKS:
common TimeScale, torigin, trange, tunit, texact ; Set by TimeXAxis
CALLS: ***
InitVar, IsTime, IsType, TimeOp, TimeSet, TimeXAxis
RESTRICTIONS:
There still seems to be a problem with the axis plotting: once a log axis has been
plotted all added curves will also have a logarithmic scale, i.e. ylog=0 setting does not
have any effect. This appears to be a bug in the IDL axis routine.
PROCEDURE:
> Only valid data points are connected by the type of line specified
by the linestyle keyword.
> Valid data points are identified in the nvalid array either by their
array index or by a boolean value of 1.
MODIFICATION HISTORY:
APR-1996, Paul Hick (UCSD/CASS)
OCT-1999, Paul Hick (UCSD/CASS)
if nvalid is not specified only finite y-values (finite(y) = 1) are
plotted, instead of all points
FEB-2001, Paul Hick (UCSD/CASS)
Fixed minor bug in handling of invalid data points.
FEB-2004, Paul Hick (UCSD/CASS)
Fixed bug for call with a time array as x-array when the time
origin is not yet defined
SEP-2007, Paul Hick (UCSD/CASS)
Added keywords bar, hatch and shade for plotting bar graphs
JUL-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added xrange keyword to allo
[Previous]
[Next]
NAME:
PlotCurves
PURPOSE:
(Over)plot two arrays x, y. Connect only `valid' points.
CALLING SEQUENCE:
PRO PlotCurves, xin, yin, nvalid, $
sigma = sigma , $
xrange = xrange , $
yaxis = yaxis , $
ynozero = ynozero , $
ylog = ylog , $
yrange = yrange , $
ystyle = ystyle , $
ycolor = ycolor , $
color = color , $
changecolor = changecolor , $
nodata = nodata , $
markoutside = markoutside , $
_extra = _extra
INPUTS:
Input arguments passed to PlotPrep:
xin, yin abcissa and ordinate arrays;
nvalid identifies the array elements to be plotted
OPTIONAL INPUT PARAMETERS:
Keywords passed to PlotPrep:
/oplotx if set, then overplot on plot set up by
previous call to PlotCurves
/newyaxis adds a new yaxis (if /oplot is NOT set, then /newaxis is assumed set)
yaxis=yaxis controls the position of a new y axis
/changecolor by default, bad data points are not plotted.
If /changecolor is set bad points are connected with color[1]
/nodata if set, only the x- and y-axes are drawn. Data points are ignored.
(effectively this is just a call to PlotPrep).
Additional keywords:
sigma=sigma array; type: any
must have same size as x,y.
Standard deviations of y-data
color=color scalar or array[2]; type: integer; default: [!p.color, !d.n_color-1]
color indices used to connect points.
color[0] is used to connect good data points
color[1] is used to connect bad data points (if /changecolor is set)
ycolor=ycolor scalar; type: integer; default: none
passed to PlotPrep. Determines the color used to draw the y-axis.
Useful to emphasize the association between y-axis and data points
if multiple y-axes are used.
markoutside=markoutside
scalar, type: integer; default: 0
Can be used to make points outside the plot area visible
by plotting an arrowhead pressed against the upper or lower
x-axis. The value of markoutside determines the size of
the arrowhead in device units. A negative value will turn
the arrowhead into a solid triangle. The color is
taken from the 'color' keyword.
IDL plot keywords:
xmargin, ymargin used only to start a new plot (/oplot NOT set)
yrange, ynozero used only if new y-axis is plotted
(/oplot NOT set, or /newaxis set)
ynozero is NOT used if yrange is specified
linestyle, xtitle, ytitle, psym, charsize
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
InitVar, IsType, PlotPrep
CALLED BY:
smei_hdr_plot
RESTRICTIONS:
There still seems to be a problem with the axis plotting:
once a log axis has been plotted all added curves will also
have a logarithmic scale, i.e. ylog=0 setting does not
have any effect. This appears to be a bug in the IDL axis routine.
PROCEDURE:
> Only valid data points are connected by the type of line specified
by the linestyle keyword.
> Valid data points are identified in the nvalid array either by their
array index or by a boolean value of 1.
MODIFICATION HISTORY:
APR-1996, Paul Hick (UCSD/CASS)
OCT-1999, Paul Hick (UCSD/CASS)
if nvalid is not specified only finite y-values (finite(y) = 1) are
plotted, instead of all points
FEB-2001, Paul Hick (UCSD/CASS)
Fixed minor bug in handling of invalid data points.
FEB-2004, Paul Hick (UCSD/CASS)
Fixed bug for call with a time array as x-array when the time
origin is not yet defined
SEP-2007, Paul Hick (UCSD/CASS)
Added keywords bar, hatch and shade for plotting bar graphs
JUL-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added xrange keyword
[Previous]
[Next]
NAME:
PlotDashes
CALLING SEQUENCE:
PRO PlotDashes, x, y, $
dashes = dashes , $
absolute = absolute , $
_extra = _extra
INCLUDE:
@compile_opt.pro
CALLS: ***
InitVar, destroyvar
[Previous]
[Next]
NAME:
PlotPrep
PURPOSE:
CALLING SEQUENCE:
FUNCTION PlotPrep, xin, yin, nvalid, $
oplotx = oplotx , $
newyaxis = newyaxis , $
yaxis = yaxis , $
xrange = xrange , $
yrange = yrange , $
ystyle = ystyle , $
ynozero = ynozero , $
ylog = ylog , $
changecolor = changecolor, $
ycolor = ycolor , $
silent = silent , $
_extra = _extra , $
; Output
xpnt = xpnt , $
ypnt = ypnt , $
npnt = npnt
INPUTS:
xin one-dimensional abcissa array
To plot a time axis (using TimeXAxis) xin must be
an array of time structures, or a string array that
is converted to time structures with TimeSet.
yin one-dimensional ordinate array
must have the same size as xin
nvalid one-dimensional array identifying the array elements
to be plotted as:
- an array of indices e.g. [0,1,2,7,8,9,10]
- a boolean array (containing only values 0 or 1)
of same size as xin and yin, e.g. [1,1,1,0,0,0,0,1,1,1,1]
if nvalid is absent, all finite ordinate values are plotted
OPTIONAL INPUT PARAMETERS:
/oplotx if not set, then a new plot (with a new x-axis) is started)
(implicitly /newyaxis is set and yaxis=-1, i.e. a y-axis
will be drawn on the left)
if set, then the arrays are overplotted on a previous plot
(the keywords /newyaxis and yaxis=yaxis can be used to add
additional y axes, if necessary)
/newyaxis adds a new yaxis
(if /oplotx is NOT set, then /newyaxis is assumed set)
yaxis=yaxis controls the position of a new y axis; yaxis is used
only if /newaxis is set
yaxis=-1 : y-axis on left (default)
yaxis=0 : y-axis on right
0<yaxis<1: y-axis is placed in the right margin
(if this is used then ymargin must be made big enough
to hold the extra y axis).
silent=silent
suppresses informational messages
OUTPUTS:
xpnt
ypnt
npnt
OPTIONAL OUTPUT PARAMETERS:
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
InitVar, IsTime, IsType, TimeOp, TimeSet, TimeXAxis
CALLED BY:
PlotBars, PlotCurves
COMMON BLOCKS:
common TimeScale, torigin, trange, tunit, texact ; Set by TimeXAxis
MODIFICATION HISTORY:
NOV-2010, Paul Hick (UCSD/CASS)
Extracted from PlotCurve
[Previous]
[Next]
NAME:
PutFileSpec
PURPOSE:
Updates internal data originally set up by SetFileSpec
CATEGORY:
I/O, string manipulation
CALLING SEQUENCE:
PRO PutFileSpec, FileSpec, $
from = From , $
upto = Upto , $
part = Part , $
parse = Parse , $
strict = strict
INPUTS:
FileSpec string scalar of array with file names
If it is an array it should have the same
# elements as the internal data.
OPTIONAL INPUT PARAMETERS:
From, UpTo string scalars
Any of the following six strings can be used:
'NODE','DEVICE','DIRECTORY','NAME','TYPE','VERSION'
The input is case-insensitive
Only a unique starting substring has to be specified
If From is not specified, From='NODE' is assumed
If UpTo is not specified, UpTo='VERSION' is assumed
/parse if set, the filenames are parsed before adding them
to the internal data (/parse is passed to SetFileSpec;
see that procedure for more information about parsing).
OUTPUTS:
None (the modified internal data are accessed by GetFileSpec)
INCLUDE:
@compile_opt.pro ; On error, return to caller
@filespec_common.pro ; Common block with array File and Parts
CALLS: ***
InitVar, SetFileSpec, strposn
CALLED BY:
vu_extract, vu_vox_write
SIDE EFFECTS:
If FileSpec is an array it must have the same size as the internal data.
PROCEDURE:
FileSpec is passed through SetFileSpec (with the /nosave keyword set so
the internal data are not modified) to decompose into separate file
parts. The relevant part (as identified from the From and UpTo strings)
are then used to overwrite (part of) the internal data.
MODIFICATION HISTORY:
DEC-1997, Paul Hick (UCSD/CASS; pphick@ucsd.edu)