### 4 Simple ESP Sessions

In this section a few example sessions are described as ‘blow-by-blow’ accounts.

#### 4.1 Getting Help

The ESP help system is available from the UNIX shell like any other ESP command. To get help type:

% esphelp

If this does not generate a screen similar to:

ESP

ESP (standing for Extended Surface Photometry) is a package of
routines that deal with various aspects of obtaining galaxy profiles.
They may be subdivided thus:

ELLPRO, ELLFOU, GAUFIT, SECTOR -  Profile generation.

HISTPEAK, LOBACK and HSUB      -  Background determination.

FASTMED, MASK, SKEW and TOPPED -  Image preparation.

GRAPHS                         -  Presentation of results.

CORR, SELFC, SELFCW and MIXUP  -  Object detection/enhancement.

CORR       ELLFOU     ELLPRO     FASTMED    GAUFIT     GRAPHS     HISTPEAK
HSUB       LOBACK     MASK       MIXUP      SECTOR     SELFC      SELFCW
SKEW       TOPPED

Topic?

The help system is functionally similar to that found on DEC VAX machines. So replying to the query ‘Topic?’ with, for example, ‘loback’ generates another level of help:

LOBACK

Establishes the local mode values for parts of an image.

Usage:

LOBACK IN INFILE SFACT THIRD OUT WIDE

Description:

Establishes the local mode values for parts of an image
immediately surrounding a set of image co-ordinates supplied by
the user.

The user may also supply some indication of the number of pixels
that must be used to create the pixel value histogram. This
value may be supplied as the width of the square area around the
co-ordinates that will be used, or alternatively the number of
contiguous data points believed to be present in the object at
the image location specified.

The latter method is intended specifically for use with RGASP’s
IMAGES or IRAF’s FOCAS output files.

All co-ordinates are read from a two or three columns
ASCII text file. If two columns are present then these are
taken as representing the image co-ordinates required for the
regions of the image to be considered.  Co-ordinates are in
the Current coordinate system of the NDF. If three columns are
present the third column respresents the width of the area
to be sampled or the number of contiguous pixels detected there
by FOCAS or IMAGES.

The selection of the number of pixels to used in the histogram is
defined by the user subject to a lower limit of 1024 pixels
(32x32).

Parameters            Examples   Notes      Authors    History

LOBACK Subtopic?

#### 4.2 Session 1 — Getting image statistics

An obvious example is determining the statistics (and in particular the modal count) of an image. So, imagine you are logged in and the esp command has already been issued, then the following session is what would be required to examine the NDF image p2 stored in the current directory.

% histpeak

ESP HISTPEAK running.
IN - Image NDF filename /@galaxy/ > p2

At this point type in the file name, p2. The .SDF part of the name is not required. The application, in common with most ESP applications then gives you some useful information about the image in question. In particular, the image shape will give you some idea how long you will need to wait for you answers to appear.

You will find, as you use ESP applications more, that ESP applications will often volunteer a name for the IN file to be used. This name is shown at the end of the IN prompt between two ‘/’s. In this instance the suggested file name is galaxy. This name may be input immediately (if it is what you want) by pressing the Return/Enter key. On VAX systems, the current suggestion may be edited by pressing the tab key. You will find that many of the ESP applications will suggest answers to other prompts as well.

Filename:   p2
Title:      Raw Plate Image
Shape:      201 x 201  pixels
Bounds:     x = 1700:1900  y = 600:800
Image size: 40401 pixels
USE - Use the whole image or an ARD file /‘w’/ > w

The application now prompts you for an indication of which image pixels are to be used in assessing the image pixel statistics. Frequently, you will want to use all of them, in which case your input should be ‘w’ or ‘W’. This application, and all other ESP applications, are not case sensitive so both responses are treated similarly.

If you are employing ARD files (see Appendix C ) to mask out bad pixels you should input ‘A’ or ‘a’. You will then be prompted for the name of the ARD file in question, in addition to those inputs shown below. It must be remembered that the name of the ARD file must be preceeded by ’ ̂’ or the input will be interpreted as a single ARD instruction and not a file name as intended.

If, instead you opt to use all the pixels, you enter ‘w’ in response to the USE prompt you will then be prompted as shown below with an appropriate response:

SFACT - Smoothing width you wish to use /0/ > 2
DEVICE - Display device code or name /@xw/ > ikon

This simple set of instruction will then cause HISTPEAK to examine the NDF image p2 (a plate scan), using all its non-bad pixels. When a smoothed histogram is created by the application for determining a modal value (an unsmoothed histogram is always created as well) a Gaussian filter of radius 2 counts will be used. The histogram generated is displayed on device IKON. An example output display is shown as Figure 1 and the output to the screen is shown below.

Filename:   p2
Title:      Raw Plate Image
Shape:      201 x 201  pixels
Bounds:     x = 1700:1900  y = 600:800
Image size: 40401 pixels

HISTPEAK Results: p2

Pixels (used):              40401     Pixels (bad):                0
Lowest count:            4768.000     Highest count:        9388.000
Skewness:                   0.516     Kurtosis:                1.795

Mean:                    6226.607     Median:               6210.462

Histogram modal values:
Unsmoothed:              6179.000     Smoothed:             6214.000
Projected:               6204.297     Interpolated:         6185.874

Absolute dev.:            333.494     Variance:              183890.
Standard. dev.:           428.824     Back. st. dev.:        392.448

Contents of the most occupied histogram bin:
Unsmoothed:                60.000     Smoothed:               52.479
Interpolated:              39.416

If you re-run HISTPEAK but this time input an SFACT value of 4 you will find that the results for some quantities are different. This is as you would expect when histograms are smoothed. As you can see from the excerpt below, the values affected are those relating to values extracted from the smoothed histogram. Figure 2 shows the histogram and the effect of smoothing upon the shape of the pixel count distribution - smoothed points are plotted bold.

Histogram modal values:
Unsmoothed:              6179.000     Smoothed:             6176.000
Projected:               6175.306     Interpolated:         6193.840

Absolute dev.:            333.494     Variance:              183890.
Standard. dev.:           428.824     Back. st. dev.:        365.752

Contents of the most occupied histogram bin:
Unsmoothed:                60.000     Smoothed:               46.204
Interpolated:              39.609

#### 4.3 Session 2 — Interactive profiling by intensity analysis

One of the key uses of ESP is for profiling images of galaxies. The ESP application for doing this is ELLPRO. If we again assume we are logged on and that the esp command has been issued, then the following is a simple session using it. The example assumes also, that the kappa command has been issued allowing use of the DISPLAY routine. For the simplest use of ELLPRO, the image containing the galaxy to be profiled needs to be displayed.

% display in=ic3374c mode=faint device=xw
% lutgrey device=xw

The first instruction clears the X window and displays the NDF image file ic3374c. The second instruction defines the colour table to be employed for that window.

The next step is to start up ELLPRO and give it information about how you wish to work.

% ellpro

ESP ELLPRO running.
MODE - Use the application interactively? /TRUE/ > Y
CURSOR - Use the cursor to identify the galaxy centre? /TRUE/ > Y

Choosing a value of TRUE for MODE tells the program that you will either be typing in a value for the location of the galaxy centre on the image or using a cursor to indicate where it is. The alternative is for the program to read in a list of co-ordinates from a text file. Specifying a value of TRUE for CURSOR then tells the program that you will be inputting the location by using a cursor. This is only possible if you have previously displayed an image on a device and it is still visible. If several images are currently displayed on a device then the most recently added image displayed (containing a DATA component) is examined. This information is obtained from the AGI database.

The next information required is the name of the display device on which your galaxy is currently displayed – in this case Xwindows. It then looks at the AGI database to determine what image you used to create the displayed image and displays its name to allow you to check that it is the right one. After a brief pause (duration depends on your hardware) the cursor may be used to identify the centre of the galaxy. How this may be done differs slightly from device type to device type. However, it is by use of buttons on an Xwindow and by use of the space bar and buttons on IKONs.

IMGDEV - Which device is displaying the image? /@xwindows/ > xw

Using /local2/data/esp/ic3374c as the input NDF.

Select the centre of the galaxy to be profiled.
Keyboard "2" key:   Quit the program.
Keyboard "." key:   Select the galaxy.
Keyboard "1" key:   Show the cursor co-ordinates.
SKY frame co-ordinates:  RA = -11:23:21.6,  Dec = 62:13:07

When you identify the location you want, the program reports that location in the Current co-ordinate system of the image, which in this case is SKY, with co-ordinates of RA and Dec. Information about co-ordinate systems associated with an NDF file is held in its WCS (World Co-oordinate System) component. Briefly, the WCS component contains several co-ordinate frames, allowing positions within the data array to be addressed in different ways. Each frame has a label, called its Domain, which usually describes the co-ordinate system; two important ones are GRID (which is always present) and SKY (which may or may not be). At any given time one of these frames is designated the Current one, and this determines the co-ordinates used when positions are requested or reported by ESP or other Starlink packages like KAPPA. You can change between frames using KAPPA’s WCSFRAME command. For instance the following would cause all positions to be reported in PIXEL co-ordinates instead:

% wcsframe ic3374 pixel

To find out more about WCS components see SUN/95.

Once the galaxy centre is identified, it is necessary to describe how far out from the centre you want the profiling to continue (if possible). This is again achieved via the cursor.

Indicate the outer limit of the galaxy.
Keyboard "2" key:   Quit the program.
Keyboard "." key:   Select the outer limit of the galaxy.
Keyboard "1" key:   Show the cursor co-ordinates.
SKY frame co-ordinates:  RA = -11:23:17.0,  Dec = 62:12:43

When this has been done, a circle is drawn around the galaxy showing the extent of the profiling requested. This may, or may not, be visible depending on the colour of the image background. However, this can be overcome by use of the command line parameter COLOUR when starting ELLPRO, i.e.:

% ellpro colour=n

Where the valid range of colours (N) for drawing the lines is 0–3.

The next prompts displayed are simple to understand.

FRZORI - Is the galaxy origin to be frozen? /FALSE/ > F
BACK - Background value /6179/ > 760.5
SIGMA - Standard deviation of the background /392/ > 12.07
Using info from SKY frame - pixels are  0.961 arcseconds square.

The first parameter, FRZORI, asks if the galaxy position you proposed (and refined with AUTOL if required) should be held to be the galaxy centre throughout the profiling operation or, is it allowed to vary slightly from ellipse to ellipse if that provides a better fit? BACK and SIGMA are the modal pixel value in the image and its associated standard deviation. Since the image in this example has a SKY co-ordinate frame (it does not have to be the Current frame), the program then works out the pixel size in arc seconds and reports it. If your image does not have any SKY co-ordinates, then you will be prompted to enter this as the value of a parameter PSIZE. The final group of configuration parameters is as follows:

ZEROP - Surface brightness zerop point (in magnitudes per arcsec) /27.5/ >
AUTOL - Automatically search for better origin? /YES/ > yes
AUTOLT - Use a centroid? /NO/ > yes
ARDFIL - Masking ARD file /@ardfile.dat/ > !
!! SUBPAR: Null (!) response to prompt for parameter ARDFIL
WARNING! - ARD file not used.

ZEROP is the base of the scale for the surface brightness plot which will be made. AUTOL will refine the estimate of the galaxy centre position you have proposed with the cursor if set to TRUE. In the case shown it has been requested and the method chosen was a centroid. The last information required is to name an ARD file if one is to be used to define the good parts of the image. In this case ‘!’ is entered because no ARD file will be used. Instead, the whole image will be used. To make sure you’re aware of this, the program issues a warning.

It should be noted that for those required inputs which match the values suggested by the program, it is sufficient just to press the Return/Enter key to accept the proposed value.

The program then starts to work on the profiles. It first makes a guess at the crude shape of the galaxy at some smallish radius and (hopefully) sensible S/N ratio and displays this. Next, it makes a full estimate of the profile at that radius before dropping down to smaller radii and then increasing upward again until one of the profiling limits (see LIM1, LIM2 and RLIM in Appendix 0) is exceeded. Results of the profiling activity are displayed as they are calculated. This is done to allow you to see what progress is being made.

Initial parameter estimates
Rad(a)     5.41  Posang   12.1  1/Ellipt.  .692

X       Y     Points   Rad(a)    Count     PA  1/Ellip Dev.  PPU  Statistic

Residual calculation: weighted SD
93.3    96.5    76      4.81      114.2  -16.4  0.593    0.9  100.  0.87E+03
93.0    96.1    20      0.16      213.8  -31.7  0.116    0.4  100.  0.97E+03
93.0    96.2    20      0.27      211.6  -23.4  0.141    0.9  100.  0.97E+03
93.0    96.1    20      0.36      211.3  -23.4  0.141    0.8  100.  0.97E+03
92.9    96.2    20      0.45      210.6  -23.4  0.141    0.8  100.  0.97E+03
----    ----    ---     ----       ---    ----  -----    ---  ----
----    ----    ---     ----       ---    ----  -----    ---  ----
----    ----    ---     ----       ---    ----  -----    ---  ----
93.5    95.8   332     19.93        1.9   -2.9  0.602    0.5   92.  0.76E+03

Mean count below threshold LIM2.

Descriptions for the headings may be found in Appendix F.

When the application has finished profiling the galaxy it issues a message indicating why the profiling action was stopped.

You are then prompted for the name of a device on which the image should be displayed. This is done by first asking you if the device currently displaying the image is to be used and then, if you say no, asking for the name of the new device. In the event that you request the current device as the place the profile results should be displayed, you will be further prompted to indicate (using the cursor) in which quadrant of the screen it is to be shown. It must be remembered that any objects in that part of the screen will, subsequently, be obscured, as may be seen in Figure 3.

SAME - Use the same graphics device for the results graph? /TRUE/ > f
DEVICE - Which device/type to display the graph /@x2windows/ >

OUT - Text file for profile output /@elp/ > testprof.dat
AGAIN - Profile again? /FALSE/ >

You are also prompted for the name of an output file into which the profiling results are to be placed. If it is found that the name you provide is not allowable (e.g. there are illegal characters in the name or the file named already exists) you will be reprompted. A ‘!’ may be used to avoid creating a file if you do not wish to retain a copy of the results.

Finally you will be asked if you wish to try again. If you answer yes, the program will go back to the point at which you identified the location of the galaxy centre on the image and start again. Where possible, you will not be reprompted for input you have already provided.

You will find that the ESP ELLFOU application works in a very similar manner. Consequently, you are now in a position to profile galaxies interactively and to generate profiles using either intensity (ELLPRO) or contour analysis (ELLFOU).

#### 4.4 Session 3 — File based profiling by intensity analysis

Session 2 showed how one or more galaxies on an image might be processed interactively to yield their profiles. However, there are times when you want to profile virtually every object in an image. This can be done using ELLPRO or ELLFOU in essentially the same manner. The only difference is that you supply the image co-ordinates of the galaxies you want profiled in a text file. Such a file may be easily created using the LOGFILE option of KAPPA’s CURSOR or by taking information from a file generated by object identification software such as PISA.

The file used in the example below, contains the following:

426.8958 155.2692
278.7055 299.9713
206.613 350.2151

The columns represent the $x$ and $y$ co-ordinates respectively. A third column might also have been included, giving a value for the background to be used for each of the galaxies. In the absence of a third column, the image’s global value is employed. Local background values for different points may be easily determined using the ESP LOBACK application.

The co-ordinates given in this file should be in the Current co-ordinate system of the image (which can be selected by WCSFRAME as described in the previous section), so that for instance if the image had the SKY frame as Current, a suitable file might read something like:

0:07:21.4   30:33:04
0:07:42.6   30:32:10
0:07:22.9   30:27:20

An example of the sort of input required is shown below.

% ellpro

ESP ELLPRO running.
MODE - Use the application interactively? /TRUE/ > f
INFILE - Text file containing co-ordinates /@coords.dat/ > f5coords.dat
IN - Image NDF filename /@ic3374c/ > f5flat
FRZORI - Is the galaxy origin to be frozen? /FALSE/ >
BACK - Background value /760/ > 22712
SIGMA - Standard deviation of the background /12/ > 57
PSIZE - Size of the pixels (in arcsec) /1/ > 1
RLIM - Maximum ellipse radius (in pixels) /10/ > 40
ZEROP - Surface brightness zerop point (in magnitudes per arcsec) /27.5/ >
AUTOL - Automatically search for better origin? /TRUE/ >
AUTOLT - Use a centroid? /TRUE/ > f
Default background used for object at  426.9,  155.3
Default background used for object at  278.7,  300.0
Default background used for object at  206.6,  350.2
ARDFIL - Masking ARD file /@ardfile.dat/ > !
WARNING! - ARD file not used.
OUT - Text file for profile output /@testprof.dat/ > f5results.dat

Working on PIXEL co-ordinates: 426.9  155.3
19 ellipses determined.
Working on PIXEL co-ordinates: 278.7  300.0
30 ellipses determined.
Working on PIXEL co-ordinates: 206.6  350.2
12 ellipses determined.

Note that since the image in this example does not have a SKY frame in its World Coordinate System component, you have to enter the PSIZE parameter by hand.

In the example given, the co-ordinates file coords.dat identified the locations of 3 galaxies, but it could just as easily have contained information on many more. The current upper limit imposed by ESP is 10000.

#### 4.5 Session 4 — Obtaining galaxy pieslice cross-section

The ESP application SECTOR may be used to interactively derive a pieslice cross-section of a galaxy. Before it may be used the NDF image containing the galaxy must be displayed on a suitable display device. This may be done in a manner similar to that described in Session 2. Once the image is displayed, SECTOR may be run.

The first prompt you are faced with asks if you are going to use a cursor to define the position of the galaxy centre and to describe the direction, size and length of the pieslice. If you answer FALSE to this query, you will have to input all your values via the keyboard. However, it is much simpler to use a cursor, as in the example below.

% sector

ESP SECTOR running.
CURSOR - Use the cursor to identify the galaxy centre? /TRUE/ >
IMGDEV - Which device is displaying the image /@xwindows/ >

You are then asked on what device the image to be examined is displayed (DEVICE). SECTOR then examines the AGI image database to determine the image’s name. This is displayed so that the you can be sure the image used is as expected.

Control then passes to the cursor and you are prompted to use the cursor (and/or the keyboard) to identify the part of the image to be used in the pie-slice cross-section.

Using /local2/data/esp/ic3374c as the input NDF.

Select the centre of the galaxy.
Keyboard "2" key:   Quit the program.
Keyboard "." key:   Select the galaxy.
Keyboard "1" key:   Show the cursor co-ordinates.
SKY frame co-ordinates:  RA = -11:23:21.7,  Dec = 62:13:07

Indicate centre of the outer limit of the sector.
Keyboard "2" key:   Quit the program.
Keyboard "." key:   Select centre of the outer  limit of the sector.
Keyboard "1" key:   Show the cursor co-ordinates.
SKY frame co-ordinates:  RA = -11:23:21.4,  Dec = 62:12:25

Select the sector angular width.
Keyboard "2" key:   Quit the program.
Keyboard "." key:   Select width of the sector.
Keyboard "1" key:   Show the cursor co-ordinates.
SKY frame co-ordinates:  RA = -11:23:23.6,  Dec = 62:12:27

The application then asks for information about the image (BACK, SIGMA and, if necessary, PSIZE), how the results are to be displayed (SURF, RADISP, ZEROP) and where the results are to be displayed (SAME, DEVICE).

MIRROR - Use two diametrically opposite slices? /TRUE/ > TRUE
BACK - Background count value /760.5/ >
SIGMA - Standard deviation of the background /12/ >
Using info from SKY frame - pixels are  0.961 arcseconds square.

SURF - Display counts as surface brightness? /TRUE/ > TRUE
ZEROP - Surface brightness zerop point /27.5/ >
AUTOL - Automatically search for better origin? /TRUE/ >
ARDFIL - Masking ARD file /@ardfile.dat/ > !
!! SUBPAR: Null (!) response to prompt for parameter ARDFIL
WARNING! - ARD file not used.
SAME - Use the same graphics device for the results graph? /TRUE/ > f
DEVICE - Which device/type to display the graph /@x2windows/ >

The RADISP and SURF options above specify that the ‘profile’ will be displayed in the form of surface brightness versus linear radius. Other options exist for displaying the mean pixel count versus radius transformed into its logarithm, square root or quarter power.

AUTOL set to TRUE means that the application will look at the parts of the image immediately surrounding the galaxy centre suggested and, if possible, will identify a better candidate. In the instance given AUTOL has been used.

The option MIRROR allows for the pieslice defined to be duplicated on the other side of the galaxy origin. This effectively increases the signal since more of the image will be sampled, but is only really applicable when the image is roughly symmetrical. Figure 4 shows the selected sector displayed on the galaxy. It also shows the mirror image sector generated by the MIRROR parameter being set to TRUE.

The graph is then displayed and you are asked to indicate (using the cursor) the radius range of the profile points to be used to calculate the scale lengths.

Select a point defining the lower radius limit.
Keyboard "2" key:   Quit the program.
Keyboard "." key:   Select lower radius limit.

Select a point defining the upper radius limit.
Keyboard "2" key:   Quit the program.
Keyboard "." key:   Select upper radius limit.

The graph then displays the galaxy profile ‘fits’ and the results of the scale length calculations are printed, showing values for the central surface brightness of the galaxy for both elliptical and spiral galaxy models.

SECTOR Results for file: /local2/data/esp/ic3374c

Origin:  -11:23:21.6  62:13:08

Pixel count (raw):              980.00
Pixel count (subtracted):       219.50
Pixel count (sigma):             18.29
Pixel count (Log(I-BACK)):        2.34
Mag. rel. zero point:          21.6464

Central mag. spiral:  21.4506
Central mag. ellipt:  16.9384
Above or below sky:   -0.5397

Number of data points:      46 ie.  43.22"
Range used (arc sec):     0.63,  26.88

Points used for spiral calculation:        27
Scale length spiral:                   6.2582
Points used for elliptical calculation.:   27
Scale length elliptical:              0.08769

Finally, you are given the chance to obtain a pieslice of some other part of the image.

OUT - Text file for profile output /@sectout.dat/ >
AGAIN - Profile again? /FALSE/ >

#### 4.6 Session 5 — Examining profiling results

The applications ELLPRO, ELLFOU and SECTOR all generate text output files that may be examined using the application GRAPHS. This lets you display graphs such as surface brightness, ellipticity or position angle versus radius (or some transformation thereof). GRAPHS has been made as simple to use as possible. A simple session is shown below. The input file used (prof.dat) was generated by ELLPRO.

% graphs

ESP GRAPHS running.
MODE - Use the application interactively? /TRUE/ > true
CURSOR - Use the cursor? /FALSE/ > false
INFILE - Name of ESP data file /@test.dat/ > prof.dat

OUT - Text file for profile output /@graphs.out/ >

By opting for MODE to be TRUE, you have opted to interactively examine each of the profiles from the input file in turn. In this mode, the profiles are displayed (if required) on a graphics device and you must identify the radius range of the data points to be used to determine the galaxy scale length. CURSOR set to FALSE means that the radius range will either be typed in or GRAPHS will automatically guess at an appropriate range to use. The inputs INFILE and OUT identify the input and output text files respectively. The graphical output is shown in Figure 5.

Source image was: f5flat
End of filename report.

WHATD - Parameter to display /’s’/ > s
DEVICE - Which device/type to display the graph /@xw/ > xw
RRANGE - Automatic radius limit selection? /TRUE/ > f
FITLIM - Limit of the radius range to be fitted (in arcsec) > 2.5,15

GRAPHS shows you the name of the application that generated the profile you are examining and the name of the image from which it was derived. It then asks you to define what is to be displayed. WHATD set to ‘s’ means surface brightness will be displayed against linear radius (defined by RADISP set to ‘r’). DEVICE again defines the name of the graphics device to be employed while RRANGE and FITLIM define the radius range of the part of the profile to be fitted.

Number of data points:      19
Range used (arc sec):     2.5,  14.75
X and Y co-ordinates (Base):  89.3, 99.8
X and Y co-ordinates (Current):  1787.8, 698.3

Two sets of co-ordinates are displayed here to identify the point in question: those of the Base frame (GRID co-ordinates, which always start at (1,1) for the bottom left pixel in the image) and those of whatever was the Current frame when the file being plotted by GRAPHS was generated. If the Current co-ordinate frame of the image has been changed using WCSFRAME then the Current co-ordinates will no longer be correct, but the Base frame ones always will. You can set the Base frame to be Current, and so used for display etc., at any time by doing

% wcsframe myimage grid

More information is then given; values for central surface brightness (CSB), scale length and range of data points used are displayed. The LCC (linear correlation coefficient) values give an idea of how good the fit was. Finally, you are given the option to try fitting the profile again. If there is only one object in the input file, the application will then stop, otherwise the next profile from the file will be read and you will be allowed to profile that.

Points used for spiral calculation:        12
Scale length spiral:                   2.0442
Points used for elliptical calculation.:   12
Scale length elliptical:              0.00183
Extrapolated CSB spiral:              16.6
Extrapolated CSB elliptical:           4.6
Spiral LCC squared:                    .92
Ellip. LCC squared:                    .95

AGAIN - Display again? /TRUE/ > f

End of file found.

One detail of this example needs a little more explanation. In one of its modes, GRAPHS can work automatically on input files containing information on lots of galaxies without further input. This means that GRAPHS can take the file generated in Session 3 (containing the profiles of three galaxies) and determine from them, values for the central surface brightness and scale length. This method of working is selected by setting MODE to FALSE, but otherwise differs only slightly from the example above.

#### 4.7 Session 6 — Looking at the image background variation

In this session, the ESP application SKEW is employed to show what parts of a source image suffer from poor flat fielding. Before you run this program you should run HISTPEAK for the source image to determine its background value and also its associated standard deviation.

Then, the session will go something like this:

% skew

ESP SKEW running.

IN - Image NDF filename /@skew/ > cnt4141c
Filename:   cnt4141c
Title:      Source Image
Shape:      525 x 520 pixels
Bounds:     x= 1:525  y= 1:520
Image size: 273000 pixels
OUT - Output NDF filename /@skew/ > skew
WIDTH - Template width (in arcsec) /8/ >
PSIZE - Pixel size /1/ > .88
MODET - Use a global mode value (y/n)? /YES/ >
BACK - Background sky value /6200/ > 22716
USEALL - Include very bright pixels (y/n)? /NO/ >
SIGMA - Standard deviation of the image pixels /390/ > 56
NSIGMA - Level of the cutout in SIGMA /10/ >
MULT - Output skewness multiplying factor /1000/ >

The parameters IN and OUT refer to the source image and the output image respectively. BACK, SIGMA and PSIZE all relate to the image cnt4141c.

When the MODET option is set to FALSE, SKEW calculates a local background value when determining the skewness of each part of the image. In this example it is set to TRUE, so the image’s global background value is used instead. This is the faster option.

USEALL and NSIGMA are used to define a pixel count cutoff value. If one of the image pixels is brighter than the global background (BACK) plus a certain number (NSIGMA) of background value standard deviations (SIGMA) it is excluded from the calculations. This may be used to reduce the influence of cosmic rays and other bright image features which might otherwise dominate the output.

Since skewness values are usually fairly small, a multiplying factor may be applied to all the skewness values calculated. This is specified by MULT.

Finally, SKEW shows you what it is currently doing and how far it has got. This is because, for large images, it can take a considerable time to run, especially, if the template size is large.

Figure 6 shows a source image and the image generated by SKEW when it was sampled over boxes approximately 10x10 pixels in size. Note how the previously unnoticed bad column (slightly left of centre near the top) is easily spotted and how large the full extent of the poor flatfielding is.

Applying SKEW to file: cnt4141c
Results file will be:  skew
Global background value used.
High count cutoff was used.

Percentage done so far: 10
Percentage done so far: 20
Percentage done so far: 29
..........................
..........................
Percentage done so far: 98

#### 4.8 Session 7 — Interactively obtaining 2-D Gaussian source profiles

In some of the earlier sessions you saw how to profile a galaxy in terms of an ellipse using ELLPRO and ELLFOU. Sometimes in astronomy it is useful to profile a source (or sources) in terms of 2-D Gaussian functions, this is especially useful for users of JCMT data (see also JCMTDR). In ESP this operation is performed by the application GAUFIT.

GAUFIT is similar to ELLPRO, SECTOR and ELLFOU in that it may be operated using a cursor or a simple text file to select the source position(s) that must be examined.

GAUFIT now contains two distinct fitting algorithms: the original one, which obtained the fit parameters by hunting through a region of parameter space constrained by you, and a new one (as of version 0.9), which uses a non-linear least-squares algorithm to obtain the parameters and their uncertainties. For further details on the new algorithm, see the detailed description of GAUFIT in section 0. The interface has not changed radically, but I will show two complete examples below.

##### 4.8.1 GAUFIT: original fitting algorithm

Once the image to be analysed has been examined using HISTPEAK and displayed using KAPPA’s DISPLAY, an interactive session might proceed as follows:

% gaufit

ESP GAUFIT running.

MODE - Use the application interactively? /TRUE/ >
COLOUR - Pen colour? /1/ >
ANGCON - Use clockwise positive rotation convention? /FALSE/ >
ANGOFF - Position angle offset /0/ >
IMGDEV - Which device is displaying the image? /@xwindows/ >

Using /local1/export/home/norman/s/src/esp/ic3374c as the input NDF.

Select the source location
Left mouse button:        Select location.
Middle mouse button:      Show cursor coordinates.
Right button or CTRL-C:  Quit selection.

SKY frame co-ordinates:  RA = -11:23:21.4,  Dec = 62:13:07

Indicate the outer limit of the source.
Left mouse button:        Select location.
Middle mouse button:      Show cursor coordinates.
Right button or CTRL-C:  Quit selection.

SKY frame co-ordinates:  RA = -11:23:20.8,  Dec = 62:12:45

You can choose several sources to fit. We chose to fit only one here, so quit at this point.

You have opted to quit source selection.

1      93.0   94.0   22.6
Using info from SKY frame - pixels are  0.961 arcseconds square.

This is very similar to the way in which ELLPRO, ELLFOU and SECTOR works. After first defining the colour (COLOUR) of the ink to be used to mark the image locations specified, the angle convention to be used is defined (via ANGCON and ANGOFF) and then the device displaying the source image chosen (IMGDEV).

FWHM - Work in FWHM, rather than sigmas? /TRUE/ >
LSQFIT - Use the non-linear least-squares method? /FALSE/ >
BACK - Background count value /6196.5/ > 760
SIGMA - Std. dev. of the background /400.4/ > 12
NSIGMA - Number of sigma above sky /5/ >
NITER - Number of iterations /5/ > 3

MODEL - Output NDF filename /@ic3374c-out/ >
MODTYP - Whole image model (W) or residuals (R) /’w’/ >

If you set FWHM to be true, then results will be displayed as FWHM, rather than the gaussian width parameter, sigma.

If you set the parameter LSQFIT to be false, you get the original GAUFIT algorithm.

It is then necessary to provide information on the image background value (BACK) and its standard deviation (SDEV). These are most easily found using ESP’s HISTPEAK. For most purposes the interpolated standard deviation is best.

The parameter NSIGMA defines a count value (NSIGMA times the SDEV value plus BACK value supplied) above which a pixel must be for it to be included during the minimisation process. This is to reduce the number of pixels considered and avoid ‘noisy’ pixels contributing. Using too low a value will slow the application down a lot. ITER merely tells it how many minimisation loops must occur before the processing stops. As with all minimisation processes the application can reach the ‘point of vanishing returns’ if too many iteration loops are specified. The arbitrary residual indicator will be a useful help. See below.

The parameter MODEL is the name you wish to give to the output image while MODTYP defines what sort of image it should be. There are two options: the first is a whole image (MODTYP=W) where the model value for every pixel of the image is calculated, the second (MODTYP=R) where only the areas of the image immediately surrounding the sources are shown as non-bad. In these regions the residual value is given (ie the source image value for a given pixel minus the model value for the same pixel).

XINC - Source origin movement in X /0.001/ >
YINC - Source origin movement in Y /0.001/ >
SAINC - Source std dev factor in Sa /1/ >
SBINC - Source std dev factor in Sb /1/ >
PINC - Source peak variation /1/ >
ANGINC - Source origin variation in angle /1/ >

AUTOL - Search for a better origin? /TRUE/ >

These parameters define how tightly constrained the minimisation routine is when it tries to walk through variable space. That is, if any of these values is very small (say .001) the minimisation can only adjust that aspect of the source model very slightly. The other extreme, a lot of freedom to vary source parameters, is specified if the value supplied is 1. So in the case shown above, the centres of the source cannot be varied much (XINC and YINC), while the breadths of the sources, peak height and position angle (SAINC, SBINC, PINC and ANGINC respectively) are allowed a lot of freedom to vary. The ability to constrain an aspect for the source model is essential for merged sources.

Setting AUTOL true means that the application will try to improve slightly on the source positions you have suggested using a centroiding routine. This is particularly useful with very large images where the display window you are using may not be able to provide a 1:1 relationship between the pixels in the image and the pixels on the screen.

Finding a better origin.

First estimates of source data

Source      X           Y         Angle   FWHMa/as     FWHMb/as         Peak
1       93.40       95.10      105.00     7.6          5.6        0.210E+03

Initial arbitrary residual   51.17

Iteration  1  of  3
Source      X           Y         Angle   FWHMa/as     FWHMb/as         Peak
1       93.40       95.10      107.00     7.4          4.3        0.209E+03

Current arbitrary residual   42.5

Iteration  2  of  3
Source      X           Y         Angle   FWHMa/as     FWHMb/as         Peak
1       93.40       95.10      106.67     7.7          4.1        0.210E+03

Current arbitrary residual   42.0

Iteration  3  of  3
Source      X           Y         Angle   FWHMa/as     FWHMb/as         Peak
1       93.40       95.11      107.33     7.7          4.1        0.210E+03

Current arbitrary residual   41.8
OUT - Text file for parameter /’GaiaEsp-outputtext’/ > ic3374c-txt

As you can see, the source positions remained unchanged during the minimisation (as requested by the small values we assigned for XINC and YINC) while the other parameters varied considerably – note that even at the last iteration the position angle of the source is still varying and the residual is dropping. The X and Y co-ordinates reported here, and those written to the output file ic3374c-txt, are in the Base co-ordinate system of the image.

An example output file is shown in Section 15 and described in Appendix F.

##### 4.8.2 GAUFIT: least-square fits

Fitting with the least-squares algorithm proceeds much as before:

% gaufit

ESP GAUFIT running.

[...]

So far, the interaction with GAUFIT is exactly as before, but now we choose to use the new algorithm.

FWHM - Work in FWHM, rather than sigmas? /TRUE/ >
LSQFIT - Use the non-linear least-squares method? /FALSE/ > y
CALCSD - Calculate and display uncertainties? /TRUE/ >
BACK - Background count value ( < 0 to have it fitted) /760/ > -1
MAXITER - Maximum number of iterations (-1 for default) /-1/ >

MODEL - Output NDF filename /@ic3374c-out/ >
MODTYP - Whole image model (W)/Residuals (R)/reGression diag. (G) /’w’/ >

You choose to use the new algorithm by setting the parameter LSQFIT to true. Around half of the function-evaluations in the fitting algorithm are used to calculate the uncertainties in the fit parameters, so if you have no need for these (for some reason), you will save a significant amount of run time by not requesting them.

This algorithm can fit the background count, so you do not need to use another routine to determine this. If you do give a positive value for the BACK parameter, then the routine will use that instead of fitting it (there is absolutely no speed advantage to this).

Unless you suspect the algorithm is somehow misbehaving, you should not give a positive value for the iteration count: the default is 150, and the fit should converge well before that, so that this parameter merely acts as a check on any pathological cases which cause the routine to somehow run away with itself.

For the LSQ algorithm, there is a third option for MODTYP. MODTYP=G gives a ‘regression diagnostic’, which is an image in which the value at each point is the change in the residual function if the corresponding point in the data were deleted. The residual function is half the sum of the squares of the differences between the model and the data. This is expensive to create, so you should not select it unless you actually wish to examine it.

First estimates of source data

Source      X           Y         Angle   FWHMa/as     FWHMb/as         Peak
1       93.67       95.15       21.00     59.          57.        0.933E+03

IT    NF     DRIFT    NL’D RESID
0     1    0.00        0.00E+00
1     2   0.110E-04    0.42E+03
2     4   0.120E-02    0.41E+03
3     5   0.383E-01    0.41E+03
4     6   0.287        0.39E+03
5     8   0.103        0.38E+03
6    10   0.230        0.32E+03
7    12   0.168        0.28E+03
8    14   0.190        0.15E+03
9    15   0.198        0.89E+02
10    16   0.199        0.75E+02
11    17   0.199        0.74E+02
12    18   0.199        0.74E+02
13    19   0.199        0.74E+02
14    20   0.199        0.74E+02
15    21   0.199        0.74E+02

GAUFIT2: algorithm performance
Effective data s.d:     12.      Check reasonable
Condition number:    0.21E+05  poor -- uncertainties plausible
Optimisation metric:    0.91      Acceptable

Fitted parameter values:
Source      X           Y         Angle   FWHMa/as     FWHMb/as         Peak
1       93.32       96.11       20.73     10.          6.1        0.189E+03

Parameter uncertainties: (-ve values indicate no estimate made)
Source      X           Y         Angle   FWHMa/as     FWHMb/as         Peak
1        0.04        0.07        0.02    0.15         0.85E-01   -0.100E+01

Background (fitted) = 769.0236

OUT - Text file for parameter /@ic3374c-txt6/ >

There is a good deal of information in the text which GAUFIT produces while it is working.

For each iteration, GAUFIT prints the number of function evaluations so far, the ‘drift’ from the initial guessed position, and a residual. The ‘drift’ is a scaled estimate of how far the current solution $\left(x,y,{\sigma }_{a},{\sigma }_{b},\theta \right)$ is from the initial one, with the different components of the solution appropriately weighted. If the drift reaches 1, the routine will conclude that it has somehow got lost, and give up with an error message to that effect. The scale for this calculation is set when you ‘Indicate the outer limit of the source’ at the time you pick the source positions – you might want to select a small circle if there are several sources which might become confused with each other. The ‘normalised residual’ is related to how much the model deviates from the data, but the numerical value is unimportant – it should decrease as the calculation goes on.

When the routine calculates the parameter uncertainties, it assumes a value for the data standard deviation based on the size of the residual and the number of parameters and data points, and it reports this for your information. If this value seems unreasonable, because it is substantially different from an alternative estimate you have of the standard deviation, please let me know.1

The routine also reports an estimated condition number (the ratio between the highest and lowest eigenvalues) for the Hessian used in the uncertainty calculation. If this is huge (more than about $1{0}^{6}$), you should not place too much reliance on the uncertainties produced. In this case, the condition number is larger than we’d like, but the reported uncertainties should not be too far out. A condition number less than $1{0}^{3}$ would suggest good reliable uncertainties.

In adapting the least-squares algorithm for this particular application, I made one or two optimisations, and the ‘optimisation metric’ indicates how well this is performing. It’s scaled so that a value towards 1 indicates that the optimisation is working as expected, zero means I needn’t have bothered, and negative values suggest it’s actually creating more work than the unimproved case. If you have a non-pathological case which gives negative values here, I’d like to hear about it.

Finally, the routine reports that it has converged successfully (if it hasn’t, it should give a more-or-less useful explanation here).

The routine displays its results, then their corresponding uncertainties, with negative uncertainties indicating that no estimate was made. The routine does not (in this release) make an estimate of the peak flux uncertainty.

1Norman Gray, norman@astro.gla.ac.uk