This is an important routine, which you need to set up properly when you first install the shapelet routines. It acts as a central look-up table for the correct path names to data directories, shapelet catalogues and SExtractor configuration files. Changing just a few lines in this one file then allows all the other routines to look for data in the right place automatically. It also redirects their output to be written to the same location without constantly typing in an entire pathname. I hope that this scheme is convenient!
The syntax of this routines is relatively straightforward. The parameter n is taken as an input, and should be an integer. This number is compared against a series of options; and the corresponding pathname in a string out is selected to output. Some input parameters cause this routine to recursively call itself, then concatenate several sub-strings to form the the final path name. This uses the IDL string concatenation operator "+".
Your job is to make sure that the various strings correspond to locations on your computer. For example, the string after option 1 should point to the base data directory and after option 3 should point to the directory containing images. By default these are the same, but you are free to reorganise your filing system and change any of the strings! It would also be a good idea to personalise the line that says "Shapelet export version of path names!" to something more memorable, perhaps with your own name in it. Then you will remember that you've changed this file if you later overwrite it by installing a future version of the shapelets code.
If you open the file shapelet_paths.pro in the IDL development environment, it should look something like the diagram below. (If this extends too far off the edge of your browser, try reducing the font size). The comments in green, and the annotations at the sides, should help to explain each step.
| - shapelets_paths.pro | - × | |||||||
|---|---|---|---|---|---|---|---|---|
| There is also a copyright notice inserted here. | function shapelets_paths, n, SILENT=silent | <-- | -- | Declares the name of the routine. This function takes one input variable, n, and an optional flag, /SILENT (equivalent to writing SILENT=1). It returns a string filepath. |
||||
| ---> | ||||||||
| ; + | ||||||||
| ; NAME: | ||||||||
| ; shapelets_paths | ||||||||
| ; | ||||||||
| ; PURPOSE: | ||||||||
| ; This stores the locations of data on a locally accesible hard disc. | ||||||||
| ; Please update this file so that all the strings point to the correct | ||||||||
| ; locations! | ||||||||
| ; | ||||||||
| ; CATEGORY: | ||||||||
| Anything on the same line following a semicolon is a comment. | ; Disc management. | |||||||
| ; | ||||||||
| ; CALLING PROCEDURE: | ||||||||
| ; filepath=shapelets_paths(1,/SILENT) | ||||||||
| ; | ||||||||
| ; INPUTS: | ||||||||
| ; n - integer scalar. Which path? | ||||||||
| ; | ||||||||
| ; KEYWORD PARAMETERS: | ||||||||
| ; [/SILENT] - If this flag is set, the routine operates silently. | Various bits of information are noted in the header. | |||||||
| ; | ||||||||
| ; OUTPUTS: | ||||||||
| ; A string containing a filepath. | ||||||||
| ; | ||||||||
| ; EXAMPLE: | ||||||||
| ; Find the location where data is stored on the local disc. | ||||||||
| ; | ||||||||
| ; filepath=shapelets_paths(1) & print,filepath | ||||||||
| ; | ||||||||
| ; In this case (1), it is the base directory where data such as images, | ||||||||
| ; shapelet/SExtractor catalogues or PSF images are stored.; | ||||||||
| ; | ||||||||
| ; NOTES: | ||||||||
| ; I have created this function so that the shapelet routines can be | ||||||||
| ; quickly set up to run on a new computer, and only this file needs to | ||||||||
| ; be altered. | ||||||||
| ; | ||||||||
| ; PROCEDURES USED: | ||||||||
| Prints a message to screen to let you know this routine is being accessed. It would be a good idea to personalise this message. | ; Often calls itself recursively. | |||||||
| ; | ||||||||
| ; MODIFICATION HISTORY: | This path should the directory where you installed the shapelets routines. I like to use the same routines on both my Windows and Linux computers, which require different directory structures. Just change whichever one you need. Note that in this case, the option "unix" is returned whether you are using UNIX or Linux. |
|||||||
| ; Jul 03 - Finalised for version 1 of shapelet code release by RM. | ||||||||
| ; Jul 01 - Written by Richard Massey | ||||||||
| ; - | ||||||||
| ---> | message,'Shapelet export version of path names!',/info,noprint=silent | |||||||
| Select only one of the following options, depending on the value of n, and execute the subsequent code. | ---> | case n of | ||||||
| 0: begin ; Base IDL directory | ||||||||
| case !version.os_family of | ||||||||
| 'Windows': out='C:\Documents and Settings\My Documents\idl\shapelets\' | ||||||||
| 'unix': out=expand_path('~')+'/idl/shapelets/' | <-- | -- | ||||||
| else: out=expand_path('~/idl/shapelets')+path_sep() | ||||||||
| endcase | ||||||||
| end | ||||||||
| 1: $ ; Generic base data directory | Options 1, 2 and 3 all return the same value by default. The example image will be in this directory if you downloaded the accompanying example data. Its SExtractor and shapelet catalogues will also be created here when you try the example walkthrough. | |||||||
| out=shapelets_paths(9,/silent)+'data/' | <--- | -- | ||||||
| 2: $ ; Directory containing object catalogues (*.sex and *.shape) | ||||||||
| out=shapelets_paths(1,/silent) | <--- | -- | ||||||
| 3: $ ; Directory containing images (*.fits) | ||||||||
| out=shapelets_paths(1,/silent) | <--- | -- | ||||||
| If no other option matches number, write a suitable message to the screen and halt everything that's running in IDL (including the routine that called this one). | 4: $ ; HST TinyTim PSF | |||||||
| out=shapelets_paths(1,/silent)+'PSF/TinyTim_PSF.fits' | <-- | -- | Default locations of some PSF models used for deconvolution. These images are included in the accompanying example data. | |||||
| 5: $ ; Raytraced SNAP PSF | ||||||||
| out=shapelets_paths(1,/silent)+'PSF/SNAPpsf.fits' | <-- | -- | ||||||
| 7: $ ; SExtractor directory | Default directory containing SExtractor (and "shextractor" configuration files). | |||||||
| out=shapelets_paths(9,/silent)+'shapelets/shextractor/config/' | <-- | -- | ||||||
| 8: $ ; SExtractor executable | ||||||||
| out='/usr/local/optical/sextractor/bin/sex' | <-- | -- | Full path to the SExtractor executable. | |||||
| ---> | else: message, $ | |||||||
| 'Please set up shapelets_paths.pro to include the location of this file!' | ||||||||
| endcase | ||||||||
| Expands any metacharacters in the selected path (like ~ to /home/) and outputs the string to the routine that called this one. | ||||||||
| return,expand_path(out) | <-- | -- | ||||||
| end | ||||||||
See also the header below, which has been extracted from the source code for this routine.
; NAME: ; SHAPELTS_PATHS ; ; PURPOSE: ; This stores the locations of data on a locally accesible hard disc. ; Please update this file so that all the strings point to the correct ; locations! ; ; CATEGORY: ; Disc management. ; ; CALLING PROCEDURE: ; filepath=shapelets_paths(1,/SILENT) ; ; INPUTS: ; n - integer scalar. Which path? ; ; KEYWORD PARAMETERS: ; [/SILENT] - If this flag is set, the routine operates silently. ; ; OUTPUTS: ; A string containing a filepath. ; ; EXAMPLE: ; Find the location where data is stored on the local disc. ; ; filepath=shapelets_paths(1) & print,filepath ; ; In this case (1), it is the base directory where data such as images, ; shapelet/SExtractor catalogues or PSF images are stored. ; ; NOTES: ; I have created this function so that the shapelet routines can be ; quickly set up to run on a new computer, and only this file needs to ; be altered. ; ; PROCEDURES USED: ; Often calls itself recursively. ; ; MODIFICATION HISTORY: ; Apr 05 - Compatability with other OSs improved by RM. ; Jul 03 - Finalised for version 1 of shapelet code release by RM. ; Jan 01 - Written by Richard Massey
View the full source code for this routine, return to the shapelets web page, or return to the code help menu.
| Last modified on 2nd Mar 2009 by Richard Massey. |