next up previous
Next: About this document ...

SPARO Photometry Analysis Instructions

I. Introduction

This document details the procedures for analyzing photometry scans done with SPARO during its first deployment period. In order to check pointing and to identify sources, SPARO is capable of being run in a scan mode which consists of taking one nod pair of observations at a particular point in the sky and then moving to a new position and then doing the same. This process is repeated until an arbitrary (eg. ) patch on the sky is covered. Each position will produce a file on the Macintosh data system computer. The results from these files can be read and analyzed with the software packages described here.

The general outline of the program is as follows. The binary data must be ftp-ed to belmont and then processed through integ (same as polarimetry data). From there, phot must be used to compile the ascii data into one list of data points with celestial coordinates. This list can be input into the premat program which converts the data into a matlab-readable grid. The matlab script file plscr will then generate both a false color image and a contour map.

A directory structure has been established to facilitate this analysis. All files necessary for the execution of the analysis software are found in the /export/home/poldata/Photometry directory. This directory is subdivided into several directories. The bin directory contains compiled c-code of the necessary programs. The matlab directory contains the necessary matlab scripts. The data directory is used to store the data files initially. Finally, the doc directory contains the necessary documentation including this file. An example command script called run has been included to guide the photometry process.

II. integ

The integ program is described in detail in its internal documentation and won't be described here. Basically, integ processes the binary nod pair information and produces an output file which gives polarimetry and photometry data in ascii format.

III. phot

phot collects the information from one output file from integ and calculates an RA and Dec for each of the pixels of SPARO. The program then appends the user specified output file with the nine data points collected from the given observation. A word of caution: because of the use of the append mode here, when creating a new map, make sure that for the first time phot is called, the output filename is not an existing file. The calling protocal (in standard unix) is:

phot -i inputfilename -o outputfilename [-a rotation] [-d  value]

-i inputfilename The name of the input file.
-o outputfilename The name of the output file.
-a rotation The rotation of sparo on the sky.
-d value Run in one of three debug modes.

Filenames must be given for the input and ouput data. The rotation angle refers to the angle at which the array grid is projected onto the sky. by convention, this program considers the rotation angle the clockwise rotation of the array vertical axis(the line connecting pixels 2,5,8) with respect to celestial North. Note also that it is necessary to add to this angle when dealing with a southern hemisphere telescope. This parameter should be entered in degrees. The code performs this rotation about the boresight pixel. The information on which pixel is the boresight pixel is read out of the header from the input file. Currently the pixel separation parameter is hardwired into the header file and is set to 240''.

For any changes to the structure of the code, one can run the executable script linkphot located in /export/home/poldata/Code/photosearch. This will update that directory's local copy of phot. This binary can then be moved to the binary directory.

IV. count

Because the matlab preprocessing code expects to see a single number on the first line of its input text file, some minor manipulation has to be done before calling it. Since phot is designed as an opened ended text file modifier(it relies on an append mode in its output), there is really no good way to tell it ahead of time how many data points it will end up with. In order to compensate, the small program count has been implimented to count the number of lines in the data file and then place that number in a new file. The unix command cat file1 file2 >! file3 will creat a new file3 which can be read by premat if the first two files are the outputs of count and phot, respectively. The call is simple:

count -i inputfilename -o outputfilename              

-i inputfilename The name of the input file.
-o outputfilename The name of the output file.

V. premat

premat is a piece of code which processes the data list output from phot in order to allow matlab to easily handle the oddly spaced data. The concept is to creat a grid(matrix) with much higher angular resolution than the SPARO beam size. The pixels are then set to the value of the observation if they fall under a beam. The code has a few scaling options along with some smoothing options. The call is as follows.

premat  -i inputfilename -o outputfilename [-s option][-k size] [-l scale ] [-a attenuation]

[-p pscale] [-m xval] [-n yval]

-i inputfilename The name of the input file.
-o outputfilename The name of the output file.
-s smoothing Smoothing. 0: none 1: flat 2: Gaussian
-k size Size of smoothing kernel
-l scale 0: linear 1: square root 2: log
-a attenuation Override attenuation
-p pscale Override plate scale
-m xval Override the x dimension
-n yval Override the y dimension

The ouput file should be called ``outfile'' since this is the name which the matlab routine recognizes. Since this code preprocesses the image, most of the options for how the image should look are selected at the call line for premat. Again, here the two filenames are essential. The smoothing option allows one to pick a form of smoothing to better view the image. No smoothing is the default. Flat smoothing runs a kernel over each pixel of a specified size and replaces the value of the pixel with the mean of the nonzero pixels under the circular kernel. Gaussian smoothing does essentially the same thing, but weights the kernel with distance. The standard deviation is determined by dividing the size of the kernal by 4. This is a good technique for recovering Gaussian profiles. The size of the kernal defaults to 11 pixels and any override must be odd. The scaling of the image can be manipulated. The default is linear scaling. The default plate scale is 200 pixel per degree. The default image size is 100 pixels squared. SPARO's beam size of 4 arcminutes is hardwired into the code in the header file.

If the code needs to be changed, a linkpremat file is included in the /export/home/poldata/Code/premat directory and the binary can be generated and moved in the same way as the above.

premat is configured such that the first two lines of its output vector contain the dimensions of the matrix, and thus this there should be no manipulation of the matlab scripts depending on the user overrides.

VI. Matlab

The output of premat(outfile) is automatically processed with the plscr script. This script calls the parmat function which parses a vector into a matrix with given dimensions. plscr outputs a contour map and a false color image of the data. They can be saved to postscript files via the menu commands. The plscr command can be run from the command line in matlab directly assuming the Matlab Path contains /export/home/poldata/Photometry/matlab.

VII. The run Script

Here is the script.

(1) #!/bin/csh

(2) set dir='/export/home/poldata/Photometry'

#clear the phot output file

(3) rm $dir/data/test
rm $dir/matlab/outfile

#first run the phot code

(4) $dir/bin/phot -i $dir/data/0098 -o $dir/data/test -a 90

#This will give an output file test. We have to place the number
#of data points as the first line in this file. To do this,
#we call count and then concatenate using c shell commands to clean

(5) $dir/bin/count -i $dir/data/test -o $dir/data/number
(6) cat $dir/data/number $dir/data/test >! $dir/data/infile

#Next, call the matlab preprocessor using a particular smoothing
#algorithm and kernel size

(7) $dir/bin/premat -i $dir/data/infile -o $dir/matlab/outfile -s 2 -k 11

#clean up the $dir/data directory

(8) rm $dir/data/test
rm $dir/data/number
rm $dir/data/infile

(1) is simply the call to the c-shell program. Line (2) sets the dir variable to the root directory of the analysis code. Line (3) takes care of getting rid of the output of the phot program and the final output file. Next(4), phot is called, in this case with an angle of . In (5), count is run and then the output of the two programs are concatenated using the unix program cat. In (7) premat is called, in this case, with a Gaussian smoothing kernel which is 11 pixels in diameter. Finally, in (8), all of the intermediate files are removed since they are no longer needed.

next up previous
Next: About this document ...
David T. Chuss