source: trunk/docs/outputs.tex @ 571

Last change on this file since 571 was 571, checked in by MatthewWhiting, 15 years ago

Making changes for ticket #52. Have added the parameter sortingParam, to enable the final source list to be sorted on one of a range of parameters: x-value, y-value, z-value, ra, dec, vel, w50, iflux, pflux, SNR. Have updated the necessary code and the documentation.

File size: 23.2 KB
Line 
1% -----------------------------------------------------------------------
2% outputs.tex: Section detailing the different forms of text- and
3%              plot-based output.
4% -----------------------------------------------------------------------
5% Copyright (C) 2006, Matthew Whiting, ATNF
6%
7% This program is free software; you can redistribute it and/or modify it
8% under the terms of the GNU General Public License as published by the
9% Free Software Foundation; either version 2 of the License, or (at your
10% option) any later version.
11%
12% Duchamp is distributed in the hope that it will be useful, but WITHOUT
13% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15% for more details.
16%
17% You should have received a copy of the GNU General Public License
18% along with Duchamp; if not, write to the Free Software Foundation,
19% Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
20%
21% Correspondence concerning Duchamp may be directed to:
22%    Internet email: Matthew.Whiting [at] atnf.csiro.au
23%    Postal address: Dr. Matthew Whiting
24%                    Australia Telescope National Facility, CSIRO
25%                    PO Box 76
26%                    Epping NSW 1710
27%                    AUSTRALIA
28% -----------------------------------------------------------------------
29\secA{Outputs}
30\label{sec-output}
31
32\secB{During execution}
33
34\duchamp provides the user with feedback whilst it is running, to
35keep the user informed on the progress of the analysis. Most of this
36consists of self-explanatory messages about the particular stage the
37program is up to. The relevant parameters are printed to the screen at
38the start (once the file has been successfully read in), so the user
39is able to make a quick check that the setup is correct (see
40Appendix~{app-input} for an example).
41
42If the cube is being trimmed (\S\ref{sec-modify}), the resulting
43dimensions are printed to indicate how much has been trimmed. If a
44reconstruction is being done, a continually updating message shows
45either the current iteration and scale, compared to the maximum scale
46(when \texttt{reconDim = 3}), or a progress bar showing the amount of
47the cube that has been reconstructed (for smaller values of
48\texttt{reconDim}).
49
50During the searching algorithms, the progress through the search is
51shown. When completed, the number of objects found is reported (this
52is the total number found, before any merging is done).
53
54In the merging process (where multiple detections of the same object
55are combined -- see \S\ref{sec-merger}), two stages of output
56occur. The first is when each object in the list is compared with all
57others. The output shows two numbers: the first being how far through
58the list the current object is, and the second being the length of the
59list. As the algorithm proceeds, the first number should increase and
60the second should decrease (as objects are combined). When the numbers
61meet, the whole list has been compared. If the objects are being
62grown, a similar output is shown, indicating the progress through the
63list. In the rejection stage, in which objects not meeting the minimum
64pixels/channels requirements are removed, the total number of objects
65remaining in the list is shown, which should steadily decrease with
66each rejection until all have been examined. Note that these steps can
67be very quick for small numbers of detections.
68
69Since this continual printing to screen has some overhead of time and
70CPU involved, the user can elect to not print this information by
71setting the parameter \texttt{verbose = false}. In this case, the user
72is still informed as to the steps being undertaken, but the details of
73the progress are not shown.
74
75There may also be Warning or Error messages printed to screen. The
76Warning messages occur when something happens that is unexpected (for
77instance, a desired keyword is not present in the FITS header), but
78not detrimental to the execution. An Error message is something more
79serious, and indicates some part of the program was not able to
80complete its task. The message will also indicate which function or
81subroutine generated it -- this is primarily a tool for debugging, but
82can be useful in determining what went wrong.
83
84\secB{Text-based output files}
85
86\secC{Table of results}
87\label{sec-results}
88
89Finally, we get to the results -- the reason for running \duchamp in
90the first place. Once the detection list is finalised, it is sorted
91according to the value of the \texttt{sortingParam}. This can take the
92value ``x-value'', ``y-value'', ``z-value'', ``ra'', ``dec'', ``vel'',
93``w50'', ``iflux'' (for integrated flux), or ``pflux'' (for peak
94flux), or ``SNR''. The default value is ``vel''. If no good WCS
95exists, the mean pixel position equivalent is used (``ra'' is replaced
96by ``x-value'', ``dec'' by ``y-value'', ``vel'' and ``w50'' by
97``z-value''). The results are then printed to the screen and to the
98output file, given by the \texttt{OutFile} parameter.
99
100The output consists of two sections. First, a list of the parameters
101are printed to the output file, for future reference. Next, the
102detection threshold that was used is given, so comparison can be made
103with other searches. The statistics estimating the noise parameters
104are given (see \S\ref{sec-stats}). Thirdly, the number of detections
105are reported.
106
107All this information, known as the ``header'', can either be written
108to the start of the output file (denoted by the parameter
109\texttt{OutFile}), or written to a separate file from the list of
110detections. This second option is activated by the parameter
111\texttt{flagSeparateHeader}, and the information is written to the
112file given by \texttt{HeaderFile}.
113
114The most interesting part, however, is the list of detected
115objects. This list, an example of which can be seen in
116Appendix~\ref{app-output}, contains the following columns (note that
117the title of the columns depending on WCS information will depend on
118the details of the WCS projection: they are shown below for the
119Equatorial and Galactic projection cases).
120
121\begin{Lentry}
122\item[{Obj\#}] The ID number of the detection (simply the
123  sequential count for the list, which is ordered by increasing
124  velocity, or channel number, if the WCS is not good enough to find
125  the velocity).
126\item[{Name}] The ``IAU''-format name of the detection (derived from the
127  WCS position -- see below for a description of the format).
128\item[{X,Y,Z}] The ``centre'' pixel position, determined by the input
129  parameter \texttt{pixelCentre}.
130\item[{RA/GLON}] The Right Ascension or Galactic Longitude of the centre
131  of the object.
132\item[{DEC/GLAT}] The Declination or Galactic Latitude of the centre of
133  the object.
134\item[{VEL}] The mean velocity of the object [units given by the
135  \texttt{spectralUnits} parameter].
136\item[{w\_RA/w\_GLON}] The width of the object in Right Ascension or
137  Galactic Longitude (depending on FITS coordinates) [arcmin].
138\item[{w\_DEC/w\_GLAT}] The width of the object in Declination Galactic
139  Latitude [arcmin].
140\item[{w\_50}] The velocity width of the detection at 50\% of the peak
141  flux (the measured full-width at half-maximum, FWHM), in velocity
142  units [see note below].
143\item[{F\_int}] The integrated flux over the object, in the units of
144  flux times velocity, corrected for the beam if necessary.
145\item[{F\_peak}] The peak flux over the object, in the units of flux.
146\item[{S/Nmax}] The signal-to-noise ratio at the peak pixel.
147\item[{X1, X2}] The minimum and maximum X-pixel coordinates.
148\item[{Y1, Y2}] The minimum and maximum Y-pixel coordinates.
149\item[{Z1, Z2}] The minimum and maximum Z-pixel coordinates.
150\item[{Npix}] The number of voxels (\ie distinct $(x,y,z)$ coordinates)
151  in the detection.
152\item[{Flag}] Whether the detection has any warning flags (see below).
153\end{Lentry}
154
155These parameters are written to the screen during execution. There are
156alternative ways of calculating the total flux, the position and
157velocity width, however, and so additional parameters are written to
158the output file:
159\begin{Lentry}
160\item[{w\_20}] The velocity width of the detection at 20\% of the peak
161  flux, in velocity units [see note below].
162\item[{w\_VEL}] The full velocity width of the detection (max channel
163  $-$ min channel, in velocity units).
164\item[{F\_tot}] The sum of the flux values of all detected voxels.
165\item[{X\_av, Y\_av, Z\_av}] The average pixel value in each
166  axis direction \ie X\_av is the average of the $x$-values of all
167  pixels in the detection.
168\item[{X\_cent, Y\_cent, Z\_cent}] The centroid position, being
169  the flux-weighted average of the pixels.
170\item[{X\_peak, Y\_peak, Z\_peak}] The location of the pixel
171  containing the peak flux value.
172\end{Lentry}
173The velocity width of the detection is calculated at 50\% and 20\% of
174the peak flux, as well as the full detected width (if the detection
175threshold is greater than 20\% or 50\% of the peak, then these values
176will be the same as \texttt{w\_VEL}. The type of position value given
177in the \texttt{X, Y, Z} columns in the screen output is determined by
178the \texttt{pixelCentre} parameter. All three alternatives are shown
179in the output file.
180
181The user can specify the precision used to display the flux, velocity
182and S/Nmax values, by using the input parameters \texttt{precFlux},
183\texttt{precVel} and \texttt{precSNR} respectively. These values apply
184to the tables written to the screen and to the output file, as well as
185for the VOTable (see below).
186
187The \texttt{Name} is derived from the WCS position. For instance, a
188source that is centred on the RA,Dec position 12$^h$53$^m$45$^s$,
189-36$^\circ$24$'$12$''$ will be given the name J125345$-$362412, if the
190epoch is J2000, or the name B125345$-$362412 if it is B1950. An
191alternative form is used for Galactic coordinates: a source centred on
192the position ($l$,$b$) = (323.1245, 5.4567) will be called
193G323.124$+$05.457. If the WCS is not valid (\ie is not present or does
194not have all the necessary information), the \texttt{Name, RA, DEC,
195VEL} and related columns are not printed, but the pixel coordinates
196are still provided.
197
198The velocity units can be specified by the user, using the parameter
199\texttt{spectralUnits} (enter it as a single string with no
200spaces). The default value is km/s, which should be suitable for most
201users. These units are also used to give the units of integrated
202flux. Note that if there is no rest frequency specified in the FITS
203header, the \duchamp output will instead default to using Frequency,
204with units of MHz.
205
206If the WCS is absent or not sufficiently specified, then all columns
207from \texttt{RA/GLON} to \texttt{w\_VEL} will be left blank. Also,
208\texttt{F\_int} will be replaced with the more simple \texttt{F\_tot}.
209
210The \texttt{Flag} column contains any warning flags, such as:
211\begin{itemize}
212\item \textbf{E} -- The detection is next to the spatial edge of the image,
213meaning either the limit of the pixels, or the limit of the non-BLANK
214pixel region.
215\item \textbf{S} -- The detection lies at the edge of the spectral region.
216\item \textbf{N} -- The total flux, summed over all the (non-BLANK)
217pixels in the smallest box that completely encloses the detection, is
218negative. Note that this sum is likely to include non-detected
219pixels. It is of use in pointing out detections that lie next to
220strongly negative pixels, such as might arise due to interference --
221the detected pixels might then also be due to the interference, so
222caution is advised.
223\end{itemize}
224In the absence of any of these flags, a \textbf{-} will be recorded in
225this column.
226
227\secC{Other results lists}
228
229Three additional results files can also be requested. One option is a
230VOTable-format XML file, containing just the RA, Dec, Velocity and the
231corresponding widths of the detections, as well as the fluxes. The
232user should set \texttt{flagVOT = true}, and put the desired filename
233in the parameter \texttt{votFile} -- note that the default is for it
234not to be produced. This file should be compatible with all Virtual
235Observatory tools (such as Aladin%
236\footnote{%Aladin can be found on the web at
237\href{http://aladin.u-strasbg.fr/}{http://aladin.u-strasbg.fr/}}
238or TOPCAT\footnote{%Tool for OPerations on Catalogues And Tables:
239\href{http://www.star.bristol.ac.uk/~mbt/topcat/}%
240{http://www.star.bristol.ac.uk/~mbt/topcat/}}).
241
242A second option is an annotation file for use with the Karma toolkit
243of visualisation tools (in particular, with \texttt{kvis}). There are
244two options on how objects are represented, governed by the
245\texttt{annotationType} parameter. Setting this to \texttt{borders}
246results in a border being drawn around the spatial pixels of the
247object, in a manner similar to that seen in Fig.~\ref{fig-spect}. Note
248that Karma/\texttt{kvis} does not always do this perfectly, so the
249lines may not be directly lined up with pixel borders. The other
250option is \texttt{annotationType = circles}. This will draw a circle
251at the position of each detection, scaled by the spatial size of the
252detection, and number it according to the Obj\# given above. To make
253use of this option, the user should set \texttt{flagKarma = true}, and
254put the desired filename in the parameter \texttt{karmaFile} -- again,
255the default is for it not to be produced.
256
257The final optional results file produced is a simple text file that
258contains the spectra for each detected object. The format of the file
259is as follows: the first column has the spectral coordinate, over the
260full range of values; the remaining columns represent the flux values
261for each object at the corresponding spectral position. The flux value
262used is the same as that plotted in the spectral plot detailed below,
263and governed by the \texttt{spectralMethod} parameter. An example of
264what a spectral text file might look like is given below:
265
266\begin{quote}
267  {\footnotesize
268    \begin{tabular}{lllll}
269      1405.00219727  &0.01323344  &0.23648241  &0.04202826  &-0.00506790  \\
270      1405.06469727  &0.01302835  &0.27393046  &0.04686056  &-0.00471084  \\
271      1405.12719727  &0.01583361  &0.27760920  &0.04114933  &-0.01168737  \\
272      1405.18969727  &0.01271889  &0.31489247  &0.03307962  &-0.00300790  \\
273      1405.25219727  &0.01597644  &0.30401203  &0.05356426  &-0.00551653  \\
274      1405.31469727  &0.00773827  &0.30031312  &0.04074831  &-0.00570147  \\
275      1405.37719727  &0.00738304  &0.27921870  &0.05272378  &-0.00504959  \\
276      1405.43969727  &0.01353923  &0.26132512  &0.03667958  &-0.00151006  \\ 
277      1405.50219727  &0.01119724  &0.28987029  &0.03497849  &-0.00645589  \\ 
278      1405.56469727  &0.00813379  &0.29839963  &0.04711142  &0.00536576   \\ 
279      1405.62719727  &0.00774377  &0.26530230  &0.04620502  &0.00724631   \\ 
280      1405.68969727  &0.00576067  &0.23215000  &0.04995513  &0.00290841   \\
281      1405.75219727  &0.00452834  &0.16484940  &0.04261605  &-0.00612812  \\ 
282      1405.81469727  &0.01406293  &0.15989439  &0.03817926  &-0.00758385  \\
283      1405.87719727  &0.01116611  &0.11890682  &0.05499069  &-0.00626362  \\ 
284      1405.93969727  &0.00687582  &0.10620256  &0.04743370  &0.00055177   \\
285      $\vdots$       &$\vdots$    &$\vdots$    &$\vdots$    &$\vdots$     \\
286    \end{tabular}
287  }
288\end{quote}
289
290In addition to these three files, a log file can also be produced. As
291the program is running, it also (optionally) records the detections
292made in each individual spectrum or channel (see \S\ref{sec-detection}
293for details on this process). This is recorded in the file given by
294the parameter \texttt{LogFile}. This file does not include the columns
295\texttt{Name, RA, DEC, w\_RA, w\_DEC, VEL, w\_VEL}. This file is
296designed primarily for diagnostic purposes: \eg to see if a given set
297of pixels is detected in, say, one channel image, but does not survive
298the merging process. The list of pixels (and their fluxes) in the
299final detection list are also printed to this file, again for
300diagnostic purposes. The file also records the execution time, as well
301as the command-line statement used to run \duchamp. The creation of
302this log file can be prevented by setting \texttt{flagLog = false}
303(which is the default).
304
305\secB{Graphical output}
306
307\begin{figure}[t]
308  \begin{center}
309    \includegraphics[width=\textwidth]{example_spectrum}
310  \end{center}
311  \caption{\footnotesize An example of the spectral output. Note several
312    of the features discussed in the text: the red lines indicating the
313    reconstructed spectrum; the blue dashed lines indicating the
314    spectral extent of the detection; the green hashed area indicating
315    the Milky Way channels that are ignored by the searching algorithm;
316    the blue border showing its spatial extent on the 0th moment map;
317    and the 15~arcmin-long scale bar.}
318  \label{fig-spect}
319\end{figure}
320
321\begin{figure}[!t]
322  \begin{center}
323    \includegraphics[width=\textwidth]{example_moment_map}
324  \end{center}
325  \caption{\footnotesize An example of the moment map created by
326    \duchamp. The full extent of the cube is covered, and the 0th moment
327    of each object is shown (integrated individually over all the
328    detected channels). The purple line indicates the limit of the
329    non-BLANK pixels.}
330  \label{fig-moment}
331\end{figure}
332
333\secC{Mask image}
334\label{sec-maskOut}
335
336It is possible to create a FITS file containing a mask array. This
337array is designed to indicate the location of detected objects. The
338value of the detected pixels is determined by the
339\texttt{flagMaskWithObjectNum} parameter: if \texttt{true}, the value
340of the pixels is given by the corresponding object ID number; if
341\texttt{false}, they take the value 1 for all objects. Pixels not in a
342detected object have the value 0. To create this FITS file, set the
343input parameter \texttt{flagOutputMask=true}. The file will be named
344according to the \texttt{fileOutputMask} parameter, or, if this is not
345given, \texttt{image.MASK.fits} (where the input image is called
346\texttt{image.fits}).
347
348\secC{Spectral plots}
349
350As well as the output data file, a postscript file (with the filename
351given by the \texttt{spectralFile} parameter) is created that shows
352the spectrum for each detection, together with a small cutout image
353(the 0th moment) and basic information about the detection (note that
354any flags are printed after the name of the detection, in the format
355\texttt{[E]}). If the cube was reconstructed, the spectrum from the
356reconstruction is shown in red, over the top of the original
357spectrum. The spectral extent of the detected object is indicated by
358two dashed blue lines, and the region covered by the ``Milky Way''
359channels is shown by a green hashed box. An example detection can be
360seen in Fig.~\ref{fig-spect}.
361
362The spectrum that is plotted is governed by the
363\texttt{spectralMethod} parameter. It can be either \texttt{peak} (the
364default), where the spectrum is from the spatial pixel containing the
365detection's peak flux; or \texttt{sum}, where the spectrum is summed
366over all spatial pixels, and then corrected for the beam size.  The
367spectral extent of the detection is indicated with blue lines, and a
368zoom is shown in a separate window.
369
370The cutout image can optionally include a border around the spatial
371pixels that are in the detection (turned on and off by the
372\texttt{drawBorders} parameter -- the default is \texttt{true}). It
373includes a scale bar in the bottom left corner to indicate size -- its
374length is indicated next to it (the choice of length depends on the
375size of the image).
376
377There may also be one or two extra lines on the image. A yellow line
378shows the limits of the cube's spatial region: when this is shown, the
379detected object will lie close to the edge, and the image box will
380extend outside the region covered by the data. A purple line, however,
381shows the dividing line between BLANK and non-BLANK pixels. The BLANK
382pixels will always be shown in black. The first type of line is always
383drawn, while the second is governed by the parameter
384\texttt{drawBlankEdges} (whose default is \texttt{true}), and
385obviously whether there are any BLANK pixel present.
386
387\secC{Output for 2-dimensional images}
388
389When the input image is two-dimensional, with no spectral dimension,
390this spectral plot would not make much sense. Instead, \duchamp
391creates a similar postscript file that simply includes the text
392headers as well as the 0th-moment map of the detection. As for the
393normal spectral case, this file will be written to the filename given
394by the \texttt{spectralFile} parameter.
395
396\secC{Spatial maps}
397
398Finally, a couple of images are optionally produced: a 0th moment map
399of the cube, combining just the detected channels in each object,
400showing the integrated flux in grey-scale; and a ``detection image'',
401a grey-scale image where the pixel values are the number of channels
402that spatial pixel is detected in. In both cases, if
403\texttt{drawBorders = true}, a border is drawn around the spatial
404extent of each detection, and if \texttt{drawBlankEdges = true}, the
405purple line dividing BLANK and non-BLANK pixels (as described above)
406is drawn. An example moment map is shown in Fig.~\ref{fig-moment}.
407The production or otherwise of these images is governed by the
408\texttt{flagMaps} parameter.
409
410The moment map is also displayed in a PGPlot XWindow (with the
411\texttt{/xs} display option). This feature can be turned off by
412setting \texttt{flagXOutput = false} -- this might be useful if
413running \duchamp on a terminal with no window display capability, or
414if you have set up a script to run it in a batch mode.
415
416The purpose of these images are to provide a visual guide to where the
417detections have been made, and, particularly in the case of the moment
418map, to provide an indication of the strength of the source. In both
419cases, the detections are numbered (in the same sense as the output
420list and as the spectral plots), and the spatial borders are marked
421out as for the cutout images in the spectra file. Both these images
422are saved as postscript files (given by the parameters
423\texttt{momentMap} and \texttt{detectionMap} respectively), with the
424latter also displayed in a \textsc{pgplot} window (regardless of the
425state of \texttt{flagMaps}).
426
427
428
429\secB{Re-using previous detections}
430\label{sec-reuse}
431
432It may be the case that, once you have run \duchamp with a set of
433parameters, you are unsatisfied with the output spectra -- perhaps you
434would have preferred integrated rather than peak flux to be
435plotted. However, the searching might have taken a while to run, and
436the thought of doing it again just for different plots may be a bit
437off-putting.
438
439Well, provided you have made a log file when running \duchamp (with
440the \texttt{flagLog=true} setting), it is possible to do this easily
441without having to go through the process of detecting your sources a
442second time. By using the same input file, with the additional
443parameter \texttt{usePrevious=true}, the log file that was created
444with a previous \duchamp run can be read to extract each of the
445individual detections. The output stage is then run again, with the
446parameters (in particular \texttt{pixelCentre} and
447\texttt{spectralMethod}) as given in the input file.
448
449Perhaps you would also like to extract a single source's
450spectral plot (\eg for use in a journal paper). The use-previous
451method allows you to specify particular sources to re-plot. Only these
452sources will be plotted in the \texttt{SpectraFile} file, and
453individual files will be created for each of the listed sources. Their
454filenames will follow the format of \texttt{SpectraFile}: if,
455\texttt{SpectraFile=file.ps}, source \#3 will appear in
456\texttt{file-03.ps}. To give a list of sources, use the
457\texttt{objectList} parameter, and provide a string with individual
458object numbers or object ranges: \eg 1,2,4-7,8,11.
Note: See TracBrowser for help on using the repository browser.