Markwardt IDL Page

What's New

Programs
   Curve Fitting
   Fitting Tutorial
   Introspection
   Save Files
   Array/Set
   Printing
   Graphics
   Mathematics
   Ephemeris/Timing
   Input/Output
   Miscellaneous
   Full Listing
   Documentation

Google

Markwardt IDL Pages
Entire Web

Craig's techie blog.

Home Page of Craig Markwardt



 


IDL Array / Set Programs





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.

Nov 08 20087 kb multisort.pro  

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).

Nov 18 201023 kb hashtable__define.pro  

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.

Nov 24 20066 kb gtitrim.proREQUIRED  
May 19 20166 kb gti2mask.proGTI -> Grid  
Mar 22 20076 kb mask2gti.proGrid -> GTI  
Nov 24 200613 kb gtimerge.pro  
Apr 30 20014 kb gtienlarge.pro  
May 19 20164 kb gtiseg.proClustering  
Dec 21 20116 kb gtiwhere.pro  

Users of GTIWHERE and IDL 5.2 or earlier will also need a substitute version of VALUE_LOCATE.

Oct 13 20015 kb value_locate.proIDL 5.2 and earlier  

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.
Apr 18 20136 kb gapnan.pro  


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).

Mar 25 20012 kb cmproduct.pro  

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.

Nov 08 20085 kb arrinsert.pro  
Mar 25 20013 kb arrdelete.pro  

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.

Mar 28 200616 kb cmset_op.pro  

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.

Oct 02 20125 kb cmreplicate.pro  

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.

Aug 09 200614 kb cmapply.pro  


Copyright © 1997-2010 Craig B. Markwardt
Last Modified on 2017-01-03 13:57:30 by Craig Markwardt