[Previous]
[Next]
NAME:
T3D
PURPOSE:
Implement three-dimensional transforms.
This routine accumulates one or more sequences of translation,
scaling, rotation, perspective, and oblique transformations
and stores the result in !P.T, the 3D transformation system variable.
All the IDL graphic routines use this [4,4] matrix for output.
CATEGORY:
Graphics.
CALLING SEQUENCE:
T3D [, Array]
[, /RESET]
[, OBLIQUE=vector] [, PERSPECTIVE=scalar]
[, ROTATE=vector] [, SCALE=vector] [, TRANSLATE=vector]
[, /XYEXCH] [, /XZEXCH] [, /YZEXCH]
INPUTS:
Array: An optional 4 x 4 matrix used as the starting transformation.
If Array is missing then the current !P.T transformation is used.
Array is ignored if /RESET is set.
KEYWORDS:
MATRIX: If set to a named variable, the result is returned in this
parameter and !P.T is not modified.
Note - Any, all, or none of the following keywords can be present in a
call to T3D. The order of the input parameters does not matter.
The transformation specified by each keyword is performed in the
order of their descriptions below (e.g., if both TRANSLATE and
SCALE are specified, the translation is done first):
RESET: Set this keyword to reset the transformation to the default
identity matrix.
TRANSLATE: A three-element vector of the translations in the X, Y, and Z
directions.
SCALE: A three-element vector of scale factors for the X, Y, and Z
axes.
ROTATE: A three-element vector of the rotations, in DEGREES,
about the X, Y, and Z axes. Rotations are performed in the
order of X, Y, and then Z.
PERSPECTIVE: Perspective transformation. This parameter is a scalar (p)
that indicates the Z distance of the center of the projection.
Objects are projected into the XY plane at Z=0, and the "eye"
is at point [0,0,p].
OBLIQUE: A two-element vector of oblique projection parameters.
Points are projected onto the XY plane at Z=0 as follows:
x' = x + z(d COS(a)), and y' = y + z(d SIN(a)).
where OBLIQUE[0] = d, and OBLIQUE[1] = a.
XYEXCH: Exchange the X and Y axes.
XZEXCH: Exchange the X and Z axes.
YZEXCH: Exchange the Y and Z axes.
OUTPUTS:
The 4 by 4 transformation matrix !P.T is updated with the
resulting transformation, unless the keyword MATRIX is supplied,
in which case the result is returned in MATRIX and !P.T is
not affected.
Note - For the transformations to have effect you
must also set !P.T3D = 1 (or set the T3D keyword in subsequent calls
to graphics routines).
CALLED BY:
CREATE_VIEW, CW_ORIENT, EXTRACT_SLICE, MESH_OBJ, RECON3, SCALE3, SCALE3D, SLICER3, SURFR
COMMON BLOCKS:
None.
SIDE EFFECTS:
!P.T is changed if the keyword MATRIX is not set.
RESTRICTIONS:
This routine implements general rotations about the three axes.
The routines SURFACE and SHADE_SURF may only be used in conjunction
with T3D rotations that project the Z axis in 3 dimensions to
a line parallel to the Y axis in 2 dimensions.
PROCEDURE:
This program follows that of Foley & Van Dam, "Fundamentals of
Interactive Computer Graphics", Chapter 8, "Viewing in Three
Dimensions".
The matrix notation is reversed from the normal IDL sense,
i.e., here, the first subscript is the column, the second is the row,
in order to conform with the above reference.
A right-handed system is used. Positive rotations are COUNTER-
CLOCKWISE when looking from a positive axis to the origin.
EXAMPLES:
To reset the transformation, rotate 30 degs about the X axis
and do perspective transformation with the center of the projection
at Z = -3, X=0, and Y=0, enter:
T3D, /RESET, ROT = [ 30,0,0], PERS = 3.
Transformations may be cascaded, for example:
T3D, /RESET, TRANS = [-.5,-.5,0], ROT = [0,0,45]
T3D, TRANS = [.5,.5,0]
The first command resets, translates the point [.5,.5,0] to the
center of the viewport, then rotates 45 degrees counterclockwise
about the Z axis. The second call to T3D moves the origin back to
the center of the viewport.
To perform the above transformations without updating !P.T:
T3D, /RESET, TRANS = [-.5,-.5,0], ROT = [0,0,45], MATRIX=matrix1
T3D, matrix1, TRANS = [.5,.5,0], MATRIX=matrix2
Now, "matrix2" contains the final transformation matrix.
MODIFICATION HISTORY:
DMS, Nov, 1987.
DMS, June 1990. Fixed bug that didn't scale or translate
matrices with perspective properly.
DMS, July, 1996. Added MATRIX keyword.
DLD, April, 2000. Convert to double precision matrices.
CT, RSI, August 2000: Add argument Array, change MATRIX to output only.
CT, RSI, July 2003: Change degrees->radians calc to double precision.
[Previous]
[Next]
NAME:
T_CVF
PURPOSE:
This function computes the cutoff value (v) such that:
Probability(X > v) = p
where X is a random variable from the Student's t distribution
with (df) degrees of freedom.
Note: T_CVF computes the cutoff value using the one-tailed probability.
The cutoff value for the two-tailed probability,
which is Probability(Abs(X) > v), can be computed as T_CVF(P/2, DF).
CATEGORY:
Statistics.
CALLING SEQUENCE:
Result = t_cvf(P, DF)
INPUTS:
P: A non-negative scalar, in the interval [0.0, 1.0], of type
float or double that specifies the probability of occurance
or success.
DF: A positive scalar of type integer, float or double that
specifies the degrees of freedom of the Student's t
distribution.
CALLS: ***
BISECT_PDF, T_PDF
EXAMPLE:
Compute the cutoff value (v) such that Probability(X > v) = 0.025
from the Student's t distribution with (df = 5) degrees of freedom.
The result should be 2.57058
result = t_cvf(0.025, 5)
REFERENCE:
APPLIED STATISTICS (third edition)
J. Neter, W. Wasserman, G.A. Whitmore
ISBN 0-205-10328-6
MODIFICATION HISTORY:
Modified by: GGS, RSI, July 1994
Minor changes to code. New documentation header.
CT, RSI, Jan 2003: Added note about this being a one-tailed test.
[Previous]
[Next]
NAME:
T_PDF
PURPOSE:
This function computes the probabilty (p) such that:
Probability(X <= v) = p
where X is a random variable from the Student's t distribution
with (df) degrees of freedom.
Note: T_PDF computes the one-tailed probability.
The two-tailed probability, which is Probability(Abs(X) <= v),
can be computed as 1 - 2*(1 - T_PDF(V, DF)).
CATEGORY:
Statistics.
CALLING SEQUENCE:
Result = T_pdf(V, DF)
INPUTS:
V: A scalar of type integer, float or double that specifies
the cutoff value.
DF: A positive scalar of type integer, float or double that
specifies the degrees of freedom of the Student's t
distribution.
CALLS: ***
IBETA
CALLED BY:
T_CVF
EXAMPLE:
Compute the probability that a random variable X, from the
Student's t distribution with (df = 15) degrees of freedom,
is less than or equal to 0.691. The result should be 0.749940
result = t_pdf(0.691, 15)
REFERENCE:
APPLIED STATISTICS (third edition)
J. Neter, W. Wasserman, G.A. Whitmore
ISBN 0-205-10328-6
MODIFICATION HISTORY:
Modified by: GGS, RSI, July 1994
Minor changes to code. New documentation header.
CT, RSI, March 2000: changed call from ibeta_pdf to ibeta
CT, RSI, Jan 2003: Added note about this being a one-tailed test.
[Previous]
[Next]
NAME:
TEK_COLOR
PURPOSE:
Load a color table similar to the default Tektronix 4115 color table.
CATEGORY:
Graphics.
CALLING SEQUENCE:
TEK_COLOR [[, Start_index] , Ncolors]
INPUTS:
Start_index = optional starting index of palette. If omitted,
use 0.
Ncolors = Number of colors to load. 32 is the max and the default.
KEYWORD PARAMETERS:
None.
OUTPUTS:
No explicit outputs.
CALLED BY:
ANNOTATE, EFONT, TIME_THREAD, VORONOI
COMMON BLOCKS:
Colors.
SIDE EFFECTS:
Ncolors color indices, starting at Start_index are loaded with
the Tektronix 4115 default color map.
RESTRICTIONS:
None.
PROCEDURE:
Just copy the colors. This table is useful for the
display of graphics in that the colors are distinctive.
Basic colors are: 0 - black, 1 - white, 2 - red, 3 - green,
4 - blue, 5 - cyan, 6 - magenta, 7 - yellow, 8 - orange, etc.
MODIFICATION HISTORY:
DMS, Jan, 1989.
DMS, June, 1992. Added colors common.
DMS, Apr, 1993, Added start_index and ncolors.
[Previous]
[Next]
NAME: TEST_HP
PURPOSE: Generate HP-GL output to test features of the driver.
CATEGORY: Graphics Drivers.
CALLING SEQUENCE:
TEST_HP
INPUTS:
None.
KEYWORD PARAMETERS:
EVASDROP - If this keyword *and* SMART are present, the output
is sent directly to the terminal with an evasdrop configuration
assummed.
SMART - If this keyword is present, it is assummed that the
plotter has a sheet feeder and is able to do
polygon filling. The HP7550A is an example of such
a plotter.
OUTPUTS:
If the SMART keyword is present, a file named hpdemo.1 is created
containing 4 pages of plotter output. If SMART and EVASDROP are
present, the output goes to the terminal. Otherwise, three files
named hpdemo.1, hpdemo.2, and hpdemo.3 are created containing
one page of output each.
RESTRICTIONS:
Expects the plotter to have 6 pens.
CALLS: ***
HP_ERASE, HP_HWTEXT, HP_LABEL_PAGE, HP_LINES_AND_COLOR, HP_POLYFILL
SIDE EFFECTS:
Output file(s) are created.
MODIFICATION HISTORY:
AB, July, 1989.
[Previous]
[Next]
Procedure to load a group of 16, 8, or 4 (depending on keyword)
colors for the LJ-250 . If 8 or fewer colors are to be defined, it is
assumed that 180 dpi resolution mode will be accessed. In this case,
selection is from a pre-defined set of 8 colors. For 16 colors, any
combination of the 256 available LJ-250 colors may be selected.
The group chosen here is an attempt to select a table which uses
a variety of colors, while maintaining some gradation between color
intensities.
CALLS: ***
DIST, LJLCT, LJ_DEPTH_TEST, LJ_IMAGE_TEST, LJ_LINE_TEST, LJ_LOADCT, LJ_PLOT_TEST
LJ_RESOLUTION_TEST, LJ_SHOW3_TEST, REVERSE, SHOW3
[Previous]
[Next]
Procedure to test the basic plotting capabilities of the LJ-250 driver,
including color selection.
CALLS: ***
DIST, LJLCT, LJ_DEPTH_TEST, LJ_IMAGE_TEST, LJ_LINE_TEST, LJ_LOADCT, LJ_PLOT_TEST
LJ_RESOLUTION_TEST, LJ_SHOW3_TEST, REVERSE, SHOW3
[Previous]
[Next]
Procedure to test the monochrome linestyle capability of the IDL
LJ-250 driver.
CALLS: ***
DIST, LJLCT, LJ_DEPTH_TEST, LJ_IMAGE_TEST, LJ_LINE_TEST, LJ_LOADCT, LJ_PLOT_TEST
LJ_RESOLUTION_TEST, LJ_SHOW3_TEST, REVERSE, SHOW3
[Previous]
[Next]
Procedure to generate a series of TV images on a page, for an LJ-250 driver
test. Monochrome (depth=1) is used, so that the dithering may be tested.
CALLS: ***
DIST, LJLCT, LJ_DEPTH_TEST, LJ_IMAGE_TEST, LJ_LINE_TEST, LJ_LOADCT, LJ_PLOT_TEST
LJ_RESOLUTION_TEST, LJ_SHOW3_TEST, REVERSE, SHOW3
[Previous]
[Next]
Procedure to test landscape and portrait graphics using both 90 and 180 dpi
LJ-250 resolutions. A total of four output files will be generated.
CALLS: ***
DIST, LJLCT, LJ_DEPTH_TEST, LJ_IMAGE_TEST, LJ_LINE_TEST, LJ_LOADCT, LJ_PLOT_TEST
LJ_RESOLUTION_TEST, LJ_SHOW3_TEST, REVERSE, SHOW3
[Previous]
[Next]
Procedure to create two disk files illustrating different depth
(bit plane) renditions available on the LJ-250 .
CALLS: ***
DIST, LJLCT, LJ_DEPTH_TEST, LJ_IMAGE_TEST, LJ_LINE_TEST, LJ_LOADCT, LJ_PLOT_TEST
LJ_RESOLUTION_TEST, LJ_SHOW3_TEST, REVERSE, SHOW3
[Previous]
[Next]
Procedure to create an output file for use on the LJ-250, which will
use the library procedure SHOW3.
CALLS: ***
DIST, LJLCT, LJ_DEPTH_TEST, LJ_IMAGE_TEST, LJ_LINE_TEST, LJ_LOADCT, LJ_PLOT_TEST
LJ_RESOLUTION_TEST, LJ_SHOW3_TEST, REVERSE, SHOW3
[Previous]
[Next]
NAME:
test_lj
PURPOSE:
To exercise and demonstrate various aspects of the IDL driver for
the Digital Equipment Corporation LJ-250 color printer.
CATEGORY:
Graphics Drivers.
CALLING SEQUENCE:
test_lj - Calls all test procedures, which may also be individually
called:
lj_plot_test - plot, contour, surface, plots, and vector fonts
lj_line_test - test of linestyles
lj_image_test - raster image output, for various dithering options
lj_resolution_test - test the two available resolutions (90 and 180dpi)
lj_depth_test - test different depth (bit plane) renditions
lj_show3_test - test the output using the SHOW3 procedure
INPUTS:
None
OPTIONAL INPUT PARAMETERS:
None
KEYWORD PARAMETERS:
None
OUTPUTS:
Creates LJ-250 compatible disk files: lj_plot_test.lj, lj_line_test.lj,
lj_image_test.lj, lj_90*.lj, lj_180*.lj, lj_depth123_test.lj,
lj_depth4_test.lj, and lj_show3_test.lj .
These files are not automatically submitted for printing; neither
are they deleted automatically.
To print the .lj files properly on a VMS system, it is recommended
that the /PASSALL qualifier be used with the PRINT command, to
pass all file information directly to the lj printer.
OPTIONAL OUTPUT PARAMETERS:
None
CALLS: ***
DIST, LJLCT, LJ_DEPTH_TEST, LJ_IMAGE_TEST, LJ_LINE_TEST, LJ_LOADCT, LJ_PLOT_TEST
LJ_RESOLUTION_TEST, LJ_SHOW3_TEST, REVERSE, SHOW3
COMMON BLOCKS:
None
SIDE EFFECTS:
Many .lj files will be created and left in the default directory.
RESTRICTIONS:
Designed for IDL Version 2; not compatible with VMS IDL Version 1.
PROCEDURE:
The called routines try different permutations of the allowable
keywords to the DEVICE procedure for the LJ-250. Vector plotting,
contour, line drawing, and surface plots are generated, as well
as a series of images which test all dithering methods.
The two resolutions of the LJ-250 are tested, and specific color
maps are used and tested.
MODIFICATION HISTORY:
Written, August 1990, TJA (derived from demo_pcl)
[Previous]
[Next]
Procedure to test the basic plotting capabilities of the pcl driver
CALLS: ***
DIST, PCL_IMAGE_TEST, PCL_LINE_TEST, PCL_OPTIMIZE_TEST, PCL_PLOT_TEST, REVERSE
[Previous]
[Next]
Procedure to test the linestyle capability of the IDL pcl driver
CALLS: ***
DIST, PCL_IMAGE_TEST, PCL_LINE_TEST, PCL_OPTIMIZE_TEST, PCL_PLOT_TEST, REVERSE
[Previous]
[Next]
Procedure to generate a series of TV images on a page, for a pcl driver
test
CALLS: ***
DIST, PCL_IMAGE_TEST, PCL_LINE_TEST, PCL_OPTIMIZE_TEST, PCL_PLOT_TEST, REVERSE
[Previous]
[Next]
Procedure to test landscape and portrait graphics using all three
optimization methods. A total of six output files will be
generated.
Note: All three optimization levels (0,1,2) are used; since not all
devices will support all levels, garbage could result.
CALLS: ***
DIST, PCL_IMAGE_TEST, PCL_LINE_TEST, PCL_OPTIMIZE_TEST, PCL_PLOT_TEST, REVERSE
[Previous]
[Next]
NAME:
test_pcl
PURPOSE:
To exercise and demonstrate various aspects of the HP PCL (Printer
Command Language) IDL driver.
CATEGORY:
Graphics Drivers.
CALLING SEQUENCE:
test_pcl - Calls all test procedures, which may also be individually
called:
pcl_plot_test - plot, contour, surface, plots, and vector fonts
pcl_line_test - test of linestyles
pcl_image_test - raster image output, with various dithering options
pcl_optimize_test - test file compression (optimization) methods
INPUTS:
None
OPTIONAL INPUT PARAMETERS:
None
KEYWORD PARAMETERS:
None
OUTPUTS:
Creates PCL disk files: pcl_plot_test.pcl, pcl_line_test.pcl,
pcl_image_test.pcl, pcl_opt*_land.pcl, and pcl_opt*_port.pcl.
These files are not automatically submitted for printing; neither
are they deleted automatically.
To print the .pcl files properly on a VMS system, it is recommended
that the /PASSALL qualifier be used with the PRINT command, to
pass all file information directly to the pcl printer.
OPTIONAL OUTPUT PARAMETERS:
None
CALLS: ***
DIST, PCL_IMAGE_TEST, PCL_LINE_TEST, PCL_OPTIMIZE_TEST, PCL_PLOT_TEST, REVERSE
COMMON BLOCKS:
None
SIDE EFFECTS:
Many .pcl files will be created and left in the default directory.
RESTRICTIONS:
Designed for IDL Version 2; not compatible with VMS IDL Version 1.
Procedure pcl_optimize_test uses all three (0,1,2) optimization
levels; since some devices do not support all of these levels,
garbage may result. Specifically, the HP LaserJet II does
not support optimization level 1; optimization 2 was primarily
designed for it. The HP DeskJet Plus supports all three
optimizations.
PROCEDURE:
The called routines try different permutations of the allowable
keywords to the DEVICE procedure for PCL. Vector plotting, contour,
line drawing, and surface plots are generated, as well as a series
of gray-scale images which test all dithering methods. File
optimization options are also tested.
MODIFICATION HISTORY:
Written, June 1990, TJA
[Previous]
[Next]
NAME:
THREED
PURPOSE:
Plot a 2D array as a pseudo 3D plot.
CATEGORY:
J7 Plotting, graphics, multi-dimensional.
CALLING SEQUENCE:
THREED, A [, Sp]
INPUTS:
A: The two-dimensional array to plot.
OPTIONAL INPUT PARAMETERS:
Sp: Spacing between plot lines. If sp is omitted, the spacing
is set to:
(MAX(A)-MIN(A))/ROWS
If Sp is negative, hidden lines are not removed.
KEYWORDS:
TITLE: The main plot title.
XTITLE: The X axis title.
YTITLE: The Y axis title.
OUTPUTS:
None.
COMMON BLOCKS:
None.
SIDE EFFECTS:
A plot is produced on the currently selected graphics device.
RESTRICTIONS:
Orientation of data is fixed.
Use the built-in procedure SURFACE for a more comprehensive surface
plotting routine.
PROCEDURE:
Straightforward.
A vector is maintained of the previous maximum plotted Y.
The PLOT and OPLOT procedures are used.
MODIFICATION HISTORY:
VERSION 1.2, CREATED BY D. LINDLER, AUGUST 5,1980
VERSION 1.3, CREATED BY I. DEAN AHMAD, JANUARY 28, 1981
MODIFIED FOR VAX, DMS, SEPT, 1982.
Modified for Unix, DMS, 2/15/88.
[Previous]
[Next]
NAME:
TIME_TEST
PURPOSE:
General purpose IDL benchmark program that performs
approximately 20 common operations and prints the time
required.
CATEGORY:
Miscellaneous.
CALLING SEQUENCE:
TIME_TEST [, Filename]
OPTIONAL INPUTS:
Filename: The string containing the name of output file for the
results of the time test.
KEYWORD PARAMETERS:
NoFileIO = Optional keyword when set disables file Input/Output
operations. Results from tests run in demo mode may be compared to
those run in full mode with this keyword set.
OUTPUTS:
No explicit outputs. Results of the test are printed to the screen
or to a file.
OPTIONAL OUTPUT PARAMETERS:
None.
CALLS: ***
DIST, FILEPATH, GRAPHICS_TIMES2_INTERNAL, GRAPHICS_TIMES3_INTERNAL
GRAPHICS_TIMES_INTERNAL, TIME_COMPARE, TIME_TEST2_INTERNAL
TIME_TEST3_INTERNAL, TIME_TEST_DUMMY, TIME_TEST_INIT, TIME_TEST_RESET
TIME_TEST_TIMER
COMMON BLOCKS:
TIMER_COMMON
SIDE EFFECTS:
Many operations are performed. Files are written, etc.
RESTRICTIONS:
Could be more complete, and could segregate integer, floating
point and file system IO times into separate figures.
PROCEDURE:
Straightforward.
See also the procedure GRAPHICS_TEST, in this file, which
times a few of the common graphics operations.
We make no claim that these times are a fair or accurate
measure of computer performance. In particular, different
versions of IDL were used.
Graphics performance varies greatly, depending largely on the
window system, or lack of thereof.
Typical times obtained to date include:
(where Comp. = computational tests
Graphics = graphics tests
Geo. Avg. = geometric average)
Machine / OS / Memory Comp. Geo. Avg. Graphics Geo. Avg.
MicroVAX II, VMS 5.1, 16MB 637 14.4 39.9 6.57
MicroVAX II, Ultrix 3.0, 16MB 616 13.9 58.1 8.27
Sun 3/110, SunOS 4.0, 12MB 391 8.19 32.0 7.81
Sun 3/80, 12MB, 24 bit color 282 6.03 89.3 21.7
PC 386 25MHz, 80387, MSDOS, 4MB 276 6.9 29.5 5.94
Mips R2030, RISC/os 4.1, 8MB 246 3.67 14.6 2.62
VAXStation 3100, VMS 5.1, 16MB 235 5.13 24.3 3.71
HP 9000, Model 375, ?? ?? 163 4.14 20.8 3.37
DecStation 3100, UWS 2.1, 16MB 150 4.00 17.6 3.23
486 33mhz Clone, MS Windows, 8MB 70 1.81 12.9 3.00
Sun 4/65, SunOS 4.1, 16MB 66 1.81 7.0 1.64
Silicon Graphics 4D/25, ?? 51 1.38 19.4 2.44
Sun 4/50 IPX, 16MB 40 1.03 7.7 0.80
IBM 6000 Model 325 24MB 40 0.87 5.8 1.21
HP 9000 / 720 48 MB 20 0.52 5.0 0.70
SGI Indigo XS4000, 32MB 20 0.46 2.1 0.44
SGI Indigo2, 150Mhz, 32MB 16 0.32 2.4 0.51
DEC Alpha 3000/500, 224MB 13 0.30 2.3 0.43
MODIFICATION HISTORY:
DMS, 1986.
DMS, Revised July 1990, Increased the size of arrays and the number
of repetitions to make most of the tests take longer.
This is to eliminate the effect of clock granularity
and to acknowledge that machines are becoming faster.
Many of the tests were made longer by a factor of 10.
MWR, Jan 1995, Modified to run in demo mode. All routines except
TIME_COMPARE now run in demo mode. Added platform and
version information. Added NoFileIO keyword.
[Previous]
[Next]
NAME:
TIME_TEST2
PURPOSE:
This is a wrapper on the procedure TIME_TEST2_INTERNAL contained
in the file time_test.pro. Please see that file for further
information. The reason for doing it this way is so that the
various time_test and graphics_test routines can stay in a single
file while still being easily callable.
CALLS: ***
TIME_TEST2_INTERNAL
[Previous]
[Next]
NAME:
TIME_TEST3
PURPOSE:
This is a wrapper on the procedure TIME_TEST3_INTERNAL contained
in the file time_test.pro. Please see that file for further
information. The reason for doing it this way is so that the
various time_test and graphics_test routines can stay in a single
file while still being easily callable.
CALLS: ***
TIME_TEST3_INTERNAL
[Previous]
[Next]
NAME:
TIME_THREAD
PURPOSE:
Math oriented multi-processing benchmark program used to
determine the performance of threaded math operations on
the current platform. It performs a simple addition of floating
point vectors, varying the number of CPUs used and the length
of the vectors. It can produce speedup data and/or a graphical
summary of the results.
CATEGORY:
Miscellaneous
CALLING SEQUENCE:
TIME_THREAD
KEYWORD PARAMETERS:
ALL_PLOT: Equivalent to setting all graphic producing keywords
(PLOT, PNG_PLOT, PS_PLOT). If those keywords
are also set independently, their values supersede ALL_PLOT,
which allows setting the file names.
MAX: Specifies the maximum number of elements in the vectors to
be added. The default for this value is 20 million.
MIN: Specifies the minimum number of elements in the vectors to
be added. The default for this value is !CPU.HW_NCPU.
NITER: Performance of threaded code is highly statistical. In order
to obtain statistically representative results, TIME_THREAD
performs each computation multiple times and then uses the
median time. The default is to interate 5 times. The NITER
keyword can be used to change this setting. (Hint: Setting
NITER to 1 and STEP to a small value is a good way to see
how volatile threading performance can be).
PLOT: If set, TIME_THREAD produces a plot of the results on the
current display.
PNG_PLOT: Produce graphic output in the PNG format. If PNG_PLOT is
set to a string value, that value is taken to be the file
name. Otherwise, a file named "tthread.png" is created
in the current working directory.
PS_PLOT: Produce graphic output in PostScript format. If PS_PLOT is
set to a string value, that value is taken to be the file
name. Otherwise, a file named "tthread.ps" is created
in the current working directory.
RESULT: If present, a named variable to receive a structure containing
all of the resulting data from the run of TIME_THREAD. RESULT
contains the following fields:
NELTS: Vector of NTEST (# of computations) values
giving the number of elements in each computation.
TIME: [ntest, ncpu] array giving the time required to
perform each computation.
SPEEDUP: [ntest, ncpu] array giving the speedup for each
computation when compared to the 1-cpu case for the
same number of elements.
VERSION: Contents of !VERSION.
DATE: Date string at which the tests completed.
HOSTNAME: Name of host.
NCPU: # of CPUs in the system.
NTHREADS: Maximum number of threads tested.
P: Proportion of computation that is parallelizable.
RESTORE: If set, TIME_THREAD recovers the data previously written
using the SAVE keyword from an IDL SAVE file. In this
case, no computation is done, and computation related
keywords are ignored. If RESTORE is set to a string value,
that value is taken to be the name of the SAVE file.
Otherwise, a file named "tthread.sav" is expected to
exist in the current working directory.
SAVE: If set, TIME_THREAD saves the results of the computation
in an IDL SAVE file. Such data can be reused in a subsequent
call using the RESTORE keyword without the need to re-compute
a potentially expensive operation. If SAVE is set to a
string value, that value is taken to be the name of the
SAVE file. Otherwise, a file named "tthread.sav" is
created in the current working directory.
SPEEDUP: If set, the name of variable to receive the result of
the computation. The resulting variable is a 2-dimensional
array
STEP: Specifies how many additional elements are added to the
vectors for each step. The default for this value is
10% of the difference between MAX and MIN.
TIME
VERBOSE: TIME_THREAD normally does its work quietly. Set VERBOSE
to cause informational information to be printed to the
screen as the computation progresses.
OUTPUTS:
None.
CALLS: ***
TEK_COLOR, TTHREAD_CALC_P, TTHREAD_INTERNAL, TTHREAD_LEGEND, TTHREAD_LEGEND_LINE
TTHREAD_LEGEND_PLINE, TTHREAD_PLOT
COMMON BLOCKS:
COLORS: Contains the current RGB color tables.
SIDE EFFECTS:
- Can change the current colortable via TEK_COLOR.
- If killed in mid computation, can leave the graphics and/or
threading state in an intermediate setting.
PROCEDURE:
TIME_THREAD adds vectors and notes the time taken to do so.
It starts with vectors of MIN floating point elements and progresses
towards vectors of MAX elements by adding STEP elements after
each computation. By altering the default values of these parameters
it is possible to obtain highly detailed information (at one extreme)
or to generate broad approximations of performance (at the other).
Each computation is performed on all possible numbers of CPUs for a
given machine in order to access how much improvement comes from
the addition of each processor. For example, on a dual processor
the computation is performed on 1, and then again on 2 CPUs. On
a 4 processor system, it is computed using 1, 2, 3, and 4 CPUs.
Tasks that benefit highly from extra CPUs are said to be
"scalable".
EXAMPLE:
It is a fact of threading life that using threads to solve a given
problem can take longer than a single threaded computation if the
problem size is too small. This occurs when the overhead of a
threaded computation (setting up the computation, and the cost
of thread communication) is not offset by overlapped computation. IDL
uses the !CPU.TPOOL_MIN_ELTS system variable to avoid using threads
in such situations. TIME_THREADS (which sets !CPU.TPOOL_MIN_ELTS
to a very low value) can be used to artificially observe this effect.
The following IDL command:
TIME_THREAD, MAX=500000, STEP=10000, PLOT
will show the poor performace that results from threading on a
problem that is too small.
MODIFICATION HISTORY:
7 June 1990, AB, Written to provide benchmarks for new thread
pool functionality in IDL.
[Previous]
[Next]
NAME:
TIMEGEN
PURPOSE:
The TIMEGEN function returns an array (with the specified dimensions)
of double-precision floating-point values that represent times
in terms of Julian dates.
CALLING SEQUENCE:
Result = TIMEGEN([D1,...,D8]
[, START=value [, FINAL=value]]
[, STEP_SIZE=value] [, UNITS=string]
[, YEAR=value] [, MONTH=vector] [, DAY= vector]
[, HOUR= vector] [, MINUTE= vector] [, SECOND= vector])
INPUTS:
Di The dimensions of the result.
KEYWORD PARAMETERS:
DAY If UNITS is set to "Years" or "Months",
then set this keyword to a scalar or a vector giving the
day values that should be included within each month.
If UNITS is set to "Days", "Hours", "Minutes", or "Seconds",
then set this keyword to a scalar giving the starting day
(in this case the day from START is ignored).
FINAL Set this keyword to a double-precision value representing the
Julian date/time to use as the last value in the returned array.
In this case, the dimension arguments are ignored and
Result is a one-dimensional array, with the number of elements
depending upon the step size. The FINAL time may be less than the
START time, in which case STEP_SIZE should be negative.
Note - If the step size is not an integer then the last element
may not be equal to the FINAL time. In this case, TIMEGEN will
return enough elements such that the last element
is less than or equal to FINAL.
HOUR If UNITS is set to "Years", "Months", or "Days",
then set this keyword to a scalar or a vector giving the
hour values that should be included within each day.
If UNITS is set to "Hours", "Minutes", or "Seconds",
then set this keyword to a scalar giving the starting hour
(in this case the hour from START is ignored).
MINUTE If UNITS is set to "Years", "Months", "Days", or "Hours",
then set this keyword to a scalar or a vector giving the
minute values that should be included within each hour.
If UNITS is set to "Minutes", or "Seconds",
then set this keyword to a scalar giving the starting minute
(in this case the minute from START is ignored).
MONTH If UNITS is set to "Years",
then set this keyword to a scalar or a vector giving the
month values that should be included within each year.
If UNITS is set to "Months", "Days", "Hours", "Minutes", or
"Seconds", then set this keyword to a scalar giving the starting
month (in this case the month from START is ignored).
SECOND If UNITS is set to "Years", "Months", "Days", "Hours",or "Minutes",
then set this keyword to a scalar or a vector giving the
second values that should be included within each minute.
If UNITS is set to "Seconds",
then set this keyword to a scalar giving the starting second
(in this case the second from START is ignored).
START Set this keyword to a double-precision value representing the
Julian date/time to use as the first value in the returned array.
The default is 0.0d [January 1, 4713 B.C.E. at 12 pm (noon)].
Note - If subintervals are provided by MONTHS, DAYS, HOURS, MINUTES, or
SECONDS, then the first element may not be equal to the START time.
In this case the first element in the returned array will be
greater than or equal to START.
STEP_SIZE Set this keyword to a scalar value representing the step size
between the major intervals of the returned array.
The step size may be negative. The default step size is 1.
For UNITS="Years" or "Months", the STEP_SIZE value is rounded
to the nearest integer.
UNITS Set this keyword to a scalar string indicating the time units
to be used for the major intervals for the generated array.
Valid values include:
"Years" or "Y"
"Months" or "M"
"Days" or "D"
"Hours" or "H"
"Minutes" or "I"
"Seconds" or "S"
The case (upper or lower) is ignored.
If this keyword is not specified, then the default for UNITS is
given by the next-largest time unit that is not specified
by a keyword. If none of the keywords are present then the
default is UNITS="Days".
YEAR Set this keyword to a scalar giving the starting year.
If YEAR is specified then the year from START is ignored.
OUTPUT:
The result returned by TIMEGEN is a double-precision array.
PROCEDURE:
Uses CALDAT, JULDAY.
CALLS: ***
CALDAT, JULDAY, TIMEGEN_DAY_CHECK, TIMEGEN_REBIN
EXAMPLE:
1. Generate an array of 366 time values that are one day apart:
MyDates = TIMEGEN(366, START=JULDAY(1,1,2000))
2. Generate an array of 20 time values that are 12 hours apart:
MyTimes = TIMEGEN(20, UNITS="Hours", STEP_SIZE=12, $
START=SYSTIME(/JULIAN))
3. Generate an array of time values that are 1 hour apart from
1 January 2000 until the current time:
MyTimes = TIMEGEN(START=JULDAY(1,1,2000), $
FINAL=SYSTIME(/JULIAN), UNITS="Hours")
4. Generate an array of time values composed of [seconds, minutes, hours]
that start from the current hour:
MyTimes = TIMEGEN(60, 60, 24, $
START=FLOOR(SYSTIME(/JULIAN)*24)/24d, UNITS="S")
5. Generate an array of 24 time values with monthly intervals, but with
subintervals at 5 pm on the first and fifteenth of each month:
MyTimes = TIMEGEN(24, START=FLOOR(SYSTIME(/JULIAN)), $
DAYS=[1,15],HOUR=17)
MODIFICATION HISTORY:
Written by: CT, RSI, May 2000.
[Previous]
[Next]
NAME:
TM_TEST
PURPOSE:
This function computes the Student's t-statistic and the probability
that two vectors of sampled data have significantly different means.
The default assumption is that the data is drawn from populations with
the same true variance. This type of test is often refered to as the
T-means Test.
CATEGORY:
Statistics.
CALLING SEQUENCE:
Result = TM_TEST(X, Y)
INPUTS:
X: An n-element vector of type integer, float or double.
Y: An m-element vector of type integer, float or double.
If the PAIRED keyword is set, X and Y must have the same
number of elements.
KEYWORD PARAMETERS:
PAIRED: If set to a non-zero value, X and Y are assumed to be
paired samples and must have the same number of elements.
UNEQUAL: If set to a non-zero value, X and Y are assumed to be from
populations with unequal variances.
EXAMPLE
Define two n-element vectors of tabulated data.
X = [257, 208, 296, 324, 240, 246, 267, 311, 324, 323, 263, 305, $
270, 260, 251, 275, 288, 242, 304, 267]
Y = [201, 56, 185, 221, 165, 161, 182, 239, 278, 243, 197, 271, $
214, 216, 175, 192, 208, 150, 281, 196]
Compute the Student's t-statistic and its significance assuming that
X and Y belong to populations with the same true variance.
The result should be the two-element vector [5.5283890, 2.5245510e-06],
indicating that X and Y have significantly different means.
result = tm_test(X, Y)
CALLS: ***
IBETA, MOMENT
PROCEDURE:
TM_TEST computes the t-statistic of X and Y as the ratio;
(difference of sample means) / (standard error of differences) and
its significance (the probability that |t| could be at least as large
large as the computed statistic). X and Y may be of different lengths.
The result is a two-element vector containing the t-statistic and its
significance. The significance is a value in the interval [0.0, 1.0];
a small value (0.05 or 0.01) indicates that X and Y have significantly
different means.
REFERENCE:
Numerical Recipes, The Art of Scientific Computing (Second Edition)
Cambridge University Press
ISBN 0-521-43108-5
MODIFICATION HISTORY:
Written by: GGS, RSI, Aug 1994
TM_TEST is based on the routines: ttest.c, tutest.c and
tptest.c described in section 14.2 of Numerical Recipes,
The Art of Scientific Computing (Second Edition), and is
used by permission.
CT, RSI, March 2000: removed redundant betacf, ibeta functions
[Previous]
[Next]
NAME:
TRACE
PURPOSE:
This function computes the trace of an N by N array.
CATEGORY:
Linear Algebra.
CALLING SEQUENCE:
Result = TRACE(A)
INPUTS:
A: An N by N real or complex array.
KEYWORD PARAMETERS:
DOUBLE: If set to a non-zero value, computations are done in
double precision arithmetic.
CALLED BY:
PCOMP
EXAMPLE:
Define an array, A.
A = [[ 2.0, 1.0, 1.0, 1.5], $
[ 4.0, -6.0, 0.0, 0.0], $
[-2.0, 7.0, 2.0, 2.5], $
[ 1.0, 0.5, 0.0, 5.0]]
Compute the trace of A.
Result = TRACE(A)
The result should be: 3.00000
REFERENCE:
ADVANCED ENGINEERING MATHEMATICS (seventh edition)
Erwin Kreyszig
ISBN 0-471-55380-8
MODIFICATION HISTORY:
Written by: GGS, RSI, January 1996
[Previous]
[Next]
NAME:
TRACKBALL
PURPOSE:
This object translates widget events for draw widgets into
transformations that emulate a virtual trackball (for transforming
object graphics in three dimensions).
CATEGORY:
Object Graphics.
CALLING SEQUENCE:
To initially create:
oTrackball = OBJ_NEW('Trackball', Center, Radius)
To update the trackball state based on a widget event:
oTrackball->Update, sEvent
To re-initialize the trackball state:
oTrackball->Reset, Center, Radius
To destroy:
OBJ_DESTROY, oTrackball
INPUTS:
TRACKBALL::INIT:
Center: A two-dimensional vector, [x,y], representing the requested
center (measured in device units) of the trackball.
Radius: The requested radius (measured in device units) of the
trackball.
TRACKBALL::UPDATE:
sEvent: The widget event structure. The event type indicates
how the trackball state should be updated.
TRACKBALL::RESET:
Center: A two-dimensional vector, [x,y], representing the requested
center (measured in device units) of the trackball.
Radius: The requested radius (measured in device units) of the
trackball.
KEYWORD PARAMETERS:
TRACKBALL::INIT:
AXIS: Set this keyword to indicate the axis about which
rotations are to be constrained if the CONSTRAIN
keyword is set to a nonzer value. Valid values
include:
0 = X-Axis, 1 = Y-Axis, 2 = Z-Axis (default)
AXIS: Set this keyword to indicate the axis about which
CONSTRAIN: Set this keyword to a nonzero value to indicate that
MOUSE: Set this keyword to a bitmask to indicate which
MOUSE: Set this keyword to a bitmask to indicate which
TRACKBALL::RESET:, TRACKBALL::UPDATE:
TRANSFORM: Set this keyword to a named variable that upon
TRANSLATE: Set this keyword to indicate that the trackball
a result of the widget event.
about a given axis (as specified by the AXIS
and the next highest bit represents the
and the next highest bit represents the, button, button, button, button
for the left, for the left, if a transformations matrix is calculated as
keyword is set to a nonzer value. Valid values
keyword). The default is zero (no constraints).
least significant bit represents the leftmost
least significant bit represents the leftmost
mouse button to honor for trackball events. The
mouse button to honor for trackball events. The, mouse button.
mouse button., movement should be constrained to x and y translation
rather than rotation about an axis.
return will contain a floating point 4x4 array
right button. The default is 1b, right button. The default is 1b
rotations are to be constrained if the CONSTRAIN
the next highest bit represents the middle
the next highest bit represents the middle
the trackball transformations are to be constrained
include:
0 = X-Axis, 1 = Y-Axis, 2 = Z-Axis (default)
CONSTRAIN: Set this keyword to a nonzero value to indicate that
MOUSE: Set this keyword to a bitmask to indicate which
about a given axis (as specified by the AXIS
and the next highest bit represents the, button, button, for the left
keyword). The default is zero (no constraints).
least significant bit represents the leftmost
mouse button to honor for trackball events. The, mouse button.
right button. The default is 1b
the next highest bit represents the middle
the trackball transformations are to be constrained
OUTPUTS:
TRACKBALL::UPDATE:
This function returns a 1 if a transformation matrix is calculated
as a result of the widget event, or 0 otherwise.
CALLS: ***
CROSSP, TRACKBALL::CLEANUP, TRACKBALL::INIT, TRACKBALL::RESET, TRACKBALL::UPDATE
TRACKBALL_CONSTRAIN, TRACKBALL__DEFINE
EXAMPLE:
Create a trackball centered on a 512x512 pixel drawable area, and
a view containing the model to be manipulated:
xdim = 512
ydim = 512
wBase = WIDGET_BASE()
wDraw = WIDGET_DRAW(wBase, XSIZE=xdim, YSIZE=ydim, $
GRAPHICS_LEVEL=2, /BUTTON_EVENTS, $
/MOTION_EVENTS, /EXPOSE_EVENTS, RETAIN=0 )
WIDGET_CONTROL, wBase, /REALIZE
WIDGET_CONTROL, wDraw, GET_VALUE=oWindow
oTrackball = OBJ_NEW('Trackball', [xdim/2.,ydim/2.], xdim/2.)
oView = OBJ_NEW('IDLgrView')
oModel = OBJ_NEW('IDLgrModel')
oView->Add, oModel
XMANAGER, 'TrackEx', wBase
In the widget event handler, handle trackball updates.
As the trackball transformation changes, update the transformation
for a model object (instance of IDLgrModel), and redraw the view:
PRO TrackEx_Event, sEvent
...
bHaveXform = oTrackball->Update( sEvent, TRANSFORM=TrackXform )
IF (bHaveXform) THEN BEGIN
oModel->GetProperty, TRANSFORM=ModelXform
oModel->SetProperty, TRANSFORM=ModelXform # TrackXform
oWindow->Draw, oView
ENDIF
...
END
MODIFICATION HISTORY:
Written by: DD, December 1996
[Previous]
[Next]
NAME:
TRI_SURF
PURPOSE:
This function Interpolates a regularly or irregularly gridded
set of points with a smooth quintic surface.
CATEGORY:
Mathematical functions, Interpolation, Surface Fitting
CALLING SEQUENCE:
Result = TRI_SURF(Z [, X, Y])
INPUTS:
X, Y, Z: arrays containing the X, Y, and Z coordinates of the
data points on the surface. Points need not be
regularly gridded. For regularly gridded input data,
X and Y are not used: the grid spacing is specified
via the XGRID and YGRID (or XVALUES and YVALUES)
keywords, and Z must be a two dimensional array.
For irregular grids, all three parameters must be
present and have the same number of elements.
KEYWORD PARAMETERS:
Input grid description:
REGULAR: if set, the Z parameter is a two dimensional array
of dimensions [N,M], containing measurements over a
regular grid. If any of XGRID, YGRID, XVALUES, YVALUES
are specified, REGULAR is implied. REGULAR is also
implied if there is only one parameter, Z. If REGULAR is
set, and no grid (_VALUE or _GRID) specifications are
present, the respective grid is set to (0, 1, 2, ...).
XGRID: contains a two element array, [xstart, xspacing],
defining the input grid in the X direction. Do not
specify both XGRID and XVALUES.
XVALUES: if present, XVALUES[i] contains the X location
of Z[i,j]. XVALUES must be dimensioned with N elements.
YGRID: contains a two element array, [ystart, yspacing],
defining the input grid in the Y direction. Do not
specify both YGRID and YVALUES.
YVALUES: if present, YVALUES[i] contains the Y location
of Z[i,j]. YVALUES must be dimensioned with N elements.
Output grid description:
GS: If present, GS must be a two-element vector [XS, YS],
where XS is the horizontal spacing between grid points
and YS is the vertical spacing. The default is based on
the extents of X and Y. If the grid starts at X value
Xmin and ends at Xmax, then the default horizontal
spacing is (Xmax - Xmin)/(NX-1). YS is computed in the
same way. The default grid size, if neither NX or NY
are specified, is 26 by 26.
BOUNDS: If present, BOUNDS must be a four element array containing
the grid limits in X and Y of the output grid:
[Xmin, Ymin, Xmax, Ymax]. If not specified, the grid
limits are set to the extent of X and Y.
NX: The output grid size in the X direction. NX need not
be specified if the size can be inferred from GS and
BOUNDS. The default value is 26.
NY: The output grid size in the Y direction. See NX.
Others:
EXTRAPOLATE: If set, extrapolate the surface to points outside
the convex hull of input points. Has no effect if
input points are regularly gridded.
MISSING: If set, points outside the convex hull of input points
are set to this value. Default is 0. Has no effect
if input points are regularly gridded.
LINEAR: If set, linear interpolation, rather than quintic is
used. Gradient estimates are not used. This is faster
and numerically stable, but does not extrapolate.
OUTPUTS:
This function returns a two-dimensional floating point array
containing the interpolated surface, sampled at the grid points.
RESTRICTIONS:
The output grid must enclose convex hull of the input points.
PROCEDURE:
This routine is similar to MIN_CURVE_SURF but the surface
fitted is a smooth surface, not a minimum curvature surface. This
routine has the advantage of being much more efficient
for larger numbers of points.
The built-in IDL routines TRIANGULATE and TRIGRID(/QUINTIC) are
used.
EXAMPLES:
Example 1: Irregularly gridded cases
Make a random set of points that lie on a gaussian:
n = 15 ;# random points
x = RANDOMU(seed, n)
y = RANDOMU(seed, n)
z = exp(-2 * ((x-.5)^2 + (y-.5)^2)) ;The gaussian
get a 26 by 26 grid over the rectangle bounding x and y:
r = TRI_SURF(z, x, y) ;Get the surface.
Or: get a surface over the unit square, with spacing of 0.05:
r = TRI_SURF(z, x, y, GS=[0.05, 0.05], BOUNDS=[0,0,1,1])
Or: get a 10 by 10 surface over the rectangle bounding x and y:
r = TRI_SURF(z, x, y, NX=10, NY=10)
Example 2: Regularly gridded cases
Make some random data
z = randomu(seed, 5, 6)
interpolate to a 26 x 26 grid:
CONTOUR, TRI_SURF(z, /REGULAR)
MODIFICATION HISTORY:
DMS, RSI, October, 1993. Written.
DMS, RSI, Jan, 1996. Added LINEAR keyword.
[Previous]
[Next]
NAME:
TS_COEF
PURPOSE:
This function computes the coefficients used in a Pth order
autoregressive time-series forecasting/backcasting model. The
result is a P-element vector whose type is identical to X.
CATEGORY:
Statistics.
CALLING SEQUENCE:
Result = TS_COEF(X, P)
INPUTS:
X: An n-element vector of type float or double containing time-
series samples.
P: A scalar of type integer or long integer that specifies the
number of coefficients to be computed.
KEYWORD PARAMETERS:
DOUBLE: If set to a non-zero value, computations are done in double
precision arithmetic.
MSE: Use this keyword to specify a named variable which returns the
mean square error of the Pth order autoregressive model.
CALLED BY:
TS_FCAST
EXAMPLE:
Define an n-element vector of time-series samples.
x = [6.63, 6.59, 6.46, 6.49, 6.45, 6.41, 6.38, 6.26, 6.09, 5.99, $
5.92, 5.93, 5.83, 5.82, 5.95, 5.91, 5.81, 5.64, 5.51, 5.31, $
5.36, 5.17, 5.07, 4.97, 5.00, 5.01, 4.85, 4.79, 4.73, 4.76]
Compute the coefficients of a 5th order autoregressive model.
result = TS_COEF(x, 5)
The result should be:
[1.30168, -0.111783, -0.224527. 0.267629, -0.233363]
REFERENCE:
The Analysis of Time Series, An Introduction (Fourth Edition)
Chapman and Hall
ISBN 0-412-31820-2
MODIFICATION HISTORY:
Written by: GGS, RSI, November 1994
Modified: GGS, RSI, January 1996
Added DOUBLE keyword.
Modified: GGS, RSI, June 1996
Replaced nested FOR loop with vector ops.
Faster execution for values of P > 100.
Modified: CT, RSI, October 2000: Make loop variables long integers.
[Previous]
[Next]
NAME:
TS_DIFF
PURPOSE:
This function recursively computes the forward differences, of an
N-element time-series, K times. The result is an N-element differenced
time-series with its last K elements as zeros.
CATEGORY:
Statistics.
CALLING SEQUENCE:
Result = TS_Diff(X, K)
INPUTS:
X: An n-element vector of type integer, float or double containing
time-series samples.
K: A positive scalar of type integer or long integer in the
interval [1, N_ELEMENTS(X) - 1], that specifies the number of
times X is differenced.
KEYWORD PARAMETERS:
DOUBLE: If set to a non-zero value, computations are done in
double precision arithmetic.
EXAMPLE:
Define an n-element vector of time-series samples.
x = [389, 345, 303, 362, 412, 356, 325, 375, $
410, 350, 310, 388, 399, 362, 325, 382, $
399, 382, 318, 385, 437, 357, 310, 391]
Compute the second forward differences of X.
result = TS_DIFF(x, 2)
The result should be:
[ 2, 101, -9, -106, 25, 81, -15, -95, $
20, 118, -67, -48, 0, 94, -40, -34, $
-47, 131, -15, -132, 33, 128, 0, 0]
REFERENCE:
The Analysis of Time Series (Fourth Edition)
C. Chatfield
ISBN 0-412-31820-2
MODIFICATION HISTORY:
Written by: GGS, RSI, December 1994
Modified: GGS, RSI, July 1996
Added DOUBLE keywork.
[Previous]
[Next]
NAME:
TS_FCAST
PURPOSE:
This function computes future or past values of a stationary time-
series (X) using a Pth order autoregressive model. The result is an
Nvalues-element vector whose type is identical to X.
CATEGORY:
Statistics.
CALLING SEQUENCE:
Result = TS_FCAST(X, P, Nvalues)
INPUTS:
X: An n-element vector of type float or double containing time-
series samples.
P: A scalar of type integer or long integer that specifies the
number of actual time-series values to be used in the forecast.
In general, a larger number of values results in a more accurate
result.
Nvalues: A scalar of type integer or long integer that specifies the
number of future or past values to be computed.
KEYWORD PARAMETERS:
BACKCAST: If set to a non-zero value, "backcasts" (backward-forecasts)
are computed.
DOUBLE: If set to a non-zero value, computations are done in
double precision arithmetic.
CALLS: ***
TS_COEF
CALLED BY:
TS_SMOOTH
EXAMPLE:
Define an n-element vector of time-series samples.
x = [6.63, 6.59, 6.46, 6.49, 6.45, 6.41, 6.38, 6.26, 6.09, 5.99, $
5.92, 5.93, 5.83, 5.82, 5.95, 5.91, 5.81, 5.64, 5.51, 5.31, $
5.36, 5.17, 5.07, 4.97, 5.00, 5.01, 4.85, 4.79, 4.73, 4.76]
Compute five future and five past values of the time-series using a
10th order autoregressive model.
resultF = ts_fcast(x, 10, 5)
resultB = ts_fcast(x, 10, 5, /backcast)
The forecast (resultF) should be:
[4.65870, 4.58380, 4.50030, 4.48828, 4.46971]
The backcast (resultB) should be:
[6.94862, 6.91103, 6.86297, 6.77826, 6.70282]
REFERENCE:
The Analysis of Time Series, An Introduction (Fourth Edition)
Chapman and Hall
ISBN 0-412-31820-2
MODIFICATION HISTORY:
Written by: GGS, RSI, November 1994
Modified: GGS, RSI, January 1996
Added DOUBLE keyword.
Added BACKCAST keyword.
Modified: GGS, RSI, June 1996
Modified keyword checking and use of double precision.
Modified: CT, RSI, October 2000: Make loop variables long integers.
[Previous]
[Next]
NAME:
TS_SMOOTH
PURPOSE:
This function computes central, backward or forward moving-averages
of an n-element time-series (X). Autoregressive forecasting and
backcasting is used to extrapolate the time-series and compute a
moving-average for each point of the time-series. The result is an
n-element vector whose type is identical to X.
CATEGORY:
Statistics.
CALLING SEQUENCE:
Result = TS_SMOOTH(X, Nvalues)
INPUTS:
X: An n-element vector of type float or double containing time-
series samples, where n >= 11.
Nvalues: A scalar of type integer or long integer that specifies the
number of time-series values used to compute each moving-average.
If central-moving-averages are computed (the default), this
parameter must be an odd integer of 3 or greater.
KEYWORD PARAMETERS:
BACKWARD: If set to a non-zero value, backward-moving-averages are
computed. The Nvalues parameter must be an integer greater
than 1.
DOUBLE: If set to a non-zero value, computations are done in
double precision arithmetic.
FORWARD: If set to a non-zero value, forward-moving-averages are computed.
The Nvalues parameter must be an integer greater than 1.
ORDER: A scalar of type integer or long integer that specifies
the order of the autoregressive model used to compute the
forecasts and backcasts of the time-series. Central-moving-
averages require Nvalues/2 forecasts and Nvalues/2 backcasts.
Backward-moving-averages require Nvalues-1 backcasts.
Forward-moving-averages require Nvalues-1 forecasts.
A time-series with a length in the interval [11, 219] will use
an autoregressive model with an order of 10. A time-series with
a length greater than 219 will use an autoregressive model with
an order equal to 5% of its length. The ORDER keyword is used to
override this default.
CALLS: ***
TS_FCAST
EXAMPLE:
Define an n-element vector of time-series samples.
x = [6.63, 6.59, 6.46, 6.49, 6.45, 6.41, 6.38, 6.26, 6.09, 5.99, $
5.92, 5.93, 5.83, 5.82, 5.95, 5.91, 5.81, 5.64, 5.51, 5.31, $
5.36, 5.17, 5.07, 4.97, 5.00, 5.01, 4.85, 4.79, 4.73, 4.76]
Compute the 11-point central-moving-averages of the time-series.
result = ts_smooth(x, 11)
REFERENCE:
The Analysis of Time Series, An Introduction (Fourth Edition)
Chapman and Hall
ISBN 0-412-31820-2
MODIFICATION HISTORY:
Written by: GGS, RSI, September 1995
Modified: GGS, RSI, July 1996
Modified keyword checking and use of Double precision.
Modified: CT, RSI, October 2000: Make loop variables long integers.