MULTISORT - Sort on multiple keys
The function MULTISORT performs a sorting operation with multiple
sort keys. Unlike the IDL built-in SORT() function, which can
only sort a single key, MULTISORT can accept multiple keys. In
cases where the primary key is equal, the sort order is based on
any secondary keys provided. The return value is an array of
indices which will place the key arrays into sorted order.
HASHTABLE - A hash table object
This HASHTABLE object is a variable-sized hash table data
structure. The key values must be scalar strings, but the associated
values may be any allowed IDL data type. A hash table is created
using the standard object life cycle functions. Entries are added
using the ADD method, and lookups are performed using the GET method.
While this object has not be super-optimized, it still is able to hash
about 12,000 entries per second (30-character keys; 1.1 GHz Athlon).
GTI - Manipulate 1-D Intervals (GTIs)
This set of routines is used for manipulating so-called Good Time
Intervals (GTIs). In the context of satellite astronomy it is useful
for composing and manipulating a record of multiple short observations
of an astronomical source. Each observation interval is a segment of
time referred to as a good time interval. A GTI array is a
2xNINTERVAL array where NINTERVAL is the number of intervals; each
pair in the array describes the start and stop times of one
interval.
While the documentation specifically refers to "time" as the
quantity of interest, in truth any one-dimensional quantity can be
divided into intervals and manipulated using this library.
Routines are provided to convert between GTI and gridded
representations (GTI2MASK, MASK2GTI and GTITRIM); to perform the union
and intersection operations between two sets of GTIs (GTIMERGE); to
enlarge and shrink GTIs (GTIENLARGE); to group clustered points into
contiguous intervals (GTISEG); and to test whether a point or points
falls into a set of GTIs.
Users of GTIWHERE and IDL 5.2 or earlier will also need a
substitute version of VALUE_LOCATE.
GAPNAN - Insert NANs in time series gaps to facilitate plotting
This procedure is an covenience procedure for plotting time series
which may have gaps. In other words, a time series where there
will be time segments of data, and periods of no data which are
considered "gaps." Sometimes it is desireable to plot the data
with lines connecting the data, but no lines across gaps.
GAPNAN will insert NAN values in time series between gaps.
Because an IDL line plot will not connect points with NAN values
between them, inserting a NAN value is an effective way of
suppressing connecting lines between gaps.
The user can specify gaps in one of two ways, using either the
MAXGAP keyword, or the GTI keyword which gives a list of good time
intervals (see above). The user must specify one of these keywords,
but not both.
CMPRODUCT - Compute the fast product of a large array
There is no built-in multiplicative equivalent to TOTAL. That is,
it is difficult to efficiently compute the product of many numbers.
Using a FOR loop is often very slow.
CMPRODUCT is a function which computes the product of all elements
in an array quickly. The algorithm divides the array in half
successively, making as many large-vector multiply operations as
possible, hence making the overall result faster. The total number of
multiplications is still N_ELEMENTS(ARRAY).
ARRINSERT - Efficiently insert / delete elements in an array
One can often treat a 1-D vector equivalent to a list in IDL.
However there are a lot of special cases to worry about, especially
when the list is "empty."
ARRINSERT is a function which inserts one array into another.
Empty arrays are explicitly permitted and handled correctly. Copying
is minimized to improve performance for large arrays.
ARRDELETE is a function which deletes a section of an array.
Again, empty arrays are explicitly permitted.
CMSET_OP - Perform set operations on numbers and strings
CMSET_OP performs three standard binary operations -- intersect,
union and exclusive or -- on sets. The sets are passed as one
dimensional IDL arrays of any numeric or string type. So for example,
if you had two lists of filenames, and wanted to find the filenames
that were common to both lists, you would use set intersection.
CMSET_OP also allows you to "negate" or take the complement of
either operand when performing intersections. This makes it easy, for
example, to find those elements in list A but NOT list B.
CMREPLICATE - Generic replacement for REPLICATE
CMREPLICATE performs a function similar to IDL's built-in function
REPLICATE. The key difference is that the template value can be a
scalar or an array of any type. Thus, you might consider
CMREPLICATE to be a more generic replacement to REPLICATE. The
calling sequences are slightly different, but the function is
essentially the same. The implementation uses the fast REBIN routine
where possible, and is quite speed efficient.
CMAPPLY - Apply generic function to array
There has been talk on the IDL newsgroup on how to apply functions
to certain selected dimensions of an array. For example, TOTAL(ARRAY,
DIM), the built-in IDL function does allow you to pick one dimension
to be summed, leaving all other dimensions unchanged. I needed that
interface to be more general, including the ability to do more than
one dimension, and also to apply a function other than simple
addition.
CMAPPLY(OP, ARRAY, DIMS) will apply the function OP to an ARRAY
over any dimensions listed in DIMS. If you like, you can think of
CMAPPLY as a generalized version of TOTAL, allowing more than one
dimension. But you should be aware that you can apply more than just
addition (OP='+'). I have programmed a number of operations that
seemed useful or straightforward, and the implementation avoids
interpretted loops where feasible. The following operations are
available:
- '+' - performs addition (as TOTAL does)
- '*' - performs multiplication
- 'AND' - performs logical "AND"
- 'OR' - performs logical "OR"
- 'MIN' - finds minimum value in specified dimensions
- 'MAX' - finds maximum value in specified dimensions
- 'USER' - applies user-defined function
The equivalent of the IDL expression "XX = TOTAL(A,2)" is
"XX = CMAPPLY('+',A,[2])". Of course, if you wanted to sum
over more axes than just one, then you would supply that list of
dimensions to CMAPPLY instead of just "[2]".
CMAPPLY can now apply a user-defined function. While the function
itself must be defined strictly, it may accept any number of keyword
parameters. Inspired by Alex Schuster.
|