slotphot – Photometry from SALT slot mode image data


slotphot images outfile srcfile (newfits) (phottype) (subbacktype) (sigback) (mbin) (iter) (sorder) (sigdet) (contpix) (ignorexp) (reltime) (finddrift) (clobber) (logfile) (verbose) (debug)


String. List of images to reduce. Data can be provided as a comma-delineated list, or a string with a wildcard (e.g. ‘images=S20061210*.fits’), or a foreign file containing an ascii list of image filenames. For ascii list option, the filename containing the list must be provided preceded by a ‘@’ character, e.g. 'images=@listoffiles.lis‘. Note that SLOT mode fits files often contain more than one exposed frame. In such cases, all frames will be reduced by default from any file specified in the list of images. saltphot works specifcally only on un-mosaiced data. Do not provide any files in this list that have been created by either the pmosaic, smosaic or saltmosaic tools.
String. Name of the output file. The output file is a 12-column ascii table. There is one row in the table for each exposed frame of the image sequence.

String. Name of the file defining the raw CCD pixel position of two sources in the image data and defining the size of circular aperture for the extraction of source counts and and a circular annulus for the extraction of background counts. The file format is an ascii table with 7 columns and 2 rows. An example is provided below:

# star amplifier   x   y  r r_bkg1 r_bkg2
# ---------------------------------------
1         3 193  11 12     13     14
2         3  37  12 12     13     14

Rows beginning with the character ‘#’ are ignored. Column 1 contains a numeric flag for the star which is either 1 or 2. The tool will follow any source drift over the image over time, always using star 2 as the ‘guide star’ The output file will always contain the source count ratio Star 1 / Star 2, never the inverse ratio. Column 2 of the srcfile contains the amplifier on which a source is detected. There are a maximum of four amplifiers for SALTICAM data and six amplifiers for RSS data. Note that there is no functionality currently to accurately extract source counts which fall across amplifier boundaries. Both sources are required to be on the same amplifier. Column 3 is the position of a source in (binned) CCD pixel units in the x-direction, or if you prefer the column number. Column 4 refers to the corresponding y- or row coordinate. Both x and y can be routintely read off of your ds9 viewer. Column 5 contains the radius of the circular extraction region for the source counts. Columns 6 and 7 contain the inner and outer radii of the annulus used to extract background counts for each source. Any of the radial parameters are permitted to fall off of the edges of the image without breaking the tool, some loss of performace should be expected but the tool does take the image edges into account during calculations. However, the onus is on the user to ensure that x and y are contained within the first image of the input list.

String. If newfits contains a value, then an output fits file only containing extensions with the target and companion star will be written out. If newfits contains none or is left empty, no data will be written out. The output images will be background subtracted (if selected).
phottype = [square|circular|cog|optimal]
String. The type of photometric method used for data analysis. The options are:
A square aperture with sides of length 2xr in the srcfile is used for both target and companion star
A circular aperture with radius of r as indicated in the srcfile is used for both target and companion star
Perform curve of growth photometry. Will measure even placed square apertures between 2 pix and the br2 radius as indicated in the srcfile. The number of square apertures is given by the radius in the srcfile. The sky background level is deteremined locally between the br1 and br2 radii. Photometry is returned in the square aperture with the maximum signal to noise for the comparison star. Photometry of the target star uses an aperture of the same size.
Calculate the optimal ratio between the two sources based X^2 pixel fit of the comparison star to the object star. For both stars the background will be removed and then the comparison star will be used as a ‘model’ psf for the X^2 fit. To simplify the error calculation, we are assume the errors on the comparison star are much smaller than the errors on the target star
Type of background subtraction used for the sources. Currently these are the options:
No background subtraction is done
After removing pixels which are sigback above the background deviation, the image is median smoothed with a bin size set by mbin. The smoothing is repeated iter number of times. The smoothed image is then subtracted from the original image.
After removing pixels which are sigback above the background, a 2-D polynomial surface with order set by sorder is fit to the image. The surface is then subtracted from the image.
The image is clipped, median smoothed, and then fit by a 2-D polynomial. The result is subtracted from the image.
Real. Pixels that are sigback times above the background deviation are replaced with the average value for the purposes of smoothing or surface fitting the image.
Int. The bin size of the median smoothing box. Assumed to be odd integers and will be rounded up to the next odd integer if even.
Int. The number of repeats to apply when smoothing the image.
Int. The order of the 2-D polynomial fit to the image for background subtraction.
Real. sigdet is the significance a source must have in order to be detected in the image. This is only used in the sub routine that follows the drift of the comparison star. If the comparison star has relatively small drift, this parameter will not be used. However, if the drift becomes large or a major shift occurs in the image, slotphot will detect all nearby objects and select the closest one to the previous location as the companion star.
Int. The number of continous pixels a source must have in order to be deemed a significant detection. Combined with sigdet, it is used for tracking a companion star with dramatic drift. If only small drift occurs, this parameter is not used. A large value is typically set so that comsic rays are not misidentified as the companion star.
Int. The number of amplifiers per CCD. If it is the newfits file and has already been processed by slotphot, then set to zero.
Integer >= 0. If ignorexp > 0 the first ignorexp frames will be skipped over before extraction is performed on ignorexp + 1 and all subsequent frames. This functionality is useful for SLOT mode data because the first few frames are generally empty. This is simply because SLOT mode involves continuous readout. The exposed area of the chip is some way from the readout boundary, so the first few frames of a sequence will contain CCD bias only.
Real. If drifitlimit is set to a positive value, the star will only be looked for in an area set by this radius. If no star is found in this area, the coordinates for the object will remain as in the previous frame. If drift limit is negative, the star will be searched for in the entire frame.
Boolean. If reltime=y, the time column in the output file and plot will be relative to the start time of the first recorded frame. If reltime=n, the time column will be relative to the previous midday (UTC).
Boolean. If finddrift=y, the SLOTPHOT will follow the comparison star if it drifts in the frame. If finddrift=n, only the initial x- and y-positions of the stars will be used.
Hidden Boolean. If clobber=y the tool is permitted to overwrite an exisiting file with name outfile.
String. Name of an ascii file for storing log and error messages from the tool. The file may be new, or messages can also be appended to a pre-existing file.
Boolean. If verbose=n, log messages will be suppressed.
Boolean. If debug=y, will give more debug information if an error occurs (use this option to gather information when reporting a bug).


This tool has been developed primarily to perform aperture photometry on SALTICAM slot mode data, and also perhaps Frame Transfer mode data which is an order of magntiude slower in frame rate. A specific SLOT mode tool was required in order to process the large body of image data in a reasonable amount of time. It is recommended that raw images be processed by the tool saltslot prior to aperture photometry.

Photometry is extracted from two user-defined sources contained in the input images. For the time being, both sources have to be on the same amplifier (extension). Source positions and extraction regions are defined in a user-prepared ascii table, fIsrcfilefR. The sources often drift around the slot on timescales of minutes. It is necessary therefore for saltphot to follow the sources over time, updating the postions in fIsrcfilefR frequently.

If selected, a global background will be subtracted from the data. The user options allow for three different options. One, no background can be subtrated. Two, the subtracted background can be created from a median smoothing of the image. Bright sources will be excluded from the image by setting the sigback value, and any pixel above that value will be replaced with the sigma-clipped mean background value of that row. The median smoothed image will have a filter window equal to mbin and the filtering will be repeated the number of times indicated by the iter parameter. Three, a median of a row will be subtracted from each row.

To capture the drift of the source, the algorithm first tries to find the source in the same coordinates as indicated by the user. If the source is found within a box of size 2r (where r is specificied in the srcfile for the companion star), then the companion star x and y values are updated and a similar shift is applied to the target stars coordinates. If the companion star is not found, the search is expanding to the columns within +-r of the original x coordinates. Objects are detected in these columns and the nearest star is selected as the comparison star. If the comparison star is still not found, the search is expanding to the entire image and the nearest star is found. If no star is find at all, the coordinates revert back to the last set of identified coordinates. The user can also set the maximum search area for the star by setting the driftlimit parameter. If the star is not found in that circle, no new coordinates will be set.

Once the companion and target star are found, photometry is performed on both sources. The options of the photometry are square, circular, cog, and optimal. Square photometry performs a single square aperture photometry around both sources. The local sky background is calculated in a square apreture defined by br1 and br2 in the srcfile and subtracted from the calculated magnitude. Circular photometry performs the same task except with circular, not square, apertures. For the circular photometry, no sub-pixel sampling occurs.

Curve of growth phtometry is performed by the cog function. N number of apertures ranging from a minimum of 2 pixels to a maximum of br2, where N is given by the r value of the comparison star in the srcfile. Then, the radius with the maximum signal to noise is calculated. Photometry for both the comparison star and target star are both given within this square aperture.

Finally, optimal photometry calculates the flux ratio between the comparison and target star by minimizing the X^2 difference between the two stars. The PSF of the comparison star is assumed to be the model, and the follow equation is minimized for h:

X^2=sum(T_ij - hxC_ij)**2/sigma_ij**2

In this equation, T_ij is the background subtract flux of the target source, C_ij is the background subtracted flux of the comparison star, sigma_ij is the variance in each pixel, and h is the normalization of the comparison star psf to the target star. The summation is done over a square aperture with sides of length 2r. If sigma_ij is assumed to be a constant for all pixels ( which is true for background limit observations, but also minimizes the dependance of h with the brightness of the star), then h is given by:

h = sum(T_ij x C_ij)/ sum(C_ij**2)

For optimal photometry, h is returned as the flux ratio, and the brightness of the target star is reported as hxC_ij.

Errors reported for all photometry types are calculated as the quadratic sum of the source flux, read noise, sky variance, and error in the measurement of the sky flux. The flux error is given by:


where flux is the counts for the source, area is the area of the aperture, rdnoise is the read noise, berr is the background error, and npix is the number of pixels used to determine the background error.

All results are written out to a file. The format of the output file records an id number, the time, the flux ratio, flux ratio error, the target x, y, flux, and flux error values, and comarison x, y, flux, and flux error values. The time is either the absolute time or the relative time since the first exposure depending on the reltime parameter.

If newfits is specified (not blank or ‘none’), then a new fits file will be created with the filename specified in the newfits parameter. The fits file will be a multi-extension fits file wher each extension will be an image that contains the target and comparison star (essentially removing all of the extensions in the image list that do not contain useful images).

Once the newfits file has been satisfactorily created, this file can be used in slotphot by setting ampperccd=0 and updating the other settings. The srcfile must be updated so the amplifier of the sources is set to 1. In addition, the newfits file should be set to ‘none’, the subbacktype should be updated, and ignorexp should be set to zero. Then, by setting the just created newfits file as the input img, slotphot will only perform photometry on this image.


  1. To extract counts from two field stars over a series of exposures:

    --> saltphot images="*.fits" outfile="result.dat" srcfile="targets.dat"
    newfits='out.fits', subbacktype='median', phottype='optimal',
    sigback=2.5, mbin=7, iter=3, sorder=3, sigdet=5, contpix=10,
    ignorexp=0 reltime=y finddrift=y clobber=y logfile=salt.log

Time requirements

A linux machine with 2 GB of RAM and a 2.8 Ghz processer was able to process one 4x4 binned SALTICAM slotmode exposures in 0.08 seconds. The data were median backgroun subtracted, finddrift=y, and optimal photometry was performed.

Bugs and limitations

The current version of SLOTPHOT has been tested only on SALTICAM slot mode data. Counts from only two stars can be extracted during one execution. Both sources must be on the same amplifier.

Send feedback and bug reports to

See also

Table Of Contents

Previous topic


Next topic


This Page