How to produce a surface brightness profile using DS9

How to produce a surface brightness profile using DS9
The following instructions assume that you have the relevant FITS file open in DS9 and suitably sized
and scaled for easy viewing. (See separate sheet for how to do this.)
Three open windows in DS9. Clockwise from left: image window with a horizontal slice
through a galaxy, histogram of pixel values (or counts), graph of pixel values or counts
along slice (showing relative surface brightness)
Choose a slice through the image
1. Go to the Region menu, select Shape, and then Projection (for some obscure reason DS9 calls a
slice a 'projection shape’!)
2. Draw the slice by dragging with the mouse across the image. Drag upwards and/or to the right.
(This is for consistency so you don’t end up wondering later on which end of the slice is which!)
The position of the slice will be indicated by a green line and a new window will appear showing a
graph of pixel value against distance in pixels along the slice.
3. Move the graph window to one side so you can see it as well as the image window and the
histogram window (if you have it open).
REMINDER Do not be thrown by the fact that whenever you move the cursor over the image
window in DS9 this window immediately comes in front of any other windows you have open.
Slice at a 45 degree angle
Get info window for a slice at 45 degrees
Adjust the length and angle of the slice
The idea here is to produce a slice of a given length at a given angle to the x-axis.
4. Click on the slice to select it.
Handles appear at each end and in the middle to show that is selected..
5. Go to the Region menu, choose Get info.
A new window appears giving the coordinates of the ends of the slice, its length, and its angle to the
x-axis.
6. Move the new window to a convenient position.
7. Adjust the slice to the required length and angle by either:

dragging the handles at the ends of the slice while you watch the length and angle given in the
Info window, or

using the table above to enter coordinates that produce a slice of a fixed length of 1000 pixels
(just less than the height and width of the telescope image) at various fixed angles.
Move the slice to the required position
8. Make sure that the slice is still selected and that the cursor is somewhere over the image window
(this is important) and then use the arrow keys on the keyboard to nudge the slice into the required
position.
HINT As you move the slice, the graph of pixel values changes dynamically. This is very useful since
it enable you (for example) to use the graph to determine when the slice goes through the exact
centre of a galaxy.
HINT To delete a slice, click on it to select it, and then press the Delete key
Graph of pixel values (or counts)
angle
0
15
30
45
60
75
90
105
120
135
150
165
Graph of log pixel values (log counts)
x-coords
12
1012
29
995
79
945
159
866
262
762
383
642
512
512
642
383
762
262
866
159
945
79
995
29
y-coords
512
512
383
642
262
762
159
866
79
945
29
995
12
1012
383
642
262
762
159
866
262
762
383
642
<<<<<<<
these are the
coordinates
appearing
in the Get Info box
for a given slice
<<<<<<<
Table showing the coordinates required to produce slices of length
1000 pixels at different angles when using DS9
Look at a log graph
9. Click on the graph window.
10. To plot log pixel values instead of just pixel values go to the Grid menu and choose Linear-Log. (To
revert choose Linear-Linear).
Plotting log pixel values instead of pixel values shows the ratio of pixel values between different
regions of the image. It emphasises noise, particularly at low pixel values (e.g. in the outer spiral
arms of a galaxy which are only marginally brighter than the sky background level).
The graph may well look very noisy (lots of jagged peaks and troughs). This is because each
camera pixel covers a very small area of sky, so that random variations in brightness over small
angular distances show up very prominently.
Graph of pixel values (or counts)
Graph of log pixel values (log counts)
Make the slice thicker to average out noise
11. Select the log pixels graph option.
12. Change the Thickness in pixels in the Info window, and then click the Apply button. Try different
values until you have reached an acceptable compromise between averaging out as much noise as
possible and making the slice so wide that it no longer accurately samples the surface brightness in
a small region.
HINT For a Faulkes image a thickness of 8 to 10 pixels may often be necessary, because each pixel
is only 0.135 arcseconds across, and considerable noise is present on such a small angular scale.
HINT You can save settings like this by going to the Edit menu and choosing Preferences then
Save preferences.
HINT When you adjust the thickness of a slice you may well find that you need to adjust its position
again to make sure that it gives the maximum peak value in the bulge.
Log graph with too much noise
Log graph with acceptable noise
Save the surface brightness profile
13. Go to the Graph window, select the File menu and then Save Data. Make sure you save the file
with the extension .dat (the software does not add the extension automatically as most programs
do).
NOTE data is saved as a table of values, with each row having the format
pixel number - space - pixel value
Open the data as an Excel spreadsheet
14. Switch to Excel (or start it up if not already running).
15. Go to the File menu and choose Open.

Leave all the settings as they are in the first window that appears and click Next.
Delimited means that the data are divided up by special characters like commas and spaces.

In next window that appears select Space as the delimiter choice and then click Finish.
The spreadsheet that opens will have two columns - the first numbers the pixels along the slice
and the second is the pixel value (or 'counts')
Save the data as an Excel spreadsheet
16. Save the resulting spreadsheet for subsequent analysis:

First remove the quotes around the name suggested by Excel and also the existing extension
which will be .dat.

Next set Save as type: at the bottom of the Save window to Microsoft Excel Workbook (*.xls)
and save the spreadsheet using a suitable name.
HINT Use a name that will help you to identify easily what the data refers to at a later date (e.g.
NGC6946_R_horiz could be used for a horizontal slice through an R band image of galaxy
NGC6946).
Richard Beare 3rd July, 2006