Changeset 763 for branches


Ignore:
Timestamp:
11/30/05 16:19:25 (19 years ago)
Author:
phi196
Message:

Updates for 1.2 release

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Release12/doc/cookbook.tex

    r738 r763  
    11\documentclass[11pt]{article}
    22\usepackage{a4}
     3\usepackage{calc}
    34\usepackage[dvips]{graphicx}
    45
     
    1213
    1314
    14 \title{ATNF Spectral Analysis Package\\Cookbook }
     15\title{ATNF Spectral Analysis Package\\User Guide }
    1516\author{Chris Phillips}
    1617
    1718
    1819\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}
    1926
    2027\begin{document}
     
    2633ASAP is a single dish spectral line processing package currently being
    2734developed by the ATNF. It is intended to process data from all ATNF
    28 antennas, and can probably be used for other antnnas if they can
     35antennas, and can probably be used for other antennas if they can
    2936produce ``Single Dish FITS'' format. It is based on the AIPS++
    3037package.
     
    4552\end{itemize}
    4653
    47 To start asap log onto one of these Linux hosts and  enter
     54To start asap log onto one of these Linux hosts and enter
    4855
    4956\begin{verbatim}
     
    8794There can be many objects of the same type. Each object is referred to
    8895by 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 (ie ``s'' and
     96important and can be set to whatever the user prefers (i.e. ``s'' and
    9097``ParkesHOH-20052002'' are equivalent).  However, having a simple and
    9198consistent naming convention will help you a lot.
     
    113120  ASAP> av = scans(msk,weight='tsys')
    114121  ASAP> av = scans(mask=msk,weight='tsys')
    115   ASAP> av = scans(msk,True)
     122  ASAP> av = scans(msk,tsys)
    116123  ASAP> scans.polybaseline(mask=msk, order=0, insitu=True)
    117124  ASAP> scans.polybaseline(msk,0,True)
     
    128135\subsection{Interactive environment}
    129136
    130 ipython has a number of useful interactive features and a few things to be aware
    131 of for the new user.
     137ipython has a number of useful interactive features and a few things
     138to be aware of for the new user.
    132139
    133140\subsubsection{String completion}
     
    157164fail with an syntax error.
    158165
     166\subsubsection{Variable Names}
     167
     168During normal data processing, the user will have to create named
     169variables to hold spectra etc. These must conform to the normal python
     170syntax, specifically they cannot contain ``special'' characters such
     171as \@ \$ etc and cannot start with a number (but can contain numbers).
     172
    159173\subsubsection{Unix Interaction}
    160174
     
    221235  scantable.save             : 'ASAP'
    222236
    223 
    224237  # default frequency frame to set when function
    225238  # scantable.set_freqframe is called
     
    229242  scantable.autoaverage      : True
    230243\end{verbatim}
     244
     245For a complete list of \cmd{.asaprc} values, see the appendix.
    231246
    232247\section{Scantables}
     
    405420
    406421\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}
    414426
    415427In both of the above modes, you can also specify the rest frequencies via
     
    422434  ASAP> scans.set_restfreqs(lines=['OH1665','OH1667'])
    423435\end{verbatim}
    424 
    425436
    426437
     
    581592%How and when?
    582593\subsection{Auto quotient}
    583 Quotients can becomputed ``automatically''. This requires the data to have matching source/reference pairs or one refrence for multiple sources.
     594Quotients can be computed ``automatically''. This requires the data to
     595have matching source/reference pairs or one reference for multiple
     596sources.
    584597
    585598\begin{verbatim}
     
    772785As higher frequencies (particularly $>$20~GHz) it is important to make
    773786corrections for atmospheric opacity and gain-elevation effects.
     787
     788{\em Note that currently the elevation is not written correctly into
     789Tidbinbilla rpfits files. This means that gain-elevation and opacity
     790corrections will not work until a work around is implemented.}
    774791
    775792Gain-elevation curves for some telescopes and frequencies are known to
     
    819836\cmd{perif} argument. By default it will align each source and freqid
    820837separately. 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 same
    824 frame. In general \cmd{perif=True} will be needed for most
     838sources. However if scan-based Doppler tracking has been made at the
     839observatory, each row will have a different freqid. In these cases run
     840with \cmd{perif=True} and all rows of a source will be aligned to the
     841same frame. In general \cmd{perif=True} will be needed for most
    825842observations as Doppler tracking of some form is made at Parkes, Tid
    826843and Mopra.
     
    927944\section{Plotter}
    928945
    929 Scantable spectra can be plotter at any time. An asapplotter object is
     946Scantable spectra can be plotted at any time. An asapplotter object is
    930947used for plotting, meaning multiple plot windows can be active at the
    931948same time. On start up a default asapplotter object is created called
     
    11551172\subsection{Simple Calibration}
    11561173
    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
     1175file and a position angle of zero is assumed. This severely hampers
     1176correct handling of polarimetry. In the future we aim to define a
     1177general framework and populate the RPFITS files with the data required
     1178for transparent polarimetric calibration.}
    11611179
    11621180It is possible that there is a phase offset between polarisation which
     
    11991217
    12001218\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'')
    12051223\end{verbatim}
    12061224
     
    12201238\end{verbatim}
    12211239
    1222 \section{Function Summary}
     1240
     1241\section{Scantable Mathematics}
     1242
     1243It is possible to to simple mathematics directly on scantables from
     1244the command line using the \cmd{+, -, *, /} operators as well as their
     1245cousins \cmd{+=, -= *=, /=}. This works between two scantables or a
     1246scantable 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
     1256Because asap is based on python, it easy for the user write their own
     1257scripts and functions to process data. This is highly recommended as
     1258most processing of user data could then be done in a couple of steps
     1259using a few simple user defined functions. A Python primer is beyond
     1260the scope of this userguide. See the asap home pages for a scripting
     1261tutorial 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
     1268The asap global function \cmd{execfile} reads the named text file and
     1269executes the contained python code. This file can either contain
     1270function definitions which will be used in subsequent processing or
     1271just a set of commands to process a specific dataset.
     1272
     1273\subsection{asapuserfuncs.py}
     1274
     1275The file $\sim$/.asap/asapuserfuncs.py is automatically read in when
     1276asap is started. The user can use this to define a set of user
     1277functions which are automatically available each time asap is
     1278used. The \cmd{execfile} function can be called from within this file.
     1279
     1280\section{Worked examples}
     1281
     1282In the following section a few examples of end-to-end processing of
     1283some data in asap are given.
     1284
     1285\subsection{Mopra}
     1286
     1287\subsection{Parkes Polarimetry}
     1288
     1289The following example is processing of some Parkes polarmetric
     1290observations of OH masers at 1.6~GHz. Because digital filters where
     1291used in the backend, the baselines are stable enough not to require a
     1292quotient spectra. The 4~MHz bandwidth is wide enough to observe both
     1293the 1665 and 1667~MHz OH maser transitions. Each source was observed
     1294once for about 10 minutes. Tsys information was not written to the
     1295rpfits file (a nominal 25K values was used), so the amplitudes need
     1296to be adjusted based on a separate log file. A simple user function is
     1297used to simplify this, contained in a file called mypol.py:
     1298
     1299\begin{verbatim}
     1300def 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
     1315The typical asap session would be
     1316
     1317\begin{verbatim}
     1318 
     1319# Remind ourself the name of the rpfits files
     1320ls
     1321
     1322# Load data from an rpfits file
     1323d1665 = scantable('2005-10-27_0154-P484.rpf')
     1324
     1325# Check what we have just loaded
     1326d1665.summary
     1327
     1328# View the data in velocity
     1329d1665.set_unit('km/s')
     1330d1665.set_freqframe('LSRK')
     1331
     1332# Correct for the known phase offset in the crosspol data
     1333d1665.rotate_xyphase(-4)
     1334
     1335# Create a copy of the data and set the rest frequency to the 1667 MHz
     1336# transition
     1337d1667 = d1665.copy()
     1338d1667.set_restfreqs(lines=['OH1667'])
     1339d1667.summary
     1340
     1341# Copy out the scan we wish to process
     1342g351_5 = d1665.get_scan('351p160')
     1343g351_7 = d1667.get_scan('351p160')
     1344
     1345# Plot the data
     1346plotter.plot(g351_5,g351_7) # Only shows one panel
     1347
     1348# Tell the plotter to stack polarisation and panel scans
     1349plotter.set_mode('p','s')
     1350
     1351# Correct for the Tsys using our predefined function
     1352execfile('mypol.py') # Read in the function
     1353xyscale(g351_5,23.2,22.7) # Execute it on the data
     1354xyscale(g351_7,23.2,22.7)
     1355
     1356# Only plot the velocity range of interest
     1357plotter.set_range(-30,10)
     1358
     1359# Baseline the data
     1360msk = g351_5.create_mask([-20,-15],[0,5])
     1361g351_5.poly_baseline(msk,1)
     1362msk = g351_7.create_mask([-20,-15],[0,5])
     1363g351_7.poly_baseline(msk,1)
     1364
     1365# Update the plot with the baselined data
     1366plotter.plot()
     1367
     1368# Look at the various polarisation products
     1369plotter.set_cursor(pol='RR LL')
     1370plotter.set_cursor(pol='I Plinear')
     1371plotter.set_cursor(pol='I Q U V')
     1372
     1373# Save the plot as postscript
     1374plotter.save('g361_stokes.ps')
     1375
     1376# Save the process spectra
     1377g351_5.save('junk5.asap')
     1378g351_7.save('junk7.asap')
     1379
     1380\end{verbatim}
     1381
     1382\subsection{Tidbinbilla}
     1383
     1384\newpage
     1385
     1386\section{Appendix}
     1387
     1388\subsection{Function Summary}
    12231389
    12241390\begin{verbatim}
     
    13411507        execfile            - execute an asap script, e.g. execfile('myscript')
    13421508        list_rcparameters   - print out a list of possible values to be
    1343                               put into $HOME/.asaprc
     1509                              put into \$HOME/.asaprc
    13441510        mask_and,mask_or,
    13451511        mask_not            - boolean operations on masks created with
     
    13591525\end{verbatim}
    13601526
    1361 \section{Scantable Mathematics}
    1362 
    1363 It is possible to to simple mathematics directly on scantables from
    1364 the command line using the \cmd{+, -, *, /} operators as well as their
    1365 cousins \cmd{+=, -= *=, /=}. This works between two scantables or a
    1366 scantable and a float. (Note that it does not work for integers).
    1367 
    1368 \begin{verbatim}
    1369   ASAP> sum = scan1+scan2
    1370   ASAP> scan2 = scan1+2.0
    1371   ASAP> scan *= 1.05
    1372 \end{verbatim}
    1373 
    1374 %\section{Scripting}
    1375 
    1376 %Malte to add something
    1377 
    1378 \section{Appendix}
    1379 
    13801527\subsection{Installation}
    13811528
     
    13991546\subsection{.asaprc settings}
    14001547
     1548\asaprc{verbose}{{\bf True}/False}{Print verbose output}
     1549
     1550\asaprc{insitu}{{\bf True}/False}{Apply operations on the input
     1551scantable 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
     1558file}
     1559
     1560\asaprc{plotter.stacking}{{\bf Pol} Beam IF Scan Time}{Default mode for
     1561colour stacking}
     1562
     1563\asaprc{plotter.panelling}{Pol Beam IF {\bf Scan} Time}{Default mode
     1564for panelling}
     1565
     1566\asaprc{plotter.ganged}{{\bf True}/False}{Push panels together, to
     1567share axislabels}
     1568
     1569\asaprc{plotter.decimate}{True/{\bf False}}{Decimate the number of
     1570points 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
     1578format when saving}
     1579
     1580\asaprc{scantable.autoaverage}{{\bf True}/False}{Auto averaging on
     1581read}
     1582
     1583\asaprc{scantable.freqframe}{{\bf LSRK} TOPO BARY etc}{default
     1584frequency frame to set when function scantable.set\_freqframe is
     1585called}
     1586
     1587\asaprc{scantable.allaxes}{{\bf True}/False}{Apply action to all axes
     1588not 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
     1593of information printed by summary}
     1594
    14011595\end{document}
Note: See TracChangeset for help on using the changeset viewer.