Knowledgebase: SMART

I am having trouble installing SMART. What do I do?

Read the SMART installation documentation carefully. In almost all cases, problems have been because of the order of directories in the IDL_PATH or a missing "+" sign or the absence of the IDL astro library in the IDL_PATH. Make sure you have the most recent IDL astro library installed. For example, if you have the idl astro libraries installed somewhere other than /usr/local/lib then you should change the setenv IDL_PATH statement to setenv IDL_PATH +/home/john/smart:+/home/john/IRS_Calibration:+/home/somewhere/astrolib:+/usr/local/lib

Does SMART work on Mac OSX ?

Yes. However, many mac owners use the bash shell. In that case, you must edit one line in each of two files:

line 46 of /smart/utility/misc/sm_list_files.pro
line 81 of /smart/scripts/pro/sc_read_fits_bcd.pro

In each file, the line in question should read:

if !version.os eq 'linux' or !version.os eq 'darwin' then begin

Therefore, you must add in the !version.os eq 'darwin'.

In SMART, how do I calculate the coordinates of the source depending on where I do the extraction within the slit ?

The values that are relevant are RA_SLT, DEC_SLT, PA_SLT. RA_SLT and DEC_SLT are different for different nod positions while RA_FOV and DEC_FOV remain the same between nods. So let's say your PA_SLT is 0 degrees (that means the long axis of the slit is rotated 0 degs east of north and the top of the slit is due north of the bottom of the slit). If PA_SLT is 90 degs, then the top of the slit is due E of both the slit center and the bottom of the slit. Now to map this onto a BCD.

For SH and SL, the source is first at the slit bottom and then the top (for the two nod positions). The bottom of the slit is mapped to the left of the BCD and the top of the slit is mapped to the right of the BCD. For LL and LH, the source is first at the top of the slit and then at the bottom. The top of the slit is mapped to the right of the BCD and the bottom of the slit to the left.

Now you want to calculate the coordinates of your source. Let's say your source is at pixel x. Then its offset from the slit center is alpha = (x-xcen)*pixscale in arcsec (you can look this up in the wavesamp_offset file or you can read x and xcen off with your cursor)

This has to be projected in RA and DEC.

delta_RA = alpha*sin(PA_SLT) in arcsec

delta_DEC = alpha*cos(PA_SLT) in arcsec

note that alpha is negative to the left of the center of the slit and positive to the right of center of the slit. So for all PA_SLT values between 0 and 90, delta_RA is -ve. For PA_SLT values between 0 and 180, delta_DEC is -ve.

Since cos(DEC) is pretty much constant over the length of even the longest subslit:

true_RA = RA_SLT +/- (abs(delta_RA)/3600.)*sec(DEC_SLT)

true_DEC = DEC_SLT +/- (abs(delta_DEC)/3600.)

where you use +/- depending on which quadrant you are in. Of course, to save you all this trouble, you can just extract a spectrum in SMART and save the extracted spectrum and it will give you the coordinates of the source you extract.

In SMART's interactive extraction mode, the size of the extraction window appears to be insensitive to the manually defined extraction width.

It has been reported by a user that selecting 'fixed column' extraction in the 'interactive extraction' will perform a fixed column extraction and will use the user-defined extraction width if you manually set the user-parameter !sm_fwhmfactor=+1 in the calibration setup. Or alternatively this can be done by typing !sm_fwhmfactor=1.0 at the IDL prompt, within the SMART environment. You will need to set this back to -1 when doing any other type of extraction. The effect of doing a fixed column extraction with !sm_fwhmfactor=-1 is to use the standard SSC-defined extraction windows (i.e. 4.25 pixels wide at 16 microns in LL2), but without scaling with wavelength, i.e., a fixed width of 4.25 pixels for LL2.

How do I script the extraction of multiple sources in SMART ?

Scripted autosky extraction hasn't yet been programmed into SMART and is on the to do list. However, you could look into the IDL source code to identify the subroutines which perform source extraction and write an IDL program which has just these routines (without the widget calling interface). For example the following segment provided by a user if incorporated inside an IDL routine would perform a basic extraction:

sc_read_fits_bcd, bcd_dir='/here/bcd' , ptr_bcd, filetype='bcd3p'

; Set calibration

sm_wavesamp, cal ;, /restore_cal, /save_cal

; difference the images by subtracting the image of the

sc_bcd_diff, ptr_bcd, newptr_bcd, debug=debug

; Set relevant SMART required keywords in BCD FITS headers

sm_preset_bcd, newptr_bcd

; Pre-process data for Column extraction

sm_auto_all, newptr_bcd, sigma=sigma, /column, /debug

; local sky extraction

sm_bcd_isap, cal, newptr_bcd, ptr_aar, 1, debug=1

Is there a data reduction cookbook for SMART ?

Yes, the developers of SMART have written a SMART cookbook.

Additional illustrations of data reduction with SMART can be found in the SMART section of the Spitzer Data Analysis Cookbooks page.

How do I bypass the usage of masks during extraction with SMART?

To do it you need to make your own extraction mask. The simplest way to do this is to write an IDL routine which makes a 128X128 array, sets the array elements to the values you want them to be and then writes out to a file. Mask files can be either ".fits" (binary) or ".txt" (ASCII) and for the SMART files we continue the file types used by SSC. Do NOT replace ".fits" file with a ".txt" or vice versa. SMART will crash if you try.

For example, suppose you want to change a bad pixel mask. In any of the SMART "bpm" files there is a 128X128 array where the elements corresponding to good pixels in the detector array are set to "1" and bad pixels are set to "0". During extraction the data array is multiplied by the bpm array. The good data points are unchanged, the bad ones set to zero.

If you do not want any data array pixels set to zero simply set all elements in the multiplying array to "1".

Add a header to your file by copying the one from the corresponding SMART supplied file and edit the comments to make it clear that this is a special file you have made yourself. SMART expects file headers and will crash without them.

Having made your file, give it a name that fits in with the SMART calibration file naming convention. This is described in detail here:

So for a new (long low for example) bpm file, the name would be something like "irs_ll_bpm_b1.fits".

The string "irs_ll_bpm" is what allows SMART to find the file. The "_b1" (or similar) is the version number. Do NOT give any file you make the same name/number as an existing file. Further all designations beginning "_v", "_s" and "_e" are reserved for future SMART and/or SSC file releases. Pick something completely different, like "_b" (for Ben).

Once you have made your file add it to SMART by putting it in the directory :

..../IRS_Calibration/type

Where "IRS_Calibration" is the top of the calibration files directory tree in your installation of SMART and "type" is the directory for the type of file you are adding. (For bpm the directory for this is "mask".)

DO NOT UNDER ANY CIRCUMSTANCES CHANGE, RE-NAME, MOVE, DELETE OR OVERWRITE ANY EXISTING SMART CALIBRATION FILE.

If you do this SMART will crash.

Once you have added the file to the calibration directory tree invoke SMART. Go to the SMART Calibration selection window. A description is available here:

From the Project Manager window click "Calibration" and "Setup". On the list of "SubDirs" pick the directory to which you have just added the new calibration file. For a bpm file this will be "mask". Scroll down to the relevant module and mask type (e.g. "ll_bpm") and click on the file displayed. Assuming you have added the new file with the right name and directory it will then appear on the drop down list of selectable calibration files for that type. Select it as default. It will display as the selected file. Then click on "Exit with this". The Calibration window will disappear and the default will be set to the new file you have added.

You can then run extractions using the file you have made. It may be best to run a few test extractions to check. At any time you can switch back to the original SMART supplied ones by returning to the Calibration Selection window and clicking on "Exit with SYS". This will re-set your defaults back to the SMART supplied original.

When I try to run SMART, I get syntax errors involving 'sxpar'. What is the problem?

You must add the astrolib library to your IDL path. Make sure that your IDL path includes SMART before astrolib.