Gianluca Li Causi's
IDL LIBRARY

Procedures and Functions (last UPDATED on 5th october 2004)

Full Applications (last UPDATED on 17 june 2004)

Procedures and Functions

Programs List, in alphabetical order:
(more stars = more useful and cool!)

From this page you can download the source codes of some useful IDL procedures and functions that I've collected out of my work here at the Rome Astronomical Observatory.
New or improved routines will be added in future, keep in touch!

All these files can be also downloaded at once in a .zip file from here.



ANG_BAR        upd. march 2004

Computes the coordinates of the baricenter, on the sphere, of a set of points P.


Download from here.




ANG_DIST        upd. march 2004

Computes the angular distance, on the sphere, between two points of given [longitude, latitude] coordinates.


Download from here.




DRAW_INVERSE_BOX **        upd. february 2004

Overlays a rectangle over the current window with colors complementary to the underlaying pixels.


Download from here.




ENLARGE_CANVAS        upd. march 2004

Add a border to a 2-D image.
The added border are filled with 'value', but with the /mirror_edge keyword you can have the image edges mirrored out.

Very useful in conjunction with MEDIAN, SMOOTH, CONVOL, etc.


Download from here.




ENLARGE_CANVAS

Add a border to a 2-D image.
The added border are filled with 'value', but with the /mirror_edge keyword you can have the image edges mirrored out.

Very useful in conjunction with MEDIAN, SMOOTH, CONVOL, etc.


Download from here.




FFT_CONVOLUTION **        upd. february 2004

Computes the convolution of 1-D to 3-D arrays by using the FFT. Also allows to perform a multiple convolution, e.g. F * K1 * K2 * ... * Kn.


Download from here.




FSHIFT *        upd. february 2004

Shifts an image of fractional offsets


Download from here.




FT_PLOT ***       upd. september 2004

The FFT is always a bit difficult to graph: man's mind feels not easy to think in Fourier space, so that each time you must think about what the frequency axis of your FFT plot does mean with respect to your x units. More the IDL FFT vector contains both positive and negative frequencies organized in a complicated format: first nu=0, then +nu_min to +nu_max then again -nu_max to -nu_min. This routine made for you the correct positive frequencies plot of your FFT giving an easy to understand graph of it.

Plots the positive frequency part of a Fourier Transform by automatically computing the right frequency axis scaling and writing the right labels and units.
The user can choose to plot the modulus, the squared modulus, the real or imaginary part or the phase of the FT.
The original y(x) function of which FT is the transform can also be plotted if x and y vectors are supplied.

See also FT_SURFACE.



Download from here.




FT_SURFACE ***       upd. september 2004

The FFT is always a bit difficult to graph: man's mind feels not easy to think in Fourier space, so that each time you must think about what means the frequency axis of your FFT plot with respect to your x units. More the IDL FFT vector contains both positive and negative frequencies organized in a complicated format: first nu=0, then +nu_min to +nu_max then again -nu_max to -nu_min. This routine made for you the correct surface plot of your FFT giving an easy to understand graph of it.

Draw the shaded surface of a Fourier Transform by automatically computing the right frequency axis scaling and writing the right labels and units.
The user can choose to draw the modulus, the squared modulus, the real or imaginary part or the phase of the FT.
The original z(x,y) function of which FT is the transform can also be drawn if x and y vectors and z array are supplied.



Download from here.




GRID_IMAGE **        upd. july 2004

Creates the image of a regular grid of points or segments.
The grid can be flat or distorted (barrel or pincushion) by a cubic distortion.
High precision flux and sub-pixellization computation to use as test for distortion programs.



Download from here.




INSIDE        upd. february 2004

Check if a given point is outside or inside a convex quadrilater.


Download from here.




IS_NUMBER *        upd. february 2004

Check if a string has only numerical characters (also scientific notation).


Download from here.




LABEL_PLOT **        upd. march 2004

This procedure marks choosen points of a plot by automatically managing their position to avoid overlapping among labels and between labels and plotted data.
If it's not possible to find the space for a label, that label is neglected.
A segment is drawn from each label to the corresponding data point.



Download from here.




MED_NEIGBORHOOD **        upd. april 2004

Compute the median of an array avoiding the central point.
The array can of even length.
Useful to make running filters on data.



Download from here.




MULTI_DIALOG ***        upd. july 2004

MULTI_DIALOG can easily display a popup widget dialog to get any kind
of user input or to give textual information.
Arrays, structures, arrays of structures and nested structures are accepted as input.

It can display dialog widgets with input fields, with exclusive or
not exclusive check buttons, with file or directory fields with browse buttons,
or just textual information and can manage dialogs with a large number of
input items by automatically adding NEXT/PREVIOUS buttons in a multi-page layout.

It also automatically fits the widget size to both the iput items and
the title, and always keeps the widget within the screen area.

MULTI_DIALOG can manage multiple simultaneous dialogs, in a way
fully transparent to the user. In fact each time the funciton is called
in non-blocking mode, via the /NO_BLOCK keyword, a new MULTI-DIALOG widget
is created, while keeping active all already opened dialogs, still ready to
get user input.

MULTI-DIALOG automatically manages nested structures in a recursive way,
by opening MODAL simultaneous widget to edit any child element.




Download from here.




MYCOLORS *        upd. february 2004

	Result.black
	Result.white
	Result.red
	Result.green
	Result.blue
	Result.yellow
	Result.magenta
	Result.cyan

Creates a common structure with the definition of some basic colors for screen or postscript output.


Download from here.




OPLOTERR_XY *        upd. february 2004

Overplot both X and Y error marks or draw an error eclipse over ax existing plot.


Download from here.




OVERLAP *        upd. february 2004

Computes the area of the intersection of two convex quadrilaters.


Download from here.




P_AREA        upd. february 2004

The same of POLY_AREA but with DOUBLE precision.
Return the area of a polygon given the coordinates of its vertices.


Download from here.




PERMUTATION **        upd. february 2004

	   A B C
	   A C B
	   B A C
	   B C A
	   C A B
	   C B A

Computes all the permutation whithout repetition of the elements in the input array.


Download from here.




PIX_SAMPLE_1D **        upd. september 2004

This function does conceptually the same as the IDL function INTERPOL, i.e. it computes a regularly gridded representation of the given function y=f(x) where the x vector can also be non uniform.

The difference is that INTERPOL just interpolates the function onto a 1D regularly spaced grid, while PIX_SAMPLE_1D gives the pixel sampled array of the function, i.e. each point in the final array contains the mean of the input function over the sampling interval.

This makes difference when y(x) contains peak features narrower than the choosed sample interval.
In this case PIX_SAMPLE_1D will conserve the energy in each sampling interval whatever the choosed sampling resolution is.

Very useful when Fourier transforms are required for irregularly spacing of x: the transform of the 1-D vector could depend on the choosed sampling unless pixel sampling is used.

NOTE: if the y(x) input function represent the radial profile of a polar surface and this function is called to compute the final 2D polar surface, use PIXEL_SAMPLED_POLAR_SURFACE instead of this function.



Download from here.




PIX_SAMPLED_POLAR_SURFACE **        upd. september 2004

This function does conceptually the same as the IDL function POLAR_SURFACE, i.e. it builds a square array with the cartesian z=f(x,y) representation of a polar function described by z=f(r) where the r vector can also be non uniform.

The difference is that POLAR_SURFACE just interpolates the radial profile data onto a 2D cartesian grid, while PIX_SAMPLED_POLAR_SURFACE gives the pixel sampled image of such a polar surface.
This makes difference when r contains peak features narrower than the choosed sample interval (e.g. r is logarithmically spaced and is the intensity profile of a bright central star with an extended faint envelope).
In this case the PIX_SAMPLED_POLAR_SURFACE will conserve the energy in each pixel whatever the choosed sampling resolution.

Very useful when Fourier transforms are required for irregularly spacing of r: the transform of the 2-D surface will depend on the sampling unless pixel sampling is used.



Download from here.




PLOT_LOG *        upd. september 2004

The same of PLOT, but if the keywords /XLOG or /YLOG are used makes a logarithm plot with the best scaling.


Download from here.




PLOT_LON_LAT        upd. march 2004

Plot data on a spherical map and autoscale the map center and limits.


Download from here.




POLE_SPHERE_CIRCLE        upd. february 2004

This procedure computes the sherical coordinates of the north pole of a circle which passes for three points on a sphere or of the maximum circle passing for two points.


Download from here.




RADIAL_PROFILE **        upd. february 2004

Generates the radial profile image of the given image by using the median, the mean, the min or a polynomial fit.
Useful e.g. to fit a vignetting function to an image.


Download from here.




READ_PARAMETERS *        upd. june 2004

   # Comment
   TAG1 = value

   # Comment
   TAG2 = value
   ...

Reads a tagged list of parameters into a structure from a text file of the form reported here.
Any type of variables and 1-D arrays can be read.


Download from here.




READ_PARAMETERS_NUMBER        upd. april 2004

Returns the number of tag assignment in a parameter file of the form reported for READ_PARAMETERS


Download from here.




REJECT_1D *        upd. april 2004

Clean a 1-D array from the points out of a sigma threshold from their neigborhood. The outliers are deleted from the resulting array.


Download from here.




SEGMENT        upd. february 2004

Draws one or more segments inside a 2-D image.


Download from here.




SELECT_RECTANGULAR_BOX **        upd. february 2004

Interactively selecti a rectangle with the mouse on the given graphic window.
Use DRAW_INVERSE_BOX to draw the box.


Download from here.




SGN        upd. march 2004

Return the algebrical sign of its argument.


Download from here.




STACK_FRAMES **        upd. february 2004

Compute the SUM, the MEAN, the MEDIAN or the SIGMA-CLIPPED AVERAGE of a set of 2-D images.
Expecially drawn for astronomical pourpses to combine various images with cosmic rays removal.
Also returns the cosmic rays mask and the original images with the cosmic rays removed.



Download from here.




START ***        upd. june 2004

   # Procedure to run:
   rocedure = "my_procedure"

   # Procedure Directory:
   programs_path ="+C:\my_procedure_directory"

   # Library Directory:
   library_path ="+C:\my_libraries_directory"

Generic procedure to automatically start IDL with the right paths environment for a given program.
By simply writing in a Configuration File (e.g. the one reported here) the name of the procedure to run and the paths that it uses, the user can easily work with different projects, without to manually editing the IDL search and working directories at each time.
The routine will work on any operative system.


Download from here.




STAT *        upd. april 2004

   minimum
   maximum
   mean
   median
   mode
   sigma and variance
   gaussfit of histogram

Computes an extended statistics of an array.


Download from here.




STDEV_MED        upd. february 2004

Compute the Standard Deviation as the MEAN or the MEDIAN of the squared deviations from the MEDIAN.


Download from here.




STR_SUBST *        upd. february 2004

Replace all the occurrences of the string IN with the string OUT within a given string.


Download from here.




STR_WRAP        upd. february 2004

Divide one or more strings in pieces of a given lenght.


Download from here.




STRING_NUM *        upd. february 2004

Return a string representation of an integer with the digits right justified and the leading characters filled with zeroes, or with a user selected char.


Download from here.




STRING_TO_LONG        upd. february 2004

Converts all the numeric characters of a string into a Long type variable.


Download from here.




SX_RIORDINA        upd. february 2004

Order the FITS header so that the last keywords are HISTORY and COMMENTS


Download from here.




TV_ELLIPSE        upd. february 2004

Draw an ellipse on the current graphics device.
The same as TVELLIPSE of the ASTROLIB but with the keyword /NOCLIP added.
Clip the ellipse outside the plot region by default.



Download from here.




TV_GOHSS **        upd. february 2004

Display any kind of 2-D image with automatic ZSCALE gray levels, LOGARITHM scaling, histogram gaussfit ranging, stretch ranging, or user defined range and zoom scale.


Download from here.




WIDGET_CLOSE_ALL *        upd. february 2004

Delete all the widgets currently managed by XMANAGER, but the ones which IDs are in the SKIP vector.


Download from here.




WINDOWS_CLOSE_ALL *        upd. february 2004

Deletes all the curretly opened windows, but the ones written in the SKIP keyword.


Download from here.




WRITE_PARAMETERS *        upd. april 2004

Updates a text file with a tagged list of parameters in the form reported for READ_PARAMETERS.


Download from here.




ZSCALE_RANGE        upd. february 2004

Returns the best low_cut and high cut values for the visualization of an image, on the base of the IRAF Zscale algorithm.
Used by TV_GOHSS.


Download from here.






This page is written by Gianluca Li Causi
licausi@mporzio.astro.it