1 | %% TODO
|
---|
2 | %% Help doco
|
---|
3 | %% .asaprc
|
---|
4 | %% Intro
|
---|
5 | %% Plotter options - pol etc
|
---|
6 | %% Fit saving
|
---|
7 |
|
---|
8 | \documentclass[11pt]{article}
|
---|
9 | \usepackage{a4}
|
---|
10 | \usepackage[dvips]{graphicx}
|
---|
11 |
|
---|
12 | % Adjust the page size
|
---|
13 | \addtolength{\oddsidemargin}{-0.4in}
|
---|
14 | \addtolength{\evensidemargin}{+0.4in}
|
---|
15 | \addtolength{\textwidth}{+0.8in}
|
---|
16 |
|
---|
17 | \setlength{\parindent}{0mm}
|
---|
18 | \setlength{\parskip}{1ex}
|
---|
19 |
|
---|
20 |
|
---|
21 | \title{ATNF Spectral Analysis Package\\Cookbook }
|
---|
22 | \author{Chris Phillips}
|
---|
23 |
|
---|
24 |
|
---|
25 | \newcommand{\cmd}[1]{{\tt #1}}
|
---|
26 |
|
---|
27 | \begin{document}
|
---|
28 |
|
---|
29 | \maketitle
|
---|
30 |
|
---|
31 | \section{Introduction}
|
---|
32 |
|
---|
33 | %\section{Documentation Standards}
|
---|
34 |
|
---|
35 | %In most of the examples in this document, it has been assumed that the
|
---|
36 |
|
---|
37 | \section{Installation and running}
|
---|
38 |
|
---|
39 | Currently there are installations running on Linux machines at
|
---|
40 |
|
---|
41 | \begin{itemize}
|
---|
42 | \item Epping - use hosts {\tt draco} or {\tt hydra}
|
---|
43 | \item Narrabri - use host {\tt kaputar}
|
---|
44 | \item Parkes - use host {\tt bourbon}
|
---|
45 | \item Mopra - use host {\tt minos}
|
---|
46 | \end{itemize}
|
---|
47 |
|
---|
48 | To start asap log onto one of these Linux hosts and enter
|
---|
49 |
|
---|
50 | \begin{verbatim}
|
---|
51 | > cd /my/data/directory
|
---|
52 | > source /nfs/aips++/daily/aipsinit.csh # Temporary measure
|
---|
53 | > asap
|
---|
54 | \end{verbatim}
|
---|
55 |
|
---|
56 | This starts the asap. To quit, you need to type \verb+^+-d (control-d).
|
---|
57 |
|
---|
58 | \section{Interface}
|
---|
59 |
|
---|
60 | ASAP is written in C++ and python. The user interface uses the
|
---|
61 | ``ipython'' interactive shell, which is a simple interactive interface
|
---|
62 | to python. The user does not need to understand python to use this,
|
---|
63 | but certain aspects python affect what the user can do. The current
|
---|
64 | interface is object oriented. In the future, we will build a
|
---|
65 | functional (non object oriented) shell on top of this to ease
|
---|
66 | interactive use.
|
---|
67 |
|
---|
68 | \subsection {Integer Indices are 0-relative}
|
---|
69 |
|
---|
70 | Please note, all integer indices in ASAP and iPython are {\bf 0-relative}.
|
---|
71 |
|
---|
72 | \subsection{Objects}
|
---|
73 |
|
---|
74 | The ASAP interface is based around a number of ``objects'' which the
|
---|
75 | user deals with. Objects range from the data which have been read from
|
---|
76 | disk, to tools used for fitting functions to the data. The following
|
---|
77 | main objects are used :
|
---|
78 |
|
---|
79 | \begin{itemize}
|
---|
80 | \item[scantable] The data container (actual spectra and header information)
|
---|
81 | \item[fitter] A tool used to fit functions to the spectral data
|
---|
82 | \item[plotter] A tool used to plot the spectral line data
|
---|
83 | \item[reader] A tool which can be used to read data from disks
|
---|
84 | into a scantable object.
|
---|
85 | \end{itemize}
|
---|
86 |
|
---|
87 | These are all described below.
|
---|
88 |
|
---|
89 | There can be many objects of the same type. Each object is referred to
|
---|
90 | by a variable name made by the user. The name of this variable is not
|
---|
91 | important and can be set to whatever the user prefers (ie ``s'' and
|
---|
92 | ``ParkesHOH-20052002'' are equivalent). However, having a simple and
|
---|
93 | consistent naming convention will help you a lot.
|
---|
94 |
|
---|
95 | \subsection{Member functions(functions)}
|
---|
96 |
|
---|
97 | Following the object oriented approach, objects have associated
|
---|
98 | ``member functions'' which can either be used to modify the data in
|
---|
99 | some way or change global properties of the object. In this document
|
---|
100 | member functions will be referred to simply as functions. From the
|
---|
101 | command line, the user can excute these functions using the syntax:
|
---|
102 | \begin{verbatim}
|
---|
103 | ASAP> out = object.function(arguments)
|
---|
104 | \end{verbatim}
|
---|
105 |
|
---|
106 | Where \cmd{out} is the name of the returned variable (could be a new
|
---|
107 | scantable object, or a vector of data, or a status retrn), \cmd{object} is the
|
---|
108 | object variable name (set by the user), \cmd{function} is the name of
|
---|
109 | the member function and \cmd{arguments} is a list of arguments to the
|
---|
110 | function. The arguments can be provided either though position or names.
|
---|
111 | A mix of the two can be used. E.g.
|
---|
112 |
|
---|
113 | \begin{verbatim}
|
---|
114 | ASAP> av = scans(msk,weight='tsys')
|
---|
115 | ASAP> av = scans(mask=msk,weight='tsys')
|
---|
116 | ASAP> av = scans(msk,True)
|
---|
117 | ASAP> scans.polybaseline(mask=msk, order=0, insitue=True)
|
---|
118 | ASAP> scans.polybaseline(msk,0,True)
|
---|
119 | ASAP> scans.polybaseline(mask, insitu=True)
|
---|
120 | \end{verbatim}
|
---|
121 |
|
---|
122 | \subsection{Global Functions}
|
---|
123 |
|
---|
124 | Some functions do not make sense to be implemented as member
|
---|
125 | functions, typically fuctions which operate on more than one scantable
|
---|
126 | (e.g. time averaging of many scans). These functions will always be
|
---|
127 | refered to as global functions.
|
---|
128 |
|
---|
129 | \subsection{Interactive enviroment}
|
---|
130 |
|
---|
131 | ipython has a number of useful interactive features and a few things to be aware
|
---|
132 | of for the new user.
|
---|
133 |
|
---|
134 | \subsubsection{String completion}
|
---|
135 |
|
---|
136 | Tab completion is enabled for all function names. If you type the
|
---|
137 | first few letters of a function name, then type <TAB> the function
|
---|
138 | name will be auto completed if it is un-ambigious, or a list of
|
---|
139 | possibilities will be given. Auto-completion works for the user
|
---|
140 | object names as well as function names. It does not work for filenames,
|
---|
141 | nor for function arguments.
|
---|
142 |
|
---|
143 | Example
|
---|
144 | \begin{verbatim}
|
---|
145 | ASAP> scans = scantable('MyData.rpf')
|
---|
146 | ASAP> scans.se<TAB>
|
---|
147 | scans.set_cursor scans.set_freqframe scans.set_unit scans.setpol
|
---|
148 | scans.set_doppler scans.set_instrument scans.setbeam
|
---|
149 | scans.set_fluxunit scans.set_restfreqs scans.setif
|
---|
150 | ASAP> scans.set_in<TAB>
|
---|
151 | ASAP> scans.set_instrument
|
---|
152 | \end{verbatim}
|
---|
153 |
|
---|
154 | \subsubsection{Unix Interaction}
|
---|
155 |
|
---|
156 | Basic unix shell commands (pwd, ls, cd etc) can be issued from within
|
---|
157 | ASAP. This allows the user to do things list look at files in the
|
---|
158 | current directory. The shell command ``cd'' does work within ASAP
|
---|
159 | allowing the user to change between data directories. Unix programs
|
---|
160 | cannot be run this way, but the shell escape ``$!$'' can be used to run
|
---|
161 | arbitrary programs. E.g.
|
---|
162 |
|
---|
163 | \begin{verbatim}
|
---|
164 | ASAP> pwd
|
---|
165 | ASAP> ls
|
---|
166 | ASAP> ! mozilla&
|
---|
167 | \end{verbatim}
|
---|
168 |
|
---|
169 | \subsection{Help}
|
---|
170 |
|
---|
171 | Help me...
|
---|
172 |
|
---|
173 | \subsection{.asaprc}
|
---|
174 |
|
---|
175 |
|
---|
176 | \section{Scantables}
|
---|
177 |
|
---|
178 | \subsection {Description}
|
---|
179 |
|
---|
180 | \subsubsection {Basic Structure}
|
---|
181 |
|
---|
182 | ASAP data handling works on objects called scantables. A scantable
|
---|
183 | holds your data, and also provides functions to operate
|
---|
184 | upon it.
|
---|
185 |
|
---|
186 | The building block of a scantable is an integration, which is a single
|
---|
187 | row of a scantable. Each row contains spectra for each beam, IF and
|
---|
188 | polarisation. For example Parkes multibeam data would contain many
|
---|
189 | beams, one IF and 2-4 polarisations, while the new Mopra 8-GHz
|
---|
190 | filterbank will eventually produce one beam, many IFs, and 2-4
|
---|
191 | polarisations.
|
---|
192 |
|
---|
193 | A collection of sequential integrations (rows) for one source is termed
|
---|
194 | a scan (and each scan has a unique numeric identifier, the ScanID). A
|
---|
195 | scantable is then a collection of one or more scans. If you have
|
---|
196 | scan-averaged your data in time, then each scan would hold just one
|
---|
197 | (averaged) integration.
|
---|
198 |
|
---|
199 | Many of the functions which work on scantables can either return a
|
---|
200 | new scantable with modified data or change the scantable insitu. Which
|
---|
201 | method is used depends on the users preference. The default can be
|
---|
202 | changed via the {\tt .asaprc} resource file.
|
---|
203 |
|
---|
204 | \subsubsection {Contents}
|
---|
205 |
|
---|
206 | A scantable has header information and data (a scantable is actually an AIPS++
|
---|
207 | Table and it is stored in Memory when you are manipulating it with ASAP.
|
---|
208 | You can store it to disk and then browse it with the AIPS++
|
---|
209 | Table browser if you know how to do that !).
|
---|
210 |
|
---|
211 | The data are stored in columns (the length of a column is the number of
|
---|
212 | rows/integrations of course).
|
---|
213 |
|
---|
214 | Two important columns are those that describe the frequency setup. We mention
|
---|
215 | them explicitly here because you need to be able to undertand the presentation
|
---|
216 | of the frequency information and possibly how to manipulate it.
|
---|
217 |
|
---|
218 | These columns are called FreqID and RestFreqID. They contain indices, for
|
---|
219 | each IF, pointing into tables with all of the frequency information for that
|
---|
220 | integration. More on these below when we discuss the \cmd{summary} function
|
---|
221 | in the next subsection.
|
---|
222 |
|
---|
223 | There are of course many other columns which contain the actual spectra,
|
---|
224 | the flags, the Tsys, the source names and so on, but those are a little
|
---|
225 | more transparently handled.
|
---|
226 |
|
---|
227 | \subsection{Management}
|
---|
228 |
|
---|
229 | During processing it is possible to create a large number of scan
|
---|
230 | tables. These all consume memory, so it is best to periodically remove
|
---|
231 | unneeded scan tables. Use \cmd{list\_scans} to print a list of all
|
---|
232 | scantables and \cmd{del} to remove unneeded ones.
|
---|
233 |
|
---|
234 | Example:
|
---|
235 |
|
---|
236 | \begin{verbatim}
|
---|
237 | ASAP> list_scans
|
---|
238 | The user created scantables are:
|
---|
239 | ['s', 'scans', 'av', 's2', 'ss']
|
---|
240 |
|
---|
241 | ASAP> del s2
|
---|
242 | ASAP> del ss
|
---|
243 | \end{verbatim}
|
---|
244 |
|
---|
245 | There is also a function \cmd{summary} to list a summary of the scantable.
|
---|
246 | You will find this very useful.
|
---|
247 |
|
---|
248 | Example:
|
---|
249 |
|
---|
250 | \begin{verbatim}
|
---|
251 | ASAP> scans = scantable('MyData.rpf')
|
---|
252 | ASAP> scans.summary() # Brief listing
|
---|
253 | ASAP> scans.summary(verbose=True) # Include frequency information
|
---|
254 | ASAP> print scan # Equivalent to brief summary function call
|
---|
255 | \end{verbatim}
|
---|
256 |
|
---|
257 | Most of what the \cmd{summary} function prints out is obvious. However,
|
---|
258 | it also prints out the FreqIDs and RestFreqIDs to which we alluded above.
|
---|
259 | These are the last column of the listing.
|
---|
260 |
|
---|
261 | The summary function gives you a scan-based summary. So it lists all of
|
---|
262 | the FreqIDs and RestFreqIDs that it encountered for each scan. If you'd
|
---|
263 | like to see what each FreqID actually means, then set the verbose
|
---|
264 | argument to True and the frequency table will be listed at the end.
|
---|
265 | FreqID of 3 say, refers to the fourth row of the frequency table (ASAP
|
---|
266 | is 0-relative). The list of rest frequencies, to which the RestFreqIDs
|
---|
267 | refer, is always listed.
|
---|
268 |
|
---|
269 | You can copy one scantable to another with the \cmd{copy} function.
|
---|
270 |
|
---|
271 | Example:
|
---|
272 |
|
---|
273 | \begin{verbatim}
|
---|
274 | ASAP> scans = scantable('MyData.rpf')
|
---|
275 | ASAP> scan2 = scans.copy()
|
---|
276 | \end{verbatim}
|
---|
277 |
|
---|
278 |
|
---|
279 |
|
---|
280 | \subsection{State}
|
---|
281 |
|
---|
282 |
|
---|
283 | Each scantable contains "state"; these are properties applying to all
|
---|
284 | of the data in the scantable.
|
---|
285 |
|
---|
286 | Examples are the selection of beam, IF and polarisation, spectral unit
|
---|
287 | (e.g. $km/s$) frequency reference frame (e.g. BARY) and velocity doppler
|
---|
288 | type (e.g. RADIO).
|
---|
289 |
|
---|
290 |
|
---|
291 |
|
---|
292 | \subsubsection{Units, Doppler and Frequency Reference Frame}
|
---|
293 |
|
---|
294 | The information describing the frequency setup for each integration
|
---|
295 | is stored fundamentally in frequency in the reference frame
|
---|
296 | of observation (E.g. TOPO).
|
---|
297 |
|
---|
298 | When required, this is converted to the desired reference frame (e.g. LSRK),
|
---|
299 | Doppler (e.g. OPTICAL) and unit (e.g. $km/s$) on-the-fly. For example,
|
---|
300 | this is important when you are displaying the data or fitting to it.
|
---|
301 |
|
---|
302 | For units, the user has the choice of frequency, velocity or channel.
|
---|
303 | The \cmd{set\_unit} function is used to set the current unit for a
|
---|
304 | scantable. All functions will (where relevant) work with the selected
|
---|
305 | unit until this changes. This is mainly important for fitting (the fits
|
---|
306 | can be computed in any of these units), plotting and mask creation.
|
---|
307 |
|
---|
308 | The velocity doppler can be changed with the \cmd{set\_doppler}
|
---|
309 | function, and the frequency reference frame can be changed with the
|
---|
310 | \cmd{set\_freqframe} function.
|
---|
311 |
|
---|
312 | Example usage:
|
---|
313 |
|
---|
314 | \begin{verbatim}
|
---|
315 | ASAP> scans = scantable('2004-11-23_1841-P484.rpf') # Read in the data
|
---|
316 | ASAP> scans.set_freqframe('LSRK') # Use the LSR velocity frame
|
---|
317 | ASAP> scans.set_unit('km/s') # Use velocity for plots etc from now on
|
---|
318 | ASAP> scans.set_doppler('OPTICAL') # Use the optical velocity convention
|
---|
319 | ASAP> scans.set_unit('MHz') # Use frequency in MHz from now on
|
---|
320 | \end{verbatim}
|
---|
321 |
|
---|
322 |
|
---|
323 | \subsubsection{Rest Frequency}
|
---|
324 |
|
---|
325 | ASAP reads the line rest frequency from the RPFITS file when reading
|
---|
326 | the data. The values stored in the RPFITS file are not always correct
|
---|
327 | and so there is a function \cmd{set\_restfreq} to set the rest frequencies.
|
---|
328 |
|
---|
329 | For each integration, there is a rest-frequency per IF (the rest
|
---|
330 | frequencies are just stored as a list with an index into them).
|
---|
331 | There are a few ways to set the rest frequencies with this function.
|
---|
332 |
|
---|
333 | If you specify just one rest frequency, then it is selected for the
|
---|
334 | specified source and IF and added to the list of rest frequencies.
|
---|
335 |
|
---|
336 | \begin{verbatim}
|
---|
337 | ASAP> scans.set_restfreqs(freqs=1.667359e9, source='NGC253', theif=0) # Selected for specified source/IF
|
---|
338 | ASAP> scans.set_restfreqs(freqs=1.667359e9) # Selected for all sources and IFs
|
---|
339 | \end{verbatim}
|
---|
340 |
|
---|
341 |
|
---|
342 | If you specify a list of frequencies, then it must be of length the
|
---|
343 | number of IFs. Regardless of the source, the rest frequency will be set
|
---|
344 | for each IF to the corresponding value in the provided list. The
|
---|
345 | internally stored list of rest frequencies will be replaced by this
|
---|
346 | list.
|
---|
347 |
|
---|
348 |
|
---|
349 | \begin{verbatim}
|
---|
350 | ASAP> scans.set_restfreqs(freqs=1.667359e9, source='NGC253', theif=0) # Selected for specified source/IF
|
---|
351 | ASAP> scans.set_restfreqs(freqs=1.667359e9) # Selected for all sources and IFs
|
---|
352 | \end{verbatim}
|
---|
353 |
|
---|
354 |
|
---|
355 | In both of the above modes, you can also specify the rest frequencies via
|
---|
356 | names in a known list rather than by their values.
|
---|
357 |
|
---|
358 | Examples:
|
---|
359 |
|
---|
360 | \begin{verbatim}
|
---|
361 | ASAP> scans.lines() # Print list of known lines
|
---|
362 | ASAP> scans.set_restfreqs(lines=['OH1665','OH1667'])
|
---|
363 | \end{verbatim}
|
---|
364 |
|
---|
365 |
|
---|
366 |
|
---|
367 | \subsection{Data Selection}
|
---|
368 |
|
---|
369 | Data selection is currently fairly limited. This will be improved in
|
---|
370 | the future.
|
---|
371 |
|
---|
372 |
|
---|
373 | \subsubsection{Cursor}
|
---|
374 |
|
---|
375 | Generally the user will want to run functions on all rows in a
|
---|
376 | scantable. This allows very fast reduction of data. There are situations
|
---|
377 | when functions should only operate on specific elements of the spectra. This
|
---|
378 | is handled by the scantable cursor, which allows the user to select a
|
---|
379 | single beam, IF and polarisation combination.
|
---|
380 |
|
---|
381 | Example :
|
---|
382 |
|
---|
383 | \begin{verbatim}
|
---|
384 | ASAP> scans.set_cursor(0,2,1) # beam, IF, pol
|
---|
385 | ASAP> scans.smooth(allaxes=F) # in situ by default or .aipsrc
|
---|
386 | \end{verbatim}
|
---|
387 |
|
---|
388 | \subsubsection{Row number}
|
---|
389 |
|
---|
390 | Most functions work on all rows of a scan table. Exceptions are the
|
---|
391 | fitter and plotter. If you wish to only operate on a selected set of
|
---|
392 | scantable rows, usw the \cmd{get_scan} function to copy the rows into
|
---|
393 | a new scantable.
|
---|
394 |
|
---|
395 | \subsubsection{Allaxes}
|
---|
396 |
|
---|
397 | Many functions have an \cmd{allaxes} option which controls whether the
|
---|
398 | function will operate on all elements within a scantable row, or just
|
---|
399 | those selected with the current cursor. The default is taken from the
|
---|
400 | users {\tt .asaprc} file.
|
---|
401 |
|
---|
402 | \subsubsection{Masks}
|
---|
403 |
|
---|
404 | Many tasks (fitting, baseline subtraction, statistics etc) should only
|
---|
405 | be run on range of channels. Depending on the current ``unit'' setting
|
---|
406 | this range is set directly as channels, velocity or frequency
|
---|
407 | ranges. Internally these are converted into a simple boolean mask for
|
---|
408 | each channel of the abscissa. This means that if the unit setting is
|
---|
409 | later changed, previously created mask are still valid. (This is not
|
---|
410 | true for functions which change the shape or shift the frequency axis).
|
---|
411 | You create masks with the function \cmd{create\_mask} and this specified
|
---|
412 | the channels to be included in the selection.
|
---|
413 |
|
---|
414 | When setting the mask in velocity, the conversion from velocity
|
---|
415 | to channels is based on the current cursor setting, selected row and
|
---|
416 | selected frequency reference frame (**Currently first row only**)
|
---|
417 |
|
---|
418 |
|
---|
419 | Example :
|
---|
420 | \begin{verbatim}
|
---|
421 |
|
---|
422 | # Select channel range for baselining
|
---|
423 | ASAP> scans.set_unit('channels')
|
---|
424 | ASAP> msk = q.create_mask([100,400],[600,800])
|
---|
425 |
|
---|
426 | # Select velocity range for fitting
|
---|
427 | ASAP> scans.set_unit('km/s')
|
---|
428 | ASAP> msk = q.create_mask([-30,-10])
|
---|
429 | \end{verbatim}
|
---|
430 |
|
---|
431 |
|
---|
432 | Sometimes it is more convenient to specify the channels to be
|
---|
433 | excluded, rather included. You can do this with the ``invert'' argument.
|
---|
434 |
|
---|
435 | Example :
|
---|
436 | \begin{verbatim}
|
---|
437 | ASAP> scans.set_unit('channels')
|
---|
438 | ASAP> msk = q.create_mask([0,100],[900-1023], invert=True) # Excludes specified channels
|
---|
439 | \end{verbatim}
|
---|
440 |
|
---|
441 | Because the mask is stored in a simple python variable, the users is
|
---|
442 | able to combine masks using simple arithmetic. To create a mask
|
---|
443 | excluding the edge channels, a strong maser feature and a birdie in
|
---|
444 | the middle of the band:
|
---|
445 |
|
---|
446 | \begin{verbatim}
|
---|
447 | ASAP> scans.set_unit('channels')
|
---|
448 | ASAP> msk1 = q.create_mask([0,100],[511,511],[900,1023],invert=True)
|
---|
449 | ASAP> scans.set_unit('km/s')
|
---|
450 | ASAP> msk2 = q.create_mask([-20,-10],invert=True)
|
---|
451 |
|
---|
452 | ASAP> mask = msk1 and msk2
|
---|
453 | \end{verbatim}
|
---|
454 |
|
---|
455 |
|
---|
456 | \section{Data Input}
|
---|
457 |
|
---|
458 | Data can be loaded in one of two ways; using the reader object or via
|
---|
459 | the scantable constructor. The scantable method is simpler but the
|
---|
460 | reader allow the user more control on what is read.
|
---|
461 |
|
---|
462 | \subsection{Scantable constructor}
|
---|
463 |
|
---|
464 | This loads all of the data from filename into the scantable object scans
|
---|
465 | and averages all the data within a scan (i.e. the resulting scantable
|
---|
466 | will have one row per scan). The recognised input file formats are
|
---|
467 | RPFITS, SDFITS (singledish fits), ASAP's scantable format and aips++
|
---|
468 | MeasurementSet2 format.
|
---|
469 |
|
---|
470 |
|
---|
471 | Example usage:
|
---|
472 |
|
---|
473 | \begin{verbatim}
|
---|
474 | ASAP> scan = scantable('2004-11-23_1841-P484.rpf')
|
---|
475 | \end{verbatim}
|
---|
476 |
|
---|
477 |
|
---|
478 | \subsection{Reader object}
|
---|
479 |
|
---|
480 | For more control when reading data into ASAP, the reader object should
|
---|
481 | be used. This has the option of only reading in a range of integrations
|
---|
482 | and does not perform any scan averaging of the data, allowing analysis
|
---|
483 | of the individual integrations. Note that due to limitation of the
|
---|
484 | RPFITS library, only one reader object can be open at one time reading
|
---|
485 | RPFITS files. To read multiple RPFITS files, the old reader must be
|
---|
486 | destroyed before the new file is opened. However, multiple readers can
|
---|
487 | be created and attached to SDFITS files.
|
---|
488 |
|
---|
489 |
|
---|
490 | Example usage:
|
---|
491 |
|
---|
492 | \begin{verbatim}
|
---|
493 | ASAP> r = reader('2003-03-16_082048_t0002.rpf')
|
---|
494 | ASAP> r.summary
|
---|
495 | ASAP> scan = r.read()
|
---|
496 | ASAP> s = r.read(range(100)) # To read in the first 100 integrations
|
---|
497 | ASAP> del r
|
---|
498 | \end{verbatim}
|
---|
499 |
|
---|
500 | \section{Basic Processing}
|
---|
501 |
|
---|
502 | In the following section, a simple data reduction to form a quotient
|
---|
503 | spectrum of a single source is followed. Variations of this approach
|
---|
504 | are given later.
|
---|
505 |
|
---|
506 | %\subsection{Editing}
|
---|
507 |
|
---|
508 | %How and when?
|
---|
509 |
|
---|
510 | \subsection{Separate reference and source observations}
|
---|
511 |
|
---|
512 | Most data from ATNF observatories distinguishes on and off source data
|
---|
513 | using the file name. This makes it easy to create two scantables with
|
---|
514 | the source and reference data. As long as there was exactly one
|
---|
515 | reference observation for each on source observation for following
|
---|
516 | method will work.
|
---|
517 |
|
---|
518 | For Mopra and Parkes data:
|
---|
519 | \begin{verbatim}
|
---|
520 | ASAP> r = scans.get_scan('*_R')
|
---|
521 | ASAP> s = scans.get_scan('*_S')
|
---|
522 | \end{verbatim}
|
---|
523 |
|
---|
524 | For Tidbinbilla data
|
---|
525 | \begin{verbatim}
|
---|
526 | ASAP> r = scans.get_scan('*_[ew]')
|
---|
527 | ASAP> s = scans.get_scan('*_[^ew]')
|
---|
528 | \end{verbatim}
|
---|
529 |
|
---|
530 | \subsection{Make the quotient spectra}
|
---|
531 |
|
---|
532 | Use the quotient function
|
---|
533 |
|
---|
534 | \begin{verbatim}
|
---|
535 | ASAP> q = s.quotient(r)
|
---|
536 | \end{verbatim}
|
---|
537 |
|
---|
538 | This uses the rows in scantable \cmd{r} as reference spectra for the
|
---|
539 | rows in scantable \cmd{s}. Scantable \cmd{r} must have either 1 row
|
---|
540 | (which is applied to all rows in \cmd{s}) or both scantables must have
|
---|
541 | the same number of rows. By default the quotient spectra is calculated
|
---|
542 | to preserve continuum emission. If you wish to remove continuum
|
---|
543 | contribution, use the \cmd{preserve} argument:
|
---|
544 |
|
---|
545 | \begin{verbatim}
|
---|
546 | ASAP> q = s.quotient(r, preserve=True)
|
---|
547 | \end{verbatim}
|
---|
548 |
|
---|
549 | \subsection{Time average separate scans}
|
---|
550 |
|
---|
551 | If you have observed the source with multiple source/reference cycles you
|
---|
552 | will want to scan-average the quotient spectra together.
|
---|
553 |
|
---|
554 | \begin{verbatim}
|
---|
555 | ASAP> av = average_time(q)
|
---|
556 | \end{verbatim}
|
---|
557 |
|
---|
558 | If for some you want to average multiple sets of scan tables together you can:
|
---|
559 |
|
---|
560 | \begin{verbatim}
|
---|
561 | ASAP> av = average_time(q1, q2, q3)
|
---|
562 | \end{verbatim}
|
---|
563 |
|
---|
564 | The default is not to use any weighting, which probably is not what
|
---|
565 | you want. The alternative is to use variance or Tsys weighting.
|
---|
566 |
|
---|
567 | To use variance based weighting, you need to supply a mask saying which
|
---|
568 | channel range you want it to calculate the variance from.
|
---|
569 |
|
---|
570 | \begin{verbatim}
|
---|
571 | ASAP> av = average_time(q, weight='tsys')
|
---|
572 |
|
---|
573 | ASAP> msk = q.create_mask([200,400],[600,800])
|
---|
574 | ASAP> av = average_time(q, mask=msk, weight='var')
|
---|
575 | \end{verbatim}
|
---|
576 |
|
---|
577 | \subsection{Baseline fitting}
|
---|
578 |
|
---|
579 | To make a baseline fit, you must first create a mask of channels to
|
---|
580 | use in the baseline fit.
|
---|
581 |
|
---|
582 | \begin{verbatim}
|
---|
583 | ASAP> msk = scans.create_mask([100,400],[600,900])
|
---|
584 | ASAP> scans.poly_baseline(msk, 1)
|
---|
585 | \end{verbatim}
|
---|
586 |
|
---|
587 | This will fit a first order polynomial to the selected channels and subtract
|
---|
588 | this polynomial from the full spectra.
|
---|
589 |
|
---|
590 | \subsubsection{Auto-baselining}
|
---|
591 |
|
---|
592 | The function \cmd{auto\_poly\_baseline} can be used to automatically
|
---|
593 | baseline your data with out having to specify channel ranges for
|
---|
594 | the line free data. It automatically figures out the line-free
|
---|
595 | emission and fits a polynomial baseline to that data. The user can use
|
---|
596 | masks to fix the range of channels or velocity range for the fit as
|
---|
597 | well as mark the band edge as invalid.
|
---|
598 |
|
---|
599 | Simple example
|
---|
600 |
|
---|
601 | \begin{verbatim}
|
---|
602 | ASAP> scans.auto_poly_baseline(order=2,threshold=5)
|
---|
603 | \end{verbatim}
|
---|
604 |
|
---|
605 | \cmd{order} is the polynomial order for the fit. \cmd{threshold} is
|
---|
606 | the SNR threshold to use to deliminate line emission from
|
---|
607 | signal. Making this too small or too large will result in a poor fit,
|
---|
608 | but generally the value is not critical.
|
---|
609 |
|
---|
610 | Other examples:
|
---|
611 |
|
---|
612 | \begin{verbatim}
|
---|
613 | # Don't try and fit the edge of the bandpass which is noisier
|
---|
614 | ASAP> scans.auto_poly_baseline(edge=(500,450),order=3,threshold=3)
|
---|
615 |
|
---|
616 | # Only fit a given region around the line
|
---|
617 | ASAP> scans.set_unit('km/s')
|
---|
618 | ASAP> msk = scans.create_mask((-60,-20))
|
---|
619 | ASAP> scans.auto_poly_baseline(mask=msk,order=3,threshold=3)
|
---|
620 |
|
---|
621 | \end{verbatim}
|
---|
622 |
|
---|
623 | \subsection{Average the polarisations}
|
---|
624 |
|
---|
625 | If you are just interested in the highest SNR for total intensity you
|
---|
626 | will want to average the parallel polarisations together.
|
---|
627 |
|
---|
628 | \begin{verbatim}
|
---|
629 | ASAP> scans.average_pol()
|
---|
630 | \end{verbatim}
|
---|
631 |
|
---|
632 | \subsection{Calibration}
|
---|
633 |
|
---|
634 | For most uses, calibration happens transparently as the input data
|
---|
635 | contains the Tsys measurements taken during observations. The nominal
|
---|
636 | ``Tsys'' values may be in Kelvin or Jansky. The user may wish to
|
---|
637 | supply a Tsys correction or apply gain-elevation and opacity
|
---|
638 | corrections.
|
---|
639 |
|
---|
640 | \subsubsection{Brightness Units}
|
---|
641 |
|
---|
642 | RPFITS files to not contain any information as to whether the telescope
|
---|
643 | calibration was in units of Kelvin or Janskys. On reading the data a
|
---|
644 | default value is set depending on the telescope and frequency of
|
---|
645 | observation. If this default is incorrect (you can see it in the
|
---|
646 | listing from the \cmd{summary} function) the user can either override
|
---|
647 | this value on reading the data or later. E.g:
|
---|
648 |
|
---|
649 | \begin{verbatim}
|
---|
650 | ASAP> scans = scantable(('2004-11-23_1841-P484.rpf', unit='Jy')
|
---|
651 | # Or in two steps
|
---|
652 | ASAP> scans = scantable(('2004-11-23_1841-P484.rpf')
|
---|
653 | ASAP> scans.set_fluxunit('Jy)
|
---|
654 | \end{verbatim}
|
---|
655 |
|
---|
656 | \subsubsection{Tsys scaling}
|
---|
657 |
|
---|
658 | Sometime the nominal Tsys measurement at the telescope is wrong due to
|
---|
659 | an incorrect noise diode calibration. This can easily be corrected for
|
---|
660 | with the scale function. By default, \cmd{scale} only scans the
|
---|
661 | spectra and not the corresponding Tsys.
|
---|
662 |
|
---|
663 | \begin{verbatim}
|
---|
664 | ASAP> scans.scale(1.05, tsys=True)
|
---|
665 | \end{verbatim}
|
---|
666 |
|
---|
667 | \subsubsection{Unit Conversion}
|
---|
668 |
|
---|
669 | To convert measurements in Kelvin to Jy (and vice versa) the global
|
---|
670 | function \cmd{convert\_flux} is needed. This converts and scales the data
|
---|
671 | from K to Jy or vice-versa depending on what the current brightness unit is
|
---|
672 | set to. The function knows the basic parameters for some frequencies
|
---|
673 | and telescopes, but the user may need to supply the aperture
|
---|
674 | efficiency, telescope diameter or the Jy/K factor.
|
---|
675 |
|
---|
676 | \begin{verbatim}
|
---|
677 | ASAP> scans.convert_flux # If efficency known
|
---|
678 | ASAP> scans.convert_flux(eta=0.48) # If telescope diameter known
|
---|
679 | ASAP> scans.convert_flux(eta=0.48,d=35) # Unknown telescope
|
---|
680 | ASAP> scans.convert_flux(jypk=15) # Alternative
|
---|
681 | \end{verbatim}
|
---|
682 |
|
---|
683 | \subsubsection{Gain-Elevation and Opacity Corrections}
|
---|
684 |
|
---|
685 | As higher frequencies (particularly $>$20~GHz) it is important to make
|
---|
686 | corrections for atmospheric opacity and gain-elevation effects.
|
---|
687 |
|
---|
688 | Gain-elevation curves for some telescopes and frequencies and known to
|
---|
689 | ASAP (currently only for Tid at 20~GHz). In these cases making
|
---|
690 | gain-corrections is simple. If the gain curve for your data is not
|
---|
691 | known the user can supply either a gain polynomial or text file
|
---|
692 | tabulating gain factors at a range of elevations (see \cmd{help
|
---|
693 | gain\_el}).
|
---|
694 |
|
---|
695 | Examples:
|
---|
696 |
|
---|
697 | \begin{verbatim}
|
---|
698 | ASAP> scans.gain_el() # If gain table known
|
---|
699 | ASAP> scans.gain_el(poly=[3.58788e-1,2.87243e-2,-3.219093e-4])
|
---|
700 | \end{verbatim}
|
---|
701 |
|
---|
702 | Opacity corrections can be made with the global function
|
---|
703 | \cmd{opacity}. This should work on all telescopes as long as a
|
---|
704 | measurement of the opacity factor, was made during the
|
---|
705 | observation.
|
---|
706 |
|
---|
707 | \begin{verbatim}
|
---|
708 | ASAP> scans.opacity(0.083)
|
---|
709 | \end{verbatim}
|
---|
710 |
|
---|
711 | Note that at 3~mm Mopra uses a paddle wheel for Tsys calibration,
|
---|
712 | which takes opacity effects into account (to first order). ASAP
|
---|
713 | opacity corrections should not then be used for Mopra 3-mm data.
|
---|
714 |
|
---|
715 | \subsection{Frequency Frame Alignment}
|
---|
716 |
|
---|
717 | When time averaging a series of scans together, it is possible that the
|
---|
718 | velocity scales are not exactly aligned. This may be for many reasons
|
---|
719 | such as not Doppler tracking the observations, errors in the Doppler
|
---|
720 | tracking etc. This mostly affects very long integrations or
|
---|
721 | integrations averaged together from different days data. Before
|
---|
722 | averaging such data together, they should be frequency aligned using
|
---|
723 | \cmd{freq\_align}.
|
---|
724 |
|
---|
725 | E.g.:
|
---|
726 |
|
---|
727 | \begin{verbatim}
|
---|
728 | ASAP> scans.freq_align()
|
---|
729 | ASAP> av = average_time(scans)
|
---|
730 | \end{verbatim}
|
---|
731 |
|
---|
732 | \cmd{freq\_align} has two modes of operations controlled by the
|
---|
733 | \cmd{perif} argument. By default it will align each source and freqid
|
---|
734 | separately. This is needed for scan tables containing multiple
|
---|
735 | sources. However if scan-based Doppler tracking has been made at the observatory,
|
---|
736 | each row will have a different freqid. In these cases run with
|
---|
737 | \cmd{perif=True} and all rows of a source will be aligned to the same
|
---|
738 | frame. In general \cmd{perif=True} will be needed for most
|
---|
739 | observations as Doppler tracking of some form is made at Parkes, Tid
|
---|
740 | and Mopra.
|
---|
741 |
|
---|
742 | \begin{verbatim}
|
---|
743 | ASAP> scans.freq_align(perif=True)
|
---|
744 | \end{verbatim}
|
---|
745 |
|
---|
746 | To average together data taken on different days, which are in
|
---|
747 | different scantables, each scantable must aligned to a common
|
---|
748 | reference time then the scantables averaged. The simplest way of
|
---|
749 | doing this is to allow ASAP to choose the reference time for the first
|
---|
750 | scantable then using this time for the subsequent scantables.
|
---|
751 |
|
---|
752 | \begin{verbatim}
|
---|
753 | ASAP> scans1.freq_align() # Copy the refeference Epoch from the output
|
---|
754 | ASAP> scans2.freq_align(reftime='2004/11/23/18:43:35')
|
---|
755 | ASAP> scans3.freq_align(reftime='2004/11/23/18:43:35')
|
---|
756 | ASAP> av = average_time(scans1, scans2, scans3)
|
---|
757 | \end{verbatim}
|
---|
758 |
|
---|
759 | \section{Scantable manipulation}
|
---|
760 |
|
---|
761 | While it is very useful to have many independent sources within one
|
---|
762 | scantable, it is often inconvenient for data processing. The
|
---|
763 | \cmd{get\_scan} function can be used to create a new scantable with a
|
---|
764 | selection of scans from a scantable. The selection can either be on
|
---|
765 | the source name, with simple wildcard matching or set of scan ids.
|
---|
766 |
|
---|
767 | For example:
|
---|
768 |
|
---|
769 | \begin{verbatim}
|
---|
770 | ASAP> ss = scans.get_scan(10) # Get the 11th scan (zero based)
|
---|
771 | ASAP> ss = scans.get_scan(range(10)) # Get the first 10 scans
|
---|
772 | ASAP> ss = scans.get_scan([2,4,6,8,10]) # Get a selection of scans
|
---|
773 |
|
---|
774 | ASAP> ss = scans.get_scan('345p407') # Get a specific source
|
---|
775 | ASAP> ss = scans.get_scan('345*') # Get a few sources
|
---|
776 |
|
---|
777 | ASAP> r = scans.get_scan('*_R') # Get all reference sources (Parkes/Mopra)
|
---|
778 | ASAP> s = scans.get_scan('*_S') # Get all program sources (Parkes/Mopra)
|
---|
779 | ASAP> r = scans.get_scan('*_[ew]') # Get all reference sources (Tid)
|
---|
780 | ASAP> s = scans.get_scan('*_[^ew]') # Get all program sources (Tid)
|
---|
781 |
|
---|
782 | \end{verbatim}
|
---|
783 |
|
---|
784 | To copy a scantable the following does not work:
|
---|
785 |
|
---|
786 | \begin{verbatim}
|
---|
787 | ASAP> ss = scans
|
---|
788 | \end{verbatim}
|
---|
789 |
|
---|
790 | as this just creates a reference to the original scantable. Any changes
|
---|
791 | made to \cmd{ss} and also seen in \cmd{scans}. To duplicate a
|
---|
792 | scantable, use the copy function.
|
---|
793 |
|
---|
794 | \begin{verbatim}
|
---|
795 | ASAP> ss = scans.copy
|
---|
796 | \end{verbatim}
|
---|
797 |
|
---|
798 | \section{Data Output}
|
---|
799 |
|
---|
800 | ASAP can save scantables in a variety of formats, suitable for reading
|
---|
801 | into other packages. The formats are:
|
---|
802 |
|
---|
803 | \begin{itemize}
|
---|
804 | \item[ASAP] This is the internal format used for ASAP. It is the only
|
---|
805 | format that allows the user to restore the data, fits etc. without
|
---|
806 | loosing any information. As mentioned before, the ASAP scantable
|
---|
807 | is just an AIPS++ Table (a memory-based table).
|
---|
808 | This function just converts it to a disk-based
|
---|
809 | Table. You can the access that Table with the AIPS++ Table browser
|
---|
810 | or any other AIPS++ tool.
|
---|
811 |
|
---|
812 | \item[SDFITS] The Single Dish FITS format. This format was
|
---|
813 | designed to for interchange between packages, but few packages
|
---|
814 | actually can read it.
|
---|
815 |
|
---|
816 | \item[FITS] This uses simple ``image'' fits to save the data, each row
|
---|
817 | being written to a separate fits file. This format is suitable for
|
---|
818 | importing the data into CLASS.
|
---|
819 |
|
---|
820 | \item[ASCII] A simple text based format suitable for the user to
|
---|
821 | processing using Perl or, Python, gnuplot etc.
|
---|
822 |
|
---|
823 | \item[MS2] Saves the data in an aips++ MeasurementSet V2 format.
|
---|
824 | You can also access this with the Table browser and other AIPS++
|
---|
825 | tools.
|
---|
826 |
|
---|
827 | \end{itemize}
|
---|
828 |
|
---|
829 | The default output format can be set in the users {\tt .asaprc} file.
|
---|
830 | Typical usages are:
|
---|
831 |
|
---|
832 | \begin{verbatim}
|
---|
833 | ASAP> scans.save('myscans') # Save in default format
|
---|
834 | ASAP> scans.save('myscans', 'FITS') # Save as FITS for exporting into CLASS
|
---|
835 |
|
---|
836 | ASAP> scans.save('myscans', stokes=True) # Convert raw polarisations into Stokes
|
---|
837 | ASAP> scans.save('myscans', overwrite=True) # Overwrite an existing file
|
---|
838 | \end{verbatim}
|
---|
839 |
|
---|
840 |
|
---|
841 |
|
---|
842 | \section{Plotter}
|
---|
843 |
|
---|
844 | Scantable spectra can be plotter at any time. An asapplotter object is
|
---|
845 | used for plotting, meaning multiple plot windows can be active at the
|
---|
846 | same time. On start up a default asapplotter object is created called
|
---|
847 | ``plotter''. This would normally be used for standard plotting.
|
---|
848 |
|
---|
849 | The plotter, optionally, will run in a mulipanel mode and contain
|
---|
850 | multiple plots per panel. The user must tell the plotter how they want
|
---|
851 | the data distributed. This is done using the set\_mode function. The
|
---|
852 | default can be set in the users {\tt .asaprc} file. The units (and frame
|
---|
853 | etc) of the abcissa will be whatever has previously been set by
|
---|
854 | set\_unit, set\_freqframe etc.
|
---|
855 |
|
---|
856 | Typical plotter usage would be:
|
---|
857 |
|
---|
858 | \begin{verbatim}
|
---|
859 | ASAP> scans.set_unit('km/s')
|
---|
860 | ASAP> plotter.set_mode(stacking='p',panelling='t')
|
---|
861 | ASAP> plotter.plot(scans)
|
---|
862 | \end{verbatim}
|
---|
863 |
|
---|
864 | This will plot multiple polarisation within each plot panel and each
|
---|
865 | scanrow in a separate panel.
|
---|
866 |
|
---|
867 | Other possbilities include:
|
---|
868 |
|
---|
869 | \begin{verbatim}
|
---|
870 | # Plot multiple IFs per panel
|
---|
871 | ASAP> plotter.set_mode(stacking='i',panelling='t')
|
---|
872 | more????
|
---|
873 | \end{verbatim}
|
---|
874 |
|
---|
875 | \subsection{Plot control}
|
---|
876 |
|
---|
877 | The plotter window has a row of buttons on the lower left. These can
|
---|
878 | be used to control the plotter (mostly for zooming the individual
|
---|
879 | plots). From left to right:
|
---|
880 |
|
---|
881 | \begin{itemize}
|
---|
882 |
|
---|
883 | \item[Home] This will unzoom the plots to the original zoom factor
|
---|
884 |
|
---|
885 | \item[Plot history] (left and right arrow). The plotter keeps a
|
---|
886 | history of zoom settings. The left arrow sets the plot zoom to the
|
---|
887 | previous value. The right arrow returns back again. This allows you,
|
---|
888 | for example, to zoom in on one feature then return the plot to how it
|
---|
889 | was previously.
|
---|
890 |
|
---|
891 | \item[Pan] (The Cross) This sets the cursor to pan, or scroll mode
|
---|
892 | allowing you to shift the plot within the window. Useful when
|
---|
893 | zoomed in on a feature.
|
---|
894 |
|
---|
895 | \item[Zoom] (the letter with the magnifying glass) lets you draw a
|
---|
896 | rectangle around a region of interest then zooms in on that
|
---|
897 | region. Use the plot history to unzoom again.
|
---|
898 |
|
---|
899 | \item[Save] (floppy disk). Save the plot as a postscript or .png file
|
---|
900 |
|
---|
901 | \end{itemize}
|
---|
902 |
|
---|
903 | \subsection{Other control}
|
---|
904 |
|
---|
905 | The plotter has a number of functions to describe the layout of the
|
---|
906 | plot. These include \cmd{set\_legend}, \cmd{set\_layout} and \cmd{set\_title}.
|
---|
907 |
|
---|
908 | To set the exact velocity or channel range to be plotted use the
|
---|
909 | \cmd{set\_range} function. To reset to the default value, call
|
---|
910 | \cmd{set\_range} with no arguments. E.g.
|
---|
911 |
|
---|
912 | \begin{verbatim}
|
---|
913 | ASAP> scans.set_unit('km/s')
|
---|
914 | ASAP> plotter.plot(scans)
|
---|
915 | ASAP> plotter.set_range(-150,-50)
|
---|
916 | ASAP> plotter.set_range()
|
---|
917 | \end{verbatim}
|
---|
918 |
|
---|
919 | To save a hardcopy of the current plot, use the save function, e.g.
|
---|
920 |
|
---|
921 | \begin{verbatim}
|
---|
922 | ASAP> plotter.save('myplot.ps')
|
---|
923 | \end{verbatim}
|
---|
924 |
|
---|
925 | \section{Fitting}
|
---|
926 |
|
---|
927 | Currently multicomponent Gaussian function is available. This is done
|
---|
928 | by creating a fitting object, setting up the fit and actually fitting
|
---|
929 | the data. Fitting can either be done on a single scantable row/cursor
|
---|
930 | selection or on an entire scantable using the \cmd{auto\_fit} function.
|
---|
931 |
|
---|
932 | \begin{verbatim}
|
---|
933 | ASAP> f = fitter()
|
---|
934 | ASAP> f.set_function(gauss=2) # Fit two Gaussians
|
---|
935 | ASAP> f.set_scan(scans)
|
---|
936 | ASAP> scans.set_cursor(0,0,1) # Fit the second polarisation
|
---|
937 | ASAP> scans.set_unit('km/s') # Make fit in velocity units
|
---|
938 | ASAP> f.fit(1) # Run the fit on the second row in the table
|
---|
939 | ASAP> f.plot() # Show fit in a plot window
|
---|
940 | ASAP> f.get_parameters() # Return the fit paramaters
|
---|
941 | \end{verbatim}
|
---|
942 |
|
---|
943 | This auto-guesses the initial values of the fit and works well for data
|
---|
944 | without extra confusing features. Note that the fit is performed in
|
---|
945 | whatever unit the abscissa is set to.
|
---|
946 |
|
---|
947 | If you want to confine the fitting to a smaller range (e.g. to avoid
|
---|
948 | band edge effects or RFI you must set a mask.
|
---|
949 |
|
---|
950 | \begin{verbatim}
|
---|
951 | ASAP> f = fitter()
|
---|
952 | ASAP> f.set_function(gauss=2)
|
---|
953 | ASAP> scans.set_unit('km/s') # Set the mask in channel units
|
---|
954 | ASAP> msk = s.create_mask([1800,2200])
|
---|
955 | ASAP> scans.set_unit('km/s') # Make fit in velocity units
|
---|
956 | ASAP> f.set_scan(s,msk)
|
---|
957 | ASAP> f.fit()
|
---|
958 | ASAP> f.plot()
|
---|
959 | ASAP> f.get_parameters()
|
---|
960 | \end{verbatim}
|
---|
961 |
|
---|
962 | If you wish, the initial parameter guesses can be specified specific
|
---|
963 | parameters can be fixed:
|
---|
964 |
|
---|
965 | \begin{verbatim}
|
---|
966 | ASAP> f = fitter()
|
---|
967 | ASAP> f.set_function(gauss=2)
|
---|
968 | ASAP> f.set_scan(s,msk)
|
---|
969 | ASAP> f.fit() # Fit using auto-estimates
|
---|
970 | # Set Peak, centre and fwhm for the second gaussian.
|
---|
971 | # Force the centre to be fixed
|
---|
972 | ASAP> f.set_gauss_parameters(0.4,450,150,0,1,0,component=1)
|
---|
973 | ASAP> f.fit() # Re-run the fit
|
---|
974 | \end{verbatim}
|
---|
975 |
|
---|
976 | The fitter \cmd{plot} function has a number of options to either view
|
---|
977 | the fit residuals or the individual components (by default it plots
|
---|
978 | the sum of the model components).
|
---|
979 |
|
---|
980 | Examples:
|
---|
981 |
|
---|
982 | \begin{verbatim}
|
---|
983 | # Plot the residual
|
---|
984 | ASAP> f.plot(residual=True)
|
---|
985 |
|
---|
986 | # Plot the first 2 componentsa
|
---|
987 | ASAP> f.plot(components=[0,1])
|
---|
988 |
|
---|
989 | # Plot the first and third component plus the model sum
|
---|
990 | ASAP> f.plot(components=[-1,0,2]) # -1 means the compoment sum
|
---|
991 |
|
---|
992 | \end{verbatim}
|
---|
993 |
|
---|
994 | \section{Polarisation}
|
---|
995 |
|
---|
996 | Currently ASAP only supports polarmetric analysis on linearly
|
---|
997 | polarised feeds and the cross polarisation products measured. Other
|
---|
998 | cases will be added on an as needed basic.
|
---|
999 |
|
---|
1000 | But how do you actually do it...
|
---|
1001 |
|
---|
1002 | \section{Function Summary}
|
---|
1003 |
|
---|
1004 | \begin{verbatim}
|
---|
1005 |
|
---|
1006 | [The scan container]
|
---|
1007 | scantable - a container for integrations/scans
|
---|
1008 | (can open asap/rpfits/sdfits and ms files)
|
---|
1009 | copy - returns a copy of a scan
|
---|
1010 | get_scan - gets a specific scan out of a scantable
|
---|
1011 | summary - print info about the scantable contents
|
---|
1012 | set_cursor - set a specific Beam/IF/Pol 'cursor' for
|
---|
1013 | further use
|
---|
1014 | get_cursor - print out the current cursor position
|
---|
1015 | stats - get specified statistic of the spectra in
|
---|
1016 | the scantable
|
---|
1017 | stddev - get the standard deviation of the spectra
|
---|
1018 | in the scantable
|
---|
1019 | get_tsys - get the TSys
|
---|
1020 | get_time - get the timestamps of the integrations
|
---|
1021 | get_unit - get the currnt unit
|
---|
1022 | set_unit - set the abcissa unit to be used from this
|
---|
1023 | point on
|
---|
1024 | get_abcissa - get the abcissa values and name for a given
|
---|
1025 | row (time)
|
---|
1026 | set_freqframe - set the frame info for the Spectral Axis
|
---|
1027 | (e.g. 'LSRK')
|
---|
1028 | set_doppler - set the doppler to be used from this point on
|
---|
1029 | set_instrument - set the instrument name
|
---|
1030 | get_fluxunit - get the brightness flux unit
|
---|
1031 | set_fluxunit - set the brightness flux unit
|
---|
1032 | create_mask - return an mask in the current unit
|
---|
1033 | for the given region. The specified regions
|
---|
1034 | are NOT masked
|
---|
1035 | get_restfreqs - get the current list of rest frequencies
|
---|
1036 | set_restfreqs - set a list of rest frequencies
|
---|
1037 | lines - print list of known spectral lines
|
---|
1038 | flag_spectrum - flag a whole Beam/IF/Pol
|
---|
1039 | save - save the scantable to disk as either 'ASAP'
|
---|
1040 | or 'SDFITS'
|
---|
1041 | nbeam,nif,nchan,npol - the number of beams/IFs/Pols/Chans
|
---|
1042 | history - print the history of the scantable
|
---|
1043 |
|
---|
1044 | average_time - return the (weighted) time average of a scan
|
---|
1045 | or a list of scans
|
---|
1046 | average_pol - average the polarisations together.
|
---|
1047 | The dimension won't be reduced and
|
---|
1048 | all polarisations will contain the
|
---|
1049 | averaged spectrum.
|
---|
1050 | quotient - return the on/off quotient
|
---|
1051 | scale - return a scan scaled by a given factor
|
---|
1052 | add - return a scan with given value added
|
---|
1053 | bin - return a scan with binned channels
|
---|
1054 | resample - return a scan with resampled channels
|
---|
1055 | smooth - return the spectrally smoothed scan
|
---|
1056 | poly_baseline - fit a polynomial baseline to all Beams/IFs/Pols
|
---|
1057 | gain_el - apply gain-elevation correction
|
---|
1058 | opacity - apply opacity correction
|
---|
1059 | convert_flux - convert to and from Jy and Kelvin brightness
|
---|
1060 | units
|
---|
1061 | freq_align - align spectra in frequency frame
|
---|
1062 | rotate_xyphase - rotate XY phase of cross correlation
|
---|
1063 | rotate_linpolphase - rotate the phase of the complex
|
---|
1064 | polarization O=Q+iU correlation
|
---|
1065 | [Math] Mainly functions which operate on more than one scantable
|
---|
1066 |
|
---|
1067 | average_time - return the (weighted) time average
|
---|
1068 | of a list of scans
|
---|
1069 | quotient - return the on/off quotient
|
---|
1070 | simple_math - simple mathematical operations on two scantables, 'add', 'sub', 'mul', 'div'
|
---|
1071 | [Fitting]
|
---|
1072 | fitter
|
---|
1073 | auto_fit - return a scan where the function is
|
---|
1074 | applied to all Beams/IFs/Pols.
|
---|
1075 | commit - return a new scan where the fits have been
|
---|
1076 | commited.
|
---|
1077 | fit - execute the actual fitting process
|
---|
1078 | get_chi2 - get the Chi^2
|
---|
1079 | set_scan - set the scantable to be fit
|
---|
1080 | set_function - set the fitting function
|
---|
1081 | set_parameters - set the parameters for the function(s), and
|
---|
1082 | set if they should be held fixed during fitting
|
---|
1083 | set_gauss_parameters - same as above but specialised for individual gaussian components
|
---|
1084 | get_parameters - get the fitted parameters
|
---|
1085 | plot - plot the resulting fit and/or components and
|
---|
1086 | residual
|
---|
1087 | [Plotter]
|
---|
1088 | asapplotter - a plotter for asap, default plotter is
|
---|
1089 | called 'plotter'
|
---|
1090 | plot - plot a (list of) scantable
|
---|
1091 | save - save the plot to a file ('png' ,'ps' or 'eps')
|
---|
1092 | set_mode - set the state of the plotter, i.e.
|
---|
1093 | what is to be plotted 'colour stacked'
|
---|
1094 | and what 'panelled'
|
---|
1095 | set_range - set the abcissa 'zoom' range
|
---|
1096 | set_legend - specify user labels for the legend indeces
|
---|
1097 | set_title - specify user labels for the panel indeces
|
---|
1098 | set_ordinate - specify a user label for the ordinate
|
---|
1099 | set_abcissa - specify a user label for the abcissa
|
---|
1100 | set_layout - specify the multi-panel layout (rows,cols)
|
---|
1101 |
|
---|
1102 | [Reading files]
|
---|
1103 | reader - access rpfits/sdfits files
|
---|
1104 | read - read in integrations
|
---|
1105 | summary - list info about all integrations
|
---|
1106 |
|
---|
1107 | [General]
|
---|
1108 | commands - this command
|
---|
1109 | print - print details about a variable
|
---|
1110 | list_scans - list all scantables created bt the user
|
---|
1111 | del - delete the given variable from memory
|
---|
1112 | range - create a list of values, e.g.
|
---|
1113 | range(3) = [0,1,2], range(2,5) = [2,3,4]
|
---|
1114 | help - print help for one of the listed functions
|
---|
1115 | execfile - execute an asap script, e.g. execfile('myscript') list_rcparameters - print out a list of possible values to be
|
---|
1116 | put into $HOME/.asaprc
|
---|
1117 | mask_and,mask_or,
|
---|
1118 | mask_not - boolean operations on masks created with
|
---|
1119 | scantable.create_mask
|
---|
1120 |
|
---|
1121 | Note:
|
---|
1122 | How to use this with help:
|
---|
1123 | # function 'summary'
|
---|
1124 | [xxx] is just a category
|
---|
1125 | Every 'sub-level' in this list should be replaces by a '.' Period when using help
|
---|
1126 | Example:
|
---|
1127 | ASAP> help scantable # to get info on ths scantable
|
---|
1128 | ASAP> help scantable.summary # to get help on the scantable's
|
---|
1129 | ASAP> help average_time
|
---|
1130 |
|
---|
1131 |
|
---|
1132 | \end{verbatim}
|
---|
1133 |
|
---|
1134 | \section{Scripting}
|
---|
1135 |
|
---|
1136 | Malte to add something
|
---|
1137 |
|
---|
1138 | \section{Appendix}
|
---|
1139 |
|
---|
1140 | \subsection{Installation}
|
---|
1141 |
|
---|
1142 |
|
---|
1143 | ASAP depends on a number of third-party libraries which you must
|
---|
1144 | have installed before attempting to build ASAP. These are:
|
---|
1145 |
|
---|
1146 | \begin{itemize}
|
---|
1147 | \item AIPS++
|
---|
1148 | \item Boost
|
---|
1149 | \item Matplotlib
|
---|
1150 | \item ipython/python
|
---|
1151 | \end{itemize}
|
---|
1152 |
|
---|
1153 | Debian Linux is currently supported and we intend also
|
---|
1154 | to support other popular Linux flavours, Solaris and Mac.
|
---|
1155 |
|
---|
1156 | Of the dependencies, AIPS++ is the most complex to install.
|
---|
1157 |
|
---|
1158 | \subsection{ASCII output format}
|
---|
1159 |
|
---|
1160 | \subsection{.asaprc settings}
|
---|
1161 |
|
---|
1162 | \end{document}
|
---|
1163 |
|
---|
1164 |
|
---|