- Timestamp:
- 11/30/05 16:19:25 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Release12/doc/cookbook.tex
r738 r763 1 1 \documentclass[11pt]{article} 2 2 \usepackage{a4} 3 \usepackage{calc} 3 4 \usepackage[dvips]{graphicx} 4 5 … … 12 13 13 14 14 \title{ATNF Spectral Analysis Package\\ Cookbook}15 \title{ATNF Spectral Analysis Package\\User Guide } 15 16 \author{Chris Phillips} 16 17 17 18 18 19 \newcommand{\cmd}[1]{{\tt #1}} 20 21 \newcommand{\asaprc}[3]{ 22 \begin{minipage}[t]{45mm}#1\end{minipage} 23 \begin{minipage}[t]{30mm}\raggedright #2\end{minipage}\hspace{3mm} 24 \begin{minipage}[t]{\textwidth-75mm}#3\end{minipage} 25 } 19 26 20 27 \begin{document} … … 26 33 ASAP is a single dish spectral line processing package currently being 27 34 developed by the ATNF. It is intended to process data from all ATNF 28 antennas, and can probably be used for other ant nnas if they can35 antennas, and can probably be used for other antennas if they can 29 36 produce ``Single Dish FITS'' format. It is based on the AIPS++ 30 37 package. … … 45 52 \end{itemize} 46 53 47 To start asap log onto one of these Linux hosts and 54 To start asap log onto one of these Linux hosts and enter 48 55 49 56 \begin{verbatim} … … 87 94 There can be many objects of the same type. Each object is referred to 88 95 by a variable name made by the user. The name of this variable is not 89 important and can be set to whatever the user prefers (i e``s'' and96 important and can be set to whatever the user prefers (i.e. ``s'' and 90 97 ``ParkesHOH-20052002'' are equivalent). However, having a simple and 91 98 consistent naming convention will help you a lot. … … 113 120 ASAP> av = scans(msk,weight='tsys') 114 121 ASAP> av = scans(mask=msk,weight='tsys') 115 ASAP> av = scans(msk, True)122 ASAP> av = scans(msk,tsys) 116 123 ASAP> scans.polybaseline(mask=msk, order=0, insitu=True) 117 124 ASAP> scans.polybaseline(msk,0,True) … … 128 135 \subsection{Interactive environment} 129 136 130 ipython has a number of useful interactive features and a few things to be aware131 of for the new user.137 ipython has a number of useful interactive features and a few things 138 to be aware of for the new user. 132 139 133 140 \subsubsection{String completion} … … 157 164 fail with an syntax error. 158 165 166 \subsubsection{Variable Names} 167 168 During normal data processing, the user will have to create named 169 variables to hold spectra etc. These must conform to the normal python 170 syntax, specifically they cannot contain ``special'' characters such 171 as \@ \$ etc and cannot start with a number (but can contain numbers). 172 159 173 \subsubsection{Unix Interaction} 160 174 … … 221 235 scantable.save : 'ASAP' 222 236 223 224 237 # default frequency frame to set when function 225 238 # scantable.set_freqframe is called … … 229 242 scantable.autoaverage : True 230 243 \end{verbatim} 244 245 For a complete list of \cmd{.asaprc} values, see the appendix. 231 246 232 247 \section{Scantables} … … 405 420 406 421 \begin{verbatim} 407 # Select for specified source/IF 408 ASAP> scans.set_restfreqs(freqs=1.667359e9, source='NGC253', theif=0) 409 410 # Select for all sources and IFs 411 ASAP> scans.set_restfreqs(freqs=1.667359e9) 412 \end{verbatim} 413 422 # Set rest frequency for all IFs 423 ASAP> scans.set_restfreqs(freqs=[1.6654018e9,1.667359e9,]) 424 425 \end{verbatim} 414 426 415 427 In both of the above modes, you can also specify the rest frequencies via … … 422 434 ASAP> scans.set_restfreqs(lines=['OH1665','OH1667']) 423 435 \end{verbatim} 424 425 436 426 437 … … 581 592 %How and when? 582 593 \subsection{Auto quotient} 583 Quotients can becomputed ``automatically''. This requires the data to have matching source/reference pairs or one refrence for multiple sources. 594 Quotients can be computed ``automatically''. This requires the data to 595 have matching source/reference pairs or one reference for multiple 596 sources. 584 597 585 598 \begin{verbatim} … … 772 785 As higher frequencies (particularly $>$20~GHz) it is important to make 773 786 corrections for atmospheric opacity and gain-elevation effects. 787 788 {\em Note that currently the elevation is not written correctly into 789 Tidbinbilla rpfits files. This means that gain-elevation and opacity 790 corrections will not work until a work around is implemented.} 774 791 775 792 Gain-elevation curves for some telescopes and frequencies are known to … … 819 836 \cmd{perif} argument. By default it will align each source and freqid 820 837 separately. This is needed for scan tables containing multiple 821 sources. However if scan-based Doppler tracking has been made at the observatory,822 each row will have a different freqid. In these cases run with 823 \cmd{perif=True} and all rows of a source will be aligned to the same824 frame. In general \cmd{perif=True} will be needed for most838 sources. However if scan-based Doppler tracking has been made at the 839 observatory, each row will have a different freqid. In these cases run 840 with \cmd{perif=True} and all rows of a source will be aligned to the 841 same frame. In general \cmd{perif=True} will be needed for most 825 842 observations as Doppler tracking of some form is made at Parkes, Tid 826 843 and Mopra. … … 927 944 \section{Plotter} 928 945 929 Scantable spectra can be plotte rat any time. An asapplotter object is946 Scantable spectra can be plotted at any time. An asapplotter object is 930 947 used for plotting, meaning multiple plot windows can be active at the 931 948 same time. On start up a default asapplotter object is created called … … 1155 1172 \subsection{Simple Calibration} 1156 1173 1157 {\em Currently the receiver position angle is not stored in the RPFITS 1158 file. This severely hampers correct handling of polarimetry. In the future 1159 we aim to define a general framework and populate the RPFITS files 1160 with the data required for transparent polarimetric calibration.} 1174 {\em Currently the receiver position angle is not read from the RPFITS 1175 file and a position angle of zero is assumed. This severely hampers 1176 correct handling of polarimetry. In the future we aim to define a 1177 general framework and populate the RPFITS files with the data required 1178 for transparent polarimetric calibration.} 1161 1179 1162 1180 It is possible that there is a phase offset between polarisation which … … 1199 1217 1200 1218 \begin{verbatim} 1201 ASAP> plotter.set_cursor(pol= [``I'',''Q'']1202 ASAP> plotter.set_cursor(pol= [``RR'',''LL'']1203 ASAP> plotter.set_cursor(pol= [``XX'',''YY'']1204 ASAP> plotter.set_cursor(pol= [``I'',''Plinear'']1219 ASAP> plotter.set_cursor(pol=``I Q'') 1220 ASAP> plotter.set_cursor(pol=``RR LL'') 1221 ASAP> plotter.set_cursor(pol=``XX YY'') 1222 ASAP> plotter.set_cursor(pol=``I Plinear'') 1205 1223 \end{verbatim} 1206 1224 … … 1220 1238 \end{verbatim} 1221 1239 1222 \section{Function Summary} 1240 1241 \section{Scantable Mathematics} 1242 1243 It is possible to to simple mathematics directly on scantables from 1244 the command line using the \cmd{+, -, *, /} operators as well as their 1245 cousins \cmd{+=, -= *=, /=}. This works between two scantables or a 1246 scantable and a float. (Note that it does not work for integers). 1247 1248 \begin{verbatim} 1249 ASAP> sum = scan1+scan2 1250 ASAP> scan2 = scan1+2.0 1251 ASAP> scan *= 1.05 1252 \end{verbatim} 1253 1254 \section{Scripting} 1255 1256 Because asap is based on python, it easy for the user write their own 1257 scripts and functions to process data. This is highly recommended as 1258 most processing of user data could then be done in a couple of steps 1259 using a few simple user defined functions. A Python primer is beyond 1260 the scope of this userguide. See the asap home pages for a scripting 1261 tutorial or the main python website for comprehensive documentation. 1262 1263 \hspace{1cm} http://www.atnf.csiro.au/computing/software/asap/tutorials 1264 \hspace{1cm} http://www.python.org/doc/Introduction.html 1265 1266 \subsection{Running scripts} 1267 1268 The asap global function \cmd{execfile} reads the named text file and 1269 executes the contained python code. This file can either contain 1270 function definitions which will be used in subsequent processing or 1271 just a set of commands to process a specific dataset. 1272 1273 \subsection{asapuserfuncs.py} 1274 1275 The file $\sim$/.asap/asapuserfuncs.py is automatically read in when 1276 asap is started. The user can use this to define a set of user 1277 functions which are automatically available each time asap is 1278 used. The \cmd{execfile} function can be called from within this file. 1279 1280 \section{Worked examples} 1281 1282 In the following section a few examples of end-to-end processing of 1283 some data in asap are given. 1284 1285 \subsection{Mopra} 1286 1287 \subsection{Parkes Polarimetry} 1288 1289 The following example is processing of some Parkes polarmetric 1290 observations of OH masers at 1.6~GHz. Because digital filters where 1291 used in the backend, the baselines are stable enough not to require a 1292 quotient spectra. The 4~MHz bandwidth is wide enough to observe both 1293 the 1665 and 1667~MHz OH maser transitions. Each source was observed 1294 once for about 10 minutes. Tsys information was not written to the 1295 rpfits file (a nominal 25K values was used), so the amplitudes need 1296 to be adjusted based on a separate log file. A simple user function is 1297 used to simplify this, contained in a file called mypol.py: 1298 1299 \begin{verbatim} 1300 def xyscale(data,xtsys=1.0,ytsys=1.0,nomtsys=25.0) : 1301 1302 data.set_cursor(pol=0) 1303 data.scale(xtsys/nomtsys,allaxes=False) 1304 1305 data.set_cursor(pol=1) 1306 data.scale(ytsys/nomtsys,allaxes=False) 1307 1308 data.set_cursor(pol=2) 1309 data.scale((xtsys+ytsys)/(2*nomtsys),allaxes=False) 1310 1311 data.set_cursor(pol=3) 1312 data.scale((xtsys+ytsys)/(2*nomtsys),allaxes=False) 1313 \end{verbatim} 1314 1315 The typical asap session would be 1316 1317 \begin{verbatim} 1318 1319 # Remind ourself the name of the rpfits files 1320 ls 1321 1322 # Load data from an rpfits file 1323 d1665 = scantable('2005-10-27_0154-P484.rpf') 1324 1325 # Check what we have just loaded 1326 d1665.summary 1327 1328 # View the data in velocity 1329 d1665.set_unit('km/s') 1330 d1665.set_freqframe('LSRK') 1331 1332 # Correct for the known phase offset in the crosspol data 1333 d1665.rotate_xyphase(-4) 1334 1335 # Create a copy of the data and set the rest frequency to the 1667 MHz 1336 # transition 1337 d1667 = d1665.copy() 1338 d1667.set_restfreqs(lines=['OH1667']) 1339 d1667.summary 1340 1341 # Copy out the scan we wish to process 1342 g351_5 = d1665.get_scan('351p160') 1343 g351_7 = d1667.get_scan('351p160') 1344 1345 # Plot the data 1346 plotter.plot(g351_5,g351_7) # Only shows one panel 1347 1348 # Tell the plotter to stack polarisation and panel scans 1349 plotter.set_mode('p','s') 1350 1351 # Correct for the Tsys using our predefined function 1352 execfile('mypol.py') # Read in the function 1353 xyscale(g351_5,23.2,22.7) # Execute it on the data 1354 xyscale(g351_7,23.2,22.7) 1355 1356 # Only plot the velocity range of interest 1357 plotter.set_range(-30,10) 1358 1359 # Baseline the data 1360 msk = g351_5.create_mask([-20,-15],[0,5]) 1361 g351_5.poly_baseline(msk,1) 1362 msk = g351_7.create_mask([-20,-15],[0,5]) 1363 g351_7.poly_baseline(msk,1) 1364 1365 # Update the plot with the baselined data 1366 plotter.plot() 1367 1368 # Look at the various polarisation products 1369 plotter.set_cursor(pol='RR LL') 1370 plotter.set_cursor(pol='I Plinear') 1371 plotter.set_cursor(pol='I Q U V') 1372 1373 # Save the plot as postscript 1374 plotter.save('g361_stokes.ps') 1375 1376 # Save the process spectra 1377 g351_5.save('junk5.asap') 1378 g351_7.save('junk7.asap') 1379 1380 \end{verbatim} 1381 1382 \subsection{Tidbinbilla} 1383 1384 \newpage 1385 1386 \section{Appendix} 1387 1388 \subsection{Function Summary} 1223 1389 1224 1390 \begin{verbatim} … … 1341 1507 execfile - execute an asap script, e.g. execfile('myscript') 1342 1508 list_rcparameters - print out a list of possible values to be 1343 put into $HOME/.asaprc1509 put into \$HOME/.asaprc 1344 1510 mask_and,mask_or, 1345 1511 mask_not - boolean operations on masks created with … … 1359 1525 \end{verbatim} 1360 1526 1361 \section{Scantable Mathematics}1362 1363 It is possible to to simple mathematics directly on scantables from1364 the command line using the \cmd{+, -, *, /} operators as well as their1365 cousins \cmd{+=, -= *=, /=}. This works between two scantables or a1366 scantable and a float. (Note that it does not work for integers).1367 1368 \begin{verbatim}1369 ASAP> sum = scan1+scan21370 ASAP> scan2 = scan1+2.01371 ASAP> scan *= 1.051372 \end{verbatim}1373 1374 %\section{Scripting}1375 1376 %Malte to add something1377 1378 \section{Appendix}1379 1380 1527 \subsection{Installation} 1381 1528 … … 1399 1546 \subsection{.asaprc settings} 1400 1547 1548 \asaprc{verbose}{{\bf True}/False}{Print verbose output} 1549 1550 \asaprc{insitu}{{\bf True}/False}{Apply operations on the input 1551 scantable or return new one} 1552 1553 % plotting 1554 1555 \asaprc{useplotter}{{\bf True}/False}{Preload a default plotter} 1556 1557 \asaprc{plotter.gui}{{\bf True}/False}{Do we want a GUI or plot to a 1558 file} 1559 1560 \asaprc{plotter.stacking}{{\bf Pol} Beam IF Scan Time}{Default mode for 1561 colour stacking} 1562 1563 \asaprc{plotter.panelling}{Pol Beam IF {\bf Scan} Time}{Default mode 1564 for panelling} 1565 1566 \asaprc{plotter.ganged}{{\bf True}/False}{Push panels together, to 1567 share axislabels} 1568 1569 \asaprc{plotter.decimate}{True/{\bf False}}{Decimate the number of 1570 points plotted by a factor of nchan/1024} 1571 1572 % default colours/linestyles 1573 %\asaprc{plotter.colours}{.}{.} 1574 %\asaprc{plotter.linestyles{.}{.} 1575 1576 % scantable 1577 \asaprc{scantable.save}{{\bf ASAP} SDFITS FITS ASCII MS2}{Default output 1578 format when saving} 1579 1580 \asaprc{scantable.autoaverage}{{\bf True}/False}{Auto averaging on 1581 read} 1582 1583 \asaprc{scantable.freqframe}{{\bf LSRK} TOPO BARY etc}{default 1584 frequency frame to set when function scantable.set\_freqframe is 1585 called} 1586 1587 \asaprc{scantable.allaxes}{{\bf True}/False}{Apply action to all axes 1588 not just the cursor location} 1589 1590 \asaprc{scantable.plotter}{{\bf True}/False}{Use internal plotter} 1591 1592 \asaprc{scantable.verbosesummary}{True/{\bf False}}{Control the level 1593 of information printed by summary} 1594 1401 1595 \end{document}
Note:
See TracChangeset
for help on using the changeset viewer.