Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/userguide.tex

    r1347 r1217  
    4848package.
    4949
    50 This userguide has been updated for the ASAP 2.1. Please report any
     50This userguide is being updated for the ASAP 2.1. Please report any
    5151mistakes you find.
    5252
     
    6565
    6666{\em Note. ASAP2.1 only runs on ATNF Linux machines which have been
    67 updated to Debian Sarge and are using the ``DEBIANSarge''
     67updated to Debian Sarge and are using the ``DEBIANsarge''
    6868/usr/local. If your favourite machine has not been upgraded, send a
    69 request to your friendly IT support. At the time of writing asap 2.1
    70 does not run on hydra, bourbon or kaputar.}
     69request your your friendly IT support.}
    7170
    7271\index{Running}To start asap log onto one of these Linux hosts and enter
     
    7776\end{verbatim}
    7877
    79 This starts ASAP. To quit, you need to type \verb+^+-d (control-d) or
    80 type \cmd{\%Exit}.
     78This starts the ASAP. To quit, you need to type \verb+^+-d
     79(control-d) or type \cmd{\%Exit}.
    8180
    8281\section{Interface}
     
    9998main objects are used :
    10099
    101 \begin{tabular}{ll}
    102 
    103 \cmd{scantable} & \parbox[t]{0.7\textwidth}{The data container (actual
    104   spectra and header information)} \\
    105 \cmd{selector} & \parbox[t]{0.80\textwidth}{Allows the user to select
    106   a subsection of the data, such as a specified or range of beam
    107   numbers, IFs, etc.} \\
    108 \cmd{plotter} & A tool used to plot the spectral line data \\
    109 \cmd{fitter} & A tool used to fit functions to the spectral data \\
    110 \cmd{reader} & \parbox[t]{0.8\textwidth}{A tool which can be used to
    111     read data from disks into a scantable object (advanced use).}\\
    112 \end{tabular}
     100\begin{itemize}
     101  \item[\cmd{scantable}] The data container (actual spectra and header
     102    information)
     103  \item[\cmd{selector}] Allows the user to select a subsection of the
     104    data, such as a specified or range of beam numbers, IFs, etc.
     105  \item[\cmd{plotter}] A tool used to plot the spectral line data
     106  \item[\cmd{fitter}] A tool used to fit functions to the spectral data
     107  \item[\cmd{reader}] A tool which can be used to read data from disks
     108    into a scantable object (advanced use).
     109\end{itemize}
    113110
    114111There can be many objects of the same type. Each object is referred to
     
    127124functions using the syntax:
    128125\begin{verbatim}
    129   ASAP>out = object.function(arguments)
     126  ASAP> out = object.function(arguments)
    130127\end{verbatim}
    131128
     
    139136
    140137\begin{verbatim}
    141   ASAP>av = scans.average_time(msk,weight='tsys')
    142   ASAP>av = scans.average_time(mask=msk,weight='tsys')
    143   ASAP>av = scans.average_time(msk,tsys)
    144   ASAP>scans.poly_baseline(mask=msk, order=0, insitu=True)
    145   ASAP>scans.poly_baseline(msk,0,True)
    146   ASAP>scans.poly_baseline(mask, insitu=True)
     138  ASAP> av = scans.average_time(msk,weight='tsys')
     139  ASAP> av = scans.average_time(mask=msk,weight='tsys')
     140  ASAP> av = scans.average_time(msk,tsys)
     141  ASAP> scans.poly_baseline(mask=msk, order=0, insitu=True)
     142  ASAP> scans.poly_baseline(msk,0,True)
     143  ASAP> scans.poly_baseline(mask, insitu=True)
    147144\end{verbatim}
    148145
     
    171168Example
    172169\begin{verbatim}
    173   ASAP>scans = scantable('MyData.rpf')
    174   ASAP>scans.se<TAB>
    175   ASAP>scans.set_in<TAB>
     170  ASAP> scans = scantable('MyData.rpf')
     171  ASAP> scans.se<TAB>
     172  ASAP> scans.set_in<TAB>
    176173scans.set_cursor      scans.set_freqframe   scans.set_selection
    177174scans.set_doppler     scans.set_instrument  scans.set_unit
    178175scans.set_fluxunit    scans.set_restfreqs
    179176
    180   ASAP>scans.set_instrument()
     177  ASAP> scans.set_instrument()
    181178\end{verbatim}
    182179
     
    207204
    208205\begin{verbatim}
    209   ASAP>pwd
    210   ASAP>ls
    211   ASAP>cd /my/data/directory
    212   ASAP>! mozilla&
     206  ASAP> pwd
     207  ASAP> ls
     208  ASAP> cd /my/data/directory
     209  ASAP> ! mozilla&
    213210\end{verbatim}
    214211
     
    219216
    220217\begin{verbatim}
    221   ASAP>commands()
     218  ASAP> commands()
    222219\end{verbatim}
    223220
     
    226223
    227224\begin{verbatim}
    228   ASAP>help scantable.get_scan # or help(scantable.get_scan)
    229   ASAP>help scantable.stats
    230   ASAP>help plotter.plot
    231   ASAP>help fitter.plot
    232 
    233   ASAP>scans = scantable('mydata.asap')
    234   ASAP>help scans.get_scan # Same as above
     225  ASAP> help scantable.get_scan # or help(scantable.get_scan)
     226  ASAP> help scantable.stats
     227  ASAP> help plotter.plot
     228  ASAP> help fitter.plot
     229
     230  ASAP> scans = scantable('mydata.asap')
     231  ASAP> help scans.get_scan # Same as above
    235232\end{verbatim}
    236233
     
    238235
    239236\begin{verbatim}
    240   ASAP>help average_time
     237  ASAP> help average_time
    241238\end{verbatim}
    242239
     
    288285normally contain 13 beams, 1 IF and 2 polarisations, Parkes
    289286methanol-multibeam data would contain 7 beams, 2 IFs and 2
    290 polarisations while the Mopra 8-GHz MOPS filterbank will produce one
     287polarisations while the Mopra 8-GHz MOPDS filterbank will produce one
    291288beam, many IFs, and 2-4 polarisations.
    292289
    293290All of the combinations of Beams/IFs an Polarisations are
    294 contained in separate rows. These rows are grouped in cycles (same time stamp).
     291contained in seperate rows. These rows are grouped in cycles (same time stamp).
    295292
    296293A collection of cycles for one source is termed a scan (and each scan
    297294has a unique numeric identifier, the SCANNO). A scantable is then a
    298295collection of one or more scans. If you have scan-averaged your data
    299 in time, i.e. you have averaged all cycles within a scan, then each
     296in time, i.e. you have averegaed all cycles within a scan, then each
    300297scan would hold just one (averaged) integration.
    301298
     
    305302changed via the {\tt .asaprc} resource file.
    306303
    307 For example a Mopra scan with a  4s integration time, two IFs and
     304For example a Mopra scan with a  4s intergration time, two IFs and
    308305dual polarisations has two (2s) cycles.
    309306\begin{verbatim}
     
    348345
    349346\begin{verbatim}
    350   ASAP>scans = scantable('MyData.rpf')
    351   ASAP>scans.summary()                # Brief listing
     347  ASAP> scans = scantable('MyData.rpf')
     348  ASAP> scans.summary()                # Brief listing
    352349
    353350  # Equivalent to brief summary function call
    354   ASAP>print scan
     351  ASAP> print scan
    355352\end{verbatim}
    356353
     
    359356of summary is redirected into your current pager specified by the
    360357\$PAGER environment variable. If you find the screen is reset to the
    361 original state when summary is finished (i.e. the output from summary
     358original state when summary is finished (ie the output from summary
    362359disappears), you may need to set the \$LESS environment variable to
    363360include the \cmd{-X} option.
     
    385382The common selection functions are:
    386383
    387 \begin{tabular}{ll}
    388 
    389 \cmd{set\_beams} & Select beams by index number \\
    390 \cmd{set\_ifs} & Select ifs by index number \\
    391 \cmd{set\_name} & Select by source name. Can contain ``*'' as a
    392 wildcard, e.g. ``Orion*\_R''. \\
    393 \cmd{set\_ifs} & Select IFs by index number \\
    394 
    395 \cmd{set\_polarisation} & \parbox[t]{0.73\textwidth}{Select by
    396 polarisation index or name. If polarisation names are given, the data
    397 will be on-the-fly onverted (for example from linears to Stokes). }\\
    398 
    399 \cmd{set\_query} & Set query directly. For power users only! \\
    400 \cmd{set\_tsys} & Select data based on Tsys. Also example of user
    401 definable query. \\
    402 \cmd{reset} & Reset the selection to include all spectra. \\
    403 
    404 \end{tabular}
     384\begin{itemize}
     385
     386\item[\cmd{set\_beams}] Select beams by index number
     387\item[\cmd{set\_ifs}] Select ifs by index number
     388\item[\cmd{set\_name}] Select by source name. Can contain ``*'' as a
     389wildcard, e.g. ``Orion*\_R''.
     390\item[\cmd{set\_ifs}] Select IFs by index number
     391\item[\cmd{set\_polarisation}] Select by polarisation index or
     392name. If polarisation names are given, the data will be on-the-fly
     393converted (for example from linears to Stokes).
     394\item[\cmd{set\_query}] Set query directly. For power users only!
     395\item[\cmd{set\_tsys}] Select data based on Tsys. Also example of user
     396definable query.
     397\item[\cmd{reset}] Reset the selection to include all spectra.
     398
    405399
    406400Note that all indices are zero based.
     
    409403
    410404\begin{verbatim}
    411   ASAP>selection = selector()         # Create selection object
    412   ASAP>selection.set_ifs(0)           # Just select the first IF
    413   ASAP>scans.set_selection(selection) # Apply the selection
    414   ASAP>print scans                    # Will just show the first IF
    415 
    416   ASAP>selection.set_ifs([0,1])       # Select the first two IFs
    417   ASAP>selection.set_beams([1,3,5])   # Also select three of the beams
    418   ASAP>scans.set_selection(selection) # Apply the selection
    419 
    420   ASAP>selection.set_name('G308*')     # Select by source name
    421 
    422   ASAP>selection.reset()              # Turn off selection
    423   ASAP>scans.set_selection(selection) # Apply the reset selection
    424 
    425 \end{verbatim}
     405  ASAP> selection = selector()         # Create selection object
     406  ASAP> selection.set_ifs(0)           # Just select the first IF
     407  ASAP> scans.set_selection(selection) # Apply the selection
     408  ASAP> print scans                    # Will just show the first IF
     409
     410  ASAP> selection.set_ifs([0,1])       # Select the first two IFs
     411  ASAP> selection.set_beams([1,3,5])   # Also select three of the beams
     412  ASAP> scans.set_selection(selection) # Apply the selection
     413
     414  ASAP> selection.set_name('G308*')     # Select by source name
     415
     416  ASAP> selection.reset()              # Turn off selection
     417  ASAP> scans.set_selection(selection) # Apply the reset selection
     418
     419\end{verbatim}
     420
     421\end{itemize}
    426422
    427423\subsection{State}
     
    459455
    460456\begin{verbatim}
    461   ASAP>scans = scantable('2004-11-23_1841-P484.rpf') # Read in the data
    462   ASAP>scans.set_freqframe('LSRK')  # Use the LSR velocity frame
    463   ASAP>scans.set_unit('km/s')        # Use velocity for plots etc from now on
    464   ASAP>scans.set_doppler('OPTICAL')  # Use the optical velocity convention
    465   ASAP>scans.set_unit('MHz')         # Use frequency in MHz from now on
     457  ASAP> scans = scantable('2004-11-23_1841-P484.rpf') # Read in the data
     458  ASAP> scans.set_freqframe('LSRK')  # Use the LSR velocity frame
     459  ASAP> scans.set_unit('km/s')        # Use velocity for plots etc from now on
     460  ASAP> scans.set_doppler('OPTICAL')  # Use the optical velocity convention
     461  ASAP> scans.set_unit('MHz')         # Use frequency in MHz from now on
    466462\end{verbatim}
    467463
     
    483479\begin{verbatim}
    484480  # Set all IFs
    485   ASAP>scans.set_restfreqs(freqs=1.667359e9)
     481  ASAP> scans.set_restfreqs(freqs=1.667359e9)
    486482\end{verbatim}
    487483
     
    493489\begin{verbatim}
    494490  # Set rest frequency for all IFs
    495   ASAP>scans.set_restfreqs(freqs=[1.6654018e9,1.667359e9,])
    496 
    497 \end{verbatim}
    498 
    499 A predetermined ``line catalog'' can be used to set the rest
    500 frequency. See section \S \ref{sec:linecat}.
    501 
     491  ASAP> scans.set_restfreqs(freqs=[1.6654018e9,1.667359e9,])
     492
     493\end{verbatim}
     494
     495{\em Currently the following is not implemented
     496
     497In both of the above modes, you can also specify the rest frequencies via
     498names in a known list rather than by their values.
     499
     500Examples:
     501
     502\begin{verbatim}
     503  ASAP> scans.set_restfreqs(freqs=['OH1665','OH1667'])
     504\end{verbatim}
     505}
    502506
    503507\subsubsection{Masks}
     
    528532
    529533  # Select channel range for baselining
    530   ASAP>scans.set_unit('channels')
    531   ASAP>msk = scans.create_mask([100,400],[600,800])
     534  ASAP> scans.set_unit('channels')
     535  ASAP> msk = scans.create_mask([100,400],[600,800])
    532536
    533537  # Select velocity range for fitting
    534   ASAP>scans.set_unit('km/s')
    535   ASAP>msk = scans.create_mask([-30,-10])
     538  ASAP> scans.set_unit('km/s')
     539  ASAP> msk = scans.create_mask([-30,-10])
    536540\end{verbatim}
    537541
     
    542546Example :
    543547\begin{verbatim}
    544   ASAP>scans.set_unit('channels')
    545   ASAP>msk = scans.create_mask([0,100],[900-1023], invert=True)
     548  ASAP> scans.set_unit('channels')
     549  ASAP> msk = scans.create_mask([0,100],[900-1023], invert=True)
    546550\end{verbatim}
    547551
     
    552556
    553557\begin{verbatim}
    554   ASAP>scans.set_unit('km/s')
    555   ASAP>msk = q.create_mask([-30,-10], row=5)
     558  ASAP> scans.set_unit('km/s')
     559  ASAP> msk = q.create_mask([-30,-10], row=5)
    556560\end{verbatim}
    557561
     
    562566
    563567\begin{verbatim}
    564   ASAP>scans.set_unit('channels')
    565   ASAP>msk1 = q.create_mask([0,100],[511,511],[900,1023],invert=True)
    566   ASAP>scans.set_unit('km/s')
    567   ASAP>msk2 = q.create_mask([-20,-10],invert=True)
    568 
    569   ASAP>mask = msk1 and msk2
     568  ASAP> scans.set_unit('channels')
     569  ASAP> msk1 = q.create_mask([0,100],[511,511],[900,1023],invert=True)
     570  ASAP> scans.set_unit('km/s')
     571  ASAP> msk2 = q.create_mask([-20,-10],invert=True)
     572
     573  ASAP> mask = msk1 and msk2
    570574\end{verbatim}
    571575
     
    581585
    582586\begin{verbatim}
    583   ASAP>list_scans()
     587  ASAP> list_scans()
    584588  The user created scantables are:
    585589  ['s', 'scans', 'av', 's2', 'ss']
    586590
    587   ASAP>del s2
    588   ASAP>del ss
     591  ASAP> del s2
     592  ASAP> del ss
    589593\end{verbatim}
    590594
     
    607611
    608612\begin{verbatim}
    609   ASAP>scan = scantable('2004-11-23_1841-P484.rpf')
     613  ASAP> scan = scantable('2004-11-23_1841-P484.rpf')
    610614
    611615  # Don't scan average the data
    612   ASAP>scan = scantable('2004-11-23_1841-P484.rpf', average=False)
     616  ASAP> scan = scantable('2004-11-23_1841-P484.rpf', average=False)
    613617\end{verbatim}
    614618
     
    630634
    631635\begin{verbatim}
    632   ASAP>r = reader('2003-03-16_082048_t0002.rpf')
    633   ASAP>r.summary()
    634   ASAP>scan = r.read()
    635   ASAP>del r
     636  ASAP> r = reader('2003-03-16_082048_t0002.rpf')
     637  ASAP> r.summary()
     638  ASAP> scan = r.read()
     639  ASAP> del r
    636640\end{verbatim}
    637641
     
    648652reference for multiple sources. Auto quotient assumes reference scans
    649653have a trailing ``\_R'' in the source name for data from Parkes and
    650 Mopra, and a trailing ``e'' or ``w'' for data from Tidbinbilla.
    651 This functions has two \cmd{mode}s. \cmd{paired} (the deafault), which assumes
    652 matching adjacent pairs of source/reference scans and \cmd{time}, which finds
    653 the closest reference scan in time.
    654 
    655 \begin{verbatim}
    656   ASAP>q = s.auto_quotient()
     654Mopra, and a trailing ``e'' or ``w'' for data fro, Tidbinbilla.
     655
     656\begin{verbatim}
     657  ASAP> q = s.auto_quotient()
    657658\end{verbatim}
    658659
     
    662663
    663664\begin{verbatim}
    664  ASAP>q = s.auto_quotient(preserve=True)
     665 ASAP> q = s.auto_quotient(preserve=True)
    665666\end{verbatim}
    666667
     
    677678For Mopra and Parkes data:
    678679\begin{verbatim}
    679   ASAP>r = scans.get_scan('*_R')
    680   ASAP>s = scans.get_scan('*^_R')
     680  ASAP> r = scans.get_scan('*_R')
     681  ASAP> s = scans.get_scan('*_S')
    681682\end{verbatim}
    682683
    683684For Tidbinbilla data
    684685\begin{verbatim}
    685   ASAP>r = scans.get_scan('*_[ew]')
    686   ASAP>s = scans.get_scan('*_[^ew]')
    687 \end{verbatim}
     686  ASAP> r = scans.get_scan('*_[ew]')
     687  ASAP> s = scans.get_scan('*_[^ew]')
     688\end{verbatim}
     689
     690\subsection{Make the quotient spectra}
     691
     692Use the quotient function
     693
     694\begin{verbatim}
     695  ASAP> q = s.quotient(r)
     696\end{verbatim}
     697
     698This uses the rows in scantable \cmd{r} as reference spectra for the
     699rows in scantable \cmd{s}. Scantable \cmd{r} must have either 1 row
     700(which is applied to all rows in \cmd{s}) or both scantables must have
     701the same number of rows.
    688702
    689703\subsection{Time average separate scans}
     
    694708
    695709\begin{verbatim}
    696  ASAP>av = q.average_time()
     710 ASAP> av = q.average_time()
    697711\end{verbatim}
    698712
     
    701715
    702716\begin{verbatim}
    703  ASAP>av = average_time(q1, q2, q3)
     717 ASAP> av = average_time(q1, q2, q3)
    704718\end{verbatim}
    705719
     
    709723
    710724\begin{verbatim}
    711  ASAP>av = average_time(q, weight='tintsys')
     725 ASAP> av = average_time(q, weight='tintsys')
    712726\end{verbatim}
    713727
     
    716730
    717731\begin{verbatim}
    718  ASAP>msk = scans.create_mask([200,400],[600,800])
    719  ASAP>av = average_time(scans, mask=msk, weight='var')
     732 ASAP> msk = scans.create_mask([200,400],[600,800])
     733 ASAP> av = average_time(scans, mask=msk, weight='var')
    720734\end{verbatim}
    721735
    722736If you have not observed your data with Doppler tracking (or run
    723 \cmd{freq\_align} explicitly) you should align the data in frequency
     737\cmd{freq\_align} explicitally) you should align the data in frequency
    724738before averaging.
    725739
    726740\begin{verbatim}
    727  ASAP>av = scans.average_time(align=True)
     741 ASAP> av = scans.average_time(align=True)
    728742\end{verbatim}
    729743
     
    738752
    739753\begin{verbatim}
    740  ASAP>msk = scans.create_mask([100,400],[600,900])
    741  ASAP>scans.poly_baseline(msk, order=1)
     754 ASAP> msk = scans.create_mask([100,400],[600,900])
     755 ASAP> scans.poly_baseline(msk, order=1)
    742756\end{verbatim}
    743757
     
    757771
    758772\begin{verbatim}
    759   ASAP>scans.auto_poly_baseline(order=2,threshold=5)
     773  ASAP> scans.auto_poly_baseline(order=2,threshold=5)
    760774\end{verbatim}
    761775
     
    772786\begin{verbatim}
    773787  # Don't try and fit the edge of the bandpass which is noisier
    774   ASAP>scans.auto_poly_baseline(edge=(500,450),order=3,threshold=3)
     788  ASAP> scans.auto_poly_baseline(edge=(500,450),order=3,threshold=3)
    775789
    776790  # Only fit a given region around the line
    777   ASAP>scans.set_unit('km/s')
    778   ASAP>msk = scans.create_mask([-60,-20])
    779   ASAP>scans.auto_poly_baseline(mask=msk,order=3,threshold=3)
     791  ASAP> scans.set_unit('km/s')
     792  ASAP> msk = scans.create_mask([-60,-20])
     793  ASAP> scans.auto_poly_baseline(mask=msk,order=3,threshold=3)
    780794
    781795\end{verbatim}
     
    787801
    788802\begin{verbatim}
    789  ASAP>scans.average_pol()
     803 ASAP> scans.average_pol()
    790804\end{verbatim}
    791805
     
    809823
    810824\begin{verbatim}
    811   ASAP>scans = scantable('2004-11-23_1841-P484.rpf', unit='Jy')
     825  ASAP> scans = scantable('2004-11-23_1841-P484.rpf', unit='Jy')
    812826  # Or in two steps
    813   ASAP>scans = scantable('2004-11-23_1841-P484.rpf')
    814   ASAP>scans.set_fluxunit('Jy')
     827  ASAP> scans = scantable('2004-11-23_1841-P484.rpf')
     828  ASAP> scans.set_fluxunit('Jy')
    815829\end{verbatim}
    816830
     
    826840
    827841\begin{verbatim}
    828   ASAP>scans = scantable('2004-11-23_1841-P484.rpf')
    829   ASAP>scans.set_feedtype('circular')
     842  ASAP> scans = scantable('2004-11-23_1841-P484.rpf')
     843  ASAP> scans.set_feedtype('circular')
    830844\end{verbatim}
    831845
     
    838852
    839853\begin{verbatim}
    840   ASAP>scans.scale(1.05, tsys=True)
     854  ASAP> scans.scale(1.05, tsys=True)
    841855\end{verbatim}
    842856
     
    852866
    853867\begin{verbatim}
    854   ASAP>scans.convert_flux()               # If efficency known
    855   ASAP>scans.convert_flux(eta=0.48)       # If telescope diameter known
    856   ASAP>scans.convert_flux(eta=0.48,d=35)  # Unknown telescope
    857   ASAP>scans.convert_flux(jypk=15)        # Alternative
     868  ASAP> scans.convert_flux()               # If efficency known
     869  ASAP> scans.convert_flux(eta=0.48)       # If telescope diameter known
     870  ASAP> scans.convert_flux(eta=0.48,d=35)  # Unknown telescope
     871  ASAP> scans.convert_flux(jypk=15)        # Alternative
    858872\end{verbatim}
    859873
     
    870884
    871885\begin{verbatim}
    872   ASAP>scans.recalc_azel()                # recalculate az/el
    873                                                                   # based on pointing
     886  ASAP> scans.recalc_azel()                # recalculate az/el based on pointing
    874887\end{verbatim}
    875888
    876889Gain-elevation curves for some telescopes and frequencies are known to
    877 ASAP (currently only for Tidbinbilla at 20~GHz and Parkes at K-band).
    878 In these cases making gain-corrections is simple.  If the gain curve for your
    879 data is not known, the user can supply either a gain polynomial or text file
     890ASAP (currently only for Tidbinbilla at 20~GHz).  In these cases
     891making gain-corrections is simple.  If the gain curve for your data is
     892not known, the user can supply either a gain polynomial or text file
    880893tabulating gain factors at a range of elevations (see \cmd{help
    881894scantable.gain\_el}).
     
    884897
    885898\begin{verbatim}
    886   ASAP>scans.gain_el()   # If gain table known
    887   ASAP>scans.gain_el(poly=[3.58788e-1,2.87243e-2,-3.219093e-4])
     899  ASAP> scans.gain_el()   # If gain table known
     900  ASAP> scans.gain_el(poly=[3.58788e-1,2.87243e-2,-3.219093e-4])
    888901\end{verbatim}
    889902
     
    893906
    894907\begin{verbatim}
    895   ASAP>scans.opacity(0.083)
     908  ASAP> scans.opacity(0.083)
    896909\end{verbatim}
    897910
     
    903916\label{sec:freqalign}
    904917
    905 \index{Frequency alignment}\index{Velocity alignment}When time
     918\index{Frequency alignment}\index{Velicity alignment}When time
    906919averaging a series of scans together, it is possible that the velocity
    907920scales are not exactly aligned.  This may be for many reasons such as
     
    914927
    915928\begin{verbatim}
    916   ASAP>scans.freq_align()
    917   ASAP>av = average_time(scans)
     929  ASAP> scans.freq_align()
     930  ASAP> av = average_time(scans)
    918931\end{verbatim}
    919932
     
    927940
    928941\begin{verbatim}
    929   ASAP>scans1.freq_align() # Copy the refeference Epoch from the output
    930   ASAP>scans2.freq_align(reftime='2004/11/23/18:43:35')
    931   ASAP>scans3.freq_align(reftime='2004/11/23/18:43:35')
    932   ASAP>av = average_time(scans1, scans2, scans3)
     942  ASAP> scans1.freq_align() # Copy the refeference Epoch from the output
     943  ASAP> scans2.freq_align(reftime='2004/11/23/18:43:35')
     944  ASAP> scans3.freq_align(reftime='2004/11/23/18:43:35')
     945  ASAP> av = average_time(scans1, scans2, scans3)
    933946\end{verbatim}
    934947
     
    947960
    948961\begin{verbatim}
    949   ASAP>ss = scans.get_scan(10) # Get the 11th scan (zero based)
    950   ASAP>ss = scans.get_scan(range(10)) # Get the first 10 scans
    951   ASAP>ss = scans.get_scan(range(10,20)) # Get the next 10 scans
    952   ASAP>ss = scans.get_scan([2,4,6,8,10]) # Get a selection of scans
    953 
    954   ASAP>ss = scans.get_scan('345p407') # Get a specific source
    955   ASAP>ss = scans.get_scan('345*')    # Get a few sources
    956 
    957   ASAP>r = scans.get_scan('*_R') # Get all reference sources (Parkes/Mopra)
    958   ASAP>s = scans.get_scan('*^_R') # Get all program sources (Parkes/Mopra)
    959   ASAP>r = scans.get_scan('*[ew]')  # Get all reference sources (Tid)
    960   ASAP>s = scans.get_scan('*[^ew]') # Get all program sources (Tid)
     962  ASAP> ss = scans.get_scan(10) # Get the 11th scan (zero based)
     963  ASAP> ss = scans.get_scan(range(10)) # Get the first 10 scans
     964  ASAP> ss = scans.get_scan(range(10,20)) # Get the next 10 scans
     965  ASAP> ss = scans.get_scan([2,4,6,8,10]) # Get a selection of scans
     966
     967  ASAP> ss = scans.get_scan('345p407') # Get a specific source
     968  ASAP> ss = scans.get_scan('345*')    # Get a few sources
     969
     970  ASAP> r = scans.get_scan('*_R') # Get all reference sources (Parkes/Mopra)
     971  ASAP> s = scans.get_scan('*_S') # Get all program sources (Parkes/Mopra)
     972  ASAP> r = scans.get_scan('*[ew]')  # Get all reference sources (Tid)
     973  ASAP> s = scans.get_scan('*[^ew]') # Get all program sources (Tid)
    961974
    962975\end{verbatim}
     
    965978
    966979\begin{verbatim}
    967   ASAP>ss = scans
     980  ASAP> ss = scans
    968981\end{verbatim}
    969982
     
    973986
    974987\begin{verbatim}
    975   ASAP>ss = scans.copy()
     988  ASAP> ss = scans.copy()
    976989\end{verbatim}
    977990
     
    10111024
    10121025\begin{verbatim}
    1013   ASAP>scans.save('myscans') # Save in default format
    1014   ASAP>scans.save('myscans', overwrite=True) # Overwrite an existing file
     1026  ASAP> scans.save('myscans') # Save in default format
     1027  ASAP> scans.save('myscans', 'FITS') # Save as FITS for exporting into CLASS
     1028  ASAP> scans.save('myscans', overwrite=True) # Overwrite an existing file
    10151029\end{verbatim}
    10161030
    10171031\section{Plotter}
    10181032
    1019 \index{Plotter}Scantable spectra can be plotted at any time. An
    1020 asapplotter object is used for plotting, meaning multiple plot windows
    1021 can be active at the same time. On start up a default asapplotter
    1022 object is created called ``plotter''. This would normally be used for
    1023 standard plotting.
    1024 
    1025 The plotter, optionally, will run in a multi-panel mode and contain
     1033\index{Plotter}Scantable spectra can be plotted at any time. An asapplotter object is
     1034used for plotting, meaning multiple plot windows can be active at the
     1035same time. On start up a default asapplotter object is created called
     1036``plotter''. This would normally be used for standard plotting.
     1037
     1038The plotter, optionally, will run in a multipanel mode and contain
    10261039multiple plots per panel. The user must tell the plotter how they want
    10271040the data distributed. This is done using the set\_mode function. The
     
    10331046
    10341047\begin{verbatim}
    1035   ASAP>scans.set_unit('km/s')
    1036   ASAP>plotter.set_mode(stacking='p', panelling='t')
    1037   ASAP>plotter.plot(scans)
     1048  ASAP> scans.set_unit('km/s')
     1049  ASAP> plotter.set_mode(stacking='p',panelling='t')
     1050  ASAP> plotter.plot(scans)
    10381051\end{verbatim}
    10391052
     
    10451058\begin{verbatim}
    10461059  # Plot multiple IFs per panel
    1047   ASAP>plotter.set_mode(stacking='i', panelling='t')
     1060  ASAP> plotter.set_mode(stacking='i',panelling='t')
    10481061
    10491062  # Plot multiple beams per panel
    1050   ASAP>plotter.set_mode(stacking='b', panelling='t')
     1063  ASAP> plotter.set_mode(stacking='b',panelling='t')
    10511064
    10521065  # Plot one IF per panel, time stacked
    1053   ASAP>plotter.set_mode('t', 'i')
     1066  ASAP> plotter.set_mode('t', 'i')
    10541067
    10551068  # Plot each scan in a seperate panel
    1056   ASAP>plotter.set_mode('t', 's')
     1069  ASAP> plotter.set_mode('t', 's')
    10571070
    10581071\end{verbatim}
     
    10671080should be used for this purpose. Selection can either be applied to
    10681081the scantable or directly to the plotter, the end result is the same.
    1069 You don't have to reset the scantable selection though, if you set
     1082You don't have to reset the scantable slection though, if you set
    10701083the selection on the plotter.
    10711084
     
    10731086
    10741087\begin{verbatim}
    1075   ASAP>selection = selector()
     1088  ASAP> selection = selector()
    10761089  # Select second IF
    1077   ASAP>selection.set_ifs(1)
    1078   ASAP>plotter.set_selection(selection)
     1090  ASAP> selection.set_ifs(1)
     1091  ASAP> plotter.set_selection(selection)
    10791092
    10801093  # Select first 4 beams
    1081   ASAP>selection.set_beams([0,1,2,3])
    1082   ASAP>plotter.set_selection(selection)
     1094  ASAP> selection.set_beams([0,1,2,3])
     1095  ASAP> plotter.set_selection(selection)
    10831096
    10841097  # Select a few scans
    1085   ASAP>selection.set_scans([2,4,6,10])
    1086   ASAP>plotter.set_selection(selection)
     1098  ASAP> selection.set_scans([2,4,6,10])
     1099  ASAP> plotter.set_selection(selection)
    10871100
    10881101  # Multiple selection
    1089   ASAP>selection.set_ifs(1)
    1090   ASAP>selection.set_scans([2,4,6,10])
    1091   ASAP>plotter.set_selection(selection)
     1102  ASAP> selection.set_ifs(1)
     1103  ASAP> selection.set_scans([2,4,6,10])
     1104  ASAP> plotter.set_selection(selection)
    10921105
    10931106\end{verbatim}
     
    10991112zooming the individual plots). From left to right:
    11001113
    1101 \begin{tabular}{ll}
    1102 
    1103 Home & This will unzoom the plots to the original zoom factor \\
    1104 
    1105 Plot history & \parbox[t]{0.8\textwidth}{(left and right arrow) The
    1106 plotter keeps a history of zoom settings. The left arrow sets the plot
    1107 zoom to the previous value. The right arrow returns back again. This
    1108 allows you, for example, to zoom in on one feature then return the
    1109 plot to how it was previously. }\\
    1110 
    1111 Pan & \parbox[t]{0.8\textwidth}{(The Cross) This sets the cursor to
    1112   pan, or scroll mode allowing you to shift the plot within the
    1113   window. Useful when zoomed in on a feature. }\\
    1114 
    1115 Zoom & \parbox[t]{0.8\textwidth}{(the letter with the magnifying
    1116   glass) lets you draw a rectangle around a region of interest then
    1117   zooms in on that region. Use the plot history to unzoom again.}\\
    1118 
    1119 Adjust & \parbox[t]{0.8\textwidth}{(rectangle with 4 arrows) adjust
    1120   subplot parameters (space at edge of plots)}\\
    1121 
    1122 Save & \parbox[t]{0.8\textwidth}{(floppy disk). Save the plot as a
    1123 postscript or .png file}\\
    1124 
    1125 \end{tabular}
     1114\begin{itemize}
     1115
     1116\item[Home] This will unzoom the plots to the original zoom factor
     1117
     1118\item[Plot history] (left and right arrow). The plotter keeps a
     1119history of zoom settings. The left arrow sets the plot zoom to the
     1120previous value. The right arrow returns back again. This allows you,
     1121for example, to zoom in on one feature then return the plot to how it
     1122was previously.
     1123
     1124\item[Pan] (The Cross) This sets the cursor to pan, or scroll mode
     1125  allowing you to shift the plot within the window. Useful when
     1126  zoomed in on a feature.
     1127
     1128\item[Zoom] (the letter with the magnifying glass) lets you draw a
     1129  rectangle around a region of interest then zooms in on that
     1130  region. Use the plot history to unzoom again.
     1131
     1132\item[Adjust] (rectangle with 4 arrows) adjust subplot paramaters
     1133  (space at edge of plots)
     1134
     1135\item[Save] (floppy disk). Save the plot as a postscript or .png file
    11261136
    11271137You can also type ``g'' in the plot window to toggle on and off grid
    11281138lines. Typing 'l' turns on and off logarithmic Y-axis.
     1139
     1140\end{itemize}
    11291141
    11301142\subsection{Other control}
     
    11381150
    11391151\begin{verbatim}
    1140   ASAP>scans.set_unit('km/s')
    1141   ASAP>plotter.plot(scans)
    1142   ASAP>plotter.set_range(-150,-50)
    1143   ASAP>plotter.set_range() # To reset
     1152  ASAP> scans.set_unit('km/s')
     1153  ASAP> plotter.plot(scans)
     1154  ASAP> plotter.set_range(-150,-50)
     1155  ASAP> plotter.set_range() # To reset
    11441156\end{verbatim}
    11451157
     
    11471159
    11481160\begin{verbatim}
    1149   ASAP>plotter.set_range(-10,30,-1,6.6)
     1161  ASAP> plotter.set_range(-10,30,-1,6.6)
    11501162\end{verbatim}
    11511163
     
    11531165
    11541166\begin{verbatim}
    1155   ASAP>plotter.save('myplot.ps')
    1156   ASAP>plotter.save('myplot.png', dpi=80)
     1167  ASAP> plotter.save('myplot.ps')
     1168  ASAP> plotter.save('myplot.png', dpi=80)
    11571169\end{verbatim}
    11581170
     
    11601172
    11611173The plotter allows the user to change most properties such as text
    1162 size and colour. The \cmd{commands} function and {\cmd help\
     1174size and colour. The \cmd{commands} funcation and {\cmd help\
    11631175asapplotter} list all the possible commands that can be used with the
    11641176plotter.
     
    11751187plots. Allowable values are 'line', 'dashed', 'dotted', 'dashdot',
    11761188'dashdotdot' and 'dashdashdot. Example: }{
    1177   ASAP>plotter.set\_linestyles('line dash cotted datshot.)\\
    1178   ASAP>plotter.set\_font(size=10)\\
     1189  ASAP> plotter.set\_linestyles('line dash cotted datshot.)\\
     1190  ASAP> plotter.set\_font(size=10)\\
    11791191}
    11801192
    11811193\commanddef{set\_font}{Change the font style and size. Example}{
    1182   ASAP>plotter.set\_font(weight='bold')\\
    1183   ASAP>plotter.set\_font(size=10)\\
    1184   ASAP>plotter.set\_font(style='italic')\\
     1194  ASAP> plotter.set\_font(weight='bold')\\
     1195  ASAP> plotter.set\_font(size=10)\\
     1196  ASAP> plotter.set\_font(style='italic')\\
    11851197}
    11861198
    1187 \commanddef{set\_layout}{Change the multi-panel layout, i.e. now many
     1199\commanddef{set\_layout}{Change the multi-panel layout, ie now many
    11881200  rows and columns}{
    1189   ASAP>plotter.set\_layout(3,2)
     1201  ASAP> plotter.set\_layout(3,2)
    11901202}
    11911203
    11921204\commanddef{set\_legend}{Set the position, size and optional value of the legend}{
    1193   ASAP>plotter.set\_legend(fontsize=16)\\
    1194   ASAP>plotter.set\_legend(mode=0)  \# ASAP chooses where to put the legend\\
    1195   ASAP>plotter.set\_legend(mode=4)  \# Put legend on lower right\\
    1196   ASAP>plotter.set\_legend(mode=-1) \# No legend\\
    1197   ASAP>plotter.set\_legend(mp=['RR','LL']) \# Specify legend labels\\
    1198   ASAP>plotter.set\_legend(mp=[r'\$\^\{12\}CO\$',r'\$\^\{13\}CO\$']) \# Latex labels
     1205  ASAP> plotter.set\_legend(fontsize=16)\\
     1206  ASAP> plotter.set\_legend(mode=0)  \# ASAP chooses where to put the legend\\
     1207  ASAP> plotter.set\_legend(mode=4)  \# Put legend on lower right\\
     1208  ASAP> plotter.set\_legend(mode=-1) \# No legend\\
     1209  ASAP> plotter.set\_legend(mp=['RR','LL']) \# Specify legend labels\\
     1210  ASAP> plotter.set\_legend(mp=[r'\$\^\{12\}CO\$',r'\$\^\{13\}CO\$']) \# Latex labels
    11991211}
    12001212
    12011213\commanddef{set\_title}{Set the plot title. If multiple panels are
    12021214  plotted, multiple titles have to be specified}{
    1203   ASAP>plotter.set\_title(`G323.12$-$1.79`)\\
    1204   ASAP>plotter.set\_title([`SiO`, 'Methanol'], fontsize=18)\\
     1215  ASAP> plotter.set\_title(`G323.12$-$1.79`)\\
     1216  ASAP> plotter.set\_title([`SiO`, 'Methanol'], fontsize=18)\\
    12051217}
    12061218
    12071219\subsection{Plotter Annotations}
    12081220
    1209 The plotter allows various annotations (lines, arrows, text and
     1221The plotter allows various annontations (lines, arrows, text and
    12101222``spans'') to be added to the plot. These annotations are
    12111223``temporary'', when the plotter is next refreshed
     
    12131225will be removed.
    12141226
    1215 \bigcommanddef{arrow(x,y,x+dx,y+dy)}{Draw an arrow from a specified
     1227\bigcommanddef{arrow(x,y,x+dx,y+dy)}{Draw an arrow from a specifed
    12161228\cmd{(x,y)} position to \cmd{(x+dx, y+dy)}. The values are in world
    1217 coordinates. Addition arguments which must be passed are {\cmd head\_width} and \cmd{head\_length}}{
    1218   ASAP>plotter.arrow(-40,7,35,0,head\_width=0.2, head\_length=10)
     1229coordinates. \em {HOW TO SET ARROW HEAD??}}{
     1230  ASAP> plotter.arrow(-40,7,35,0)
    12191231}
    12201232
    12211233\bigcommanddef{axhline(y, xmin, xmax)}{Draw a horizontal line at the
    1222 specified \cmd{y} position (in world coordinates) between xmin and xmax
    1223 (in relative coordinates, i.e. 0.0 is the left hand edge of the plot
    1224 while 1.0 is the right side of the plot).}{
    1225  ASAP>plotter.axhline(6.0,0.2,0.8)
     1234specifed \cmd{y} position (in world coordinates) between xmin and xmax
     1235(in relative coordinates, ie 0.0 is the left hand edge of the plot
     1236while 1.0 is the right side of the plot.}{
     1237 ASAP> plotter.axhline(6.0,0.2,0.8)
    12261238}
    12271239
    12281240\bigcommanddef{avhline(x, ymin, ymax)}{Draw a vertical line at the
    1229 specified \cmd{x} position (in world coordinates) between \cmd{ymin}
    1230 and \cmd{ymax} (in relative coordinates, i.e. 0.0 is the left hand edge
     1241specifed \cmd{x} position (in world coordinates) between \cmd{ymin}
     1242and \cmd{ymax} (in relative coordinates, ie 0.0 is the left hand edge
    12311243of the plot while 1.0 is the right side of the plot).}{
    1232  ASAP>plotter.axvline(-50.0,0.1,1.0)
     1244 ASAP> plotter.axvline(-50.0,0.1,1.0)
    12331245}
    12341246
    12351247\bigcommanddef{axhspan(ymin, ymax, \\ \hspace*{20mm}xmin,
    12361248 xmax)}{Overlay a transparent colour rectangle. \cmd{ymin} and
    1237  \cmd{ymax} are given in world coordinates while \cmd{xmin} and
     1249 \cmd{ymax} are given in world coordnates while \cmd{xmin} and
    12381250 \cmd{xmax} are given in relative coordinates}{
    1239 ASAP>plotter.axhspan(2,4,0.25,0.75)
     1251ASAP> plotter.axhspan(2,4,0.25,0.75)
    12401252}
    12411253
    12421254\bigcommanddef{axvspan(xmin, xmax, \\ \hspace*{20mm} ymin,
    12431255 ymax)}{Overlay a transparent colour rectangle. \cmd{ymin} and
    1244  \cmd{ymax} are given in relative coordinates while \cmd{xmin} and
     1256 \cmd{ymax} are given in relative coordnates while \cmd{xmin} and
    12451257 \cmd{xmax} are given in world coordinates}{
    1246 ASAP>plotter.axvspan(-50,60,0.2,0.5)
     1258ASAP> plotter.axvspan(-50,60,0.2,0.5)
    12471259}
    12481260
     
    12521264}
    12531265
     1266
     1267
    12541268These functions all take a set of \cmd{kwargs} commands. These can be
    12551269used to set colour, linewidth fontsize etc. These are standard
     
    12571271
    12581272\begin{tabular}{ll}
    1259  \tt color, facecolor, edgecolor \\
    1260  \tt width, linewidth \\
     1273 \tt color  \\
     1274 \tt linewidth \\
    12611275 \tt fontsize \\
    12621276 \tt fontname & Sans, Helvetica, Courier, Times etc\\
     
    12671281Examples:
    12681282\begin{verbatim}
    1269   ASAP>plotter.axhline(6.0,0.2,0.8, color='red', linewidth=3)
    1270   ASAP>plotter.text(-10,7,"CO", fontsize=20)
    1271 \end{verbatim}
    1272 
    1273 \section{Line Catalog}
    1274 \label{sec:linecat}
    1275 \index{Linecatalog}ASAP can load and manipulate line catlogs to
    1276 retrieve rest frequencies for \cmd{set\_restfreqs} and for line
    1277 identification in the plotter. All line catalogs are loaded into a ``linecatalog'' object.
    1278 
    1279 No line catalogs are built into ASAP, the user must load a ASCII based
    1280 table (which can optionally be saved in an internal format) either of
    1281 the users own creation or a standard line catalog such as the JPL line
    1282 catalog or Lovas. The ATNF asap ftp area as copies of the JPL and
    1283 Lovas catalog in the appropriate format:
    1284 
    1285 \hspace{1cm}\cmd{ftp://ftp.atnf.csiro.au/pub/software/asap/data}
    1286  
    1287 
    1288 \subsection{Loading a Line Catalog}
    1289 
    1290 \index{Linecatalog!loading}The ASCII text line catalog must have at
    1291 least 4 columns. The first four columns must contain (in order):
    1292 Molecule name, frequency in MHz, frequency error and ``intensity''
    1293 (any units). If the molecule name contains any spaces, they must be
    1294 wrapped in quotes \verb+""+.
    1295 
    1296 A sample from the JPL line catalog:
    1297 
    1298 \begin{verbatim}
    1299      H2D+    3955.2551 228.8818  -7.1941 
    1300      H2D+   12104.7712 177.1558  -6.0769 
    1301      H2D+   45809.2731 118.3223  -3.9494 
    1302      CH       701.6811    .0441  -7.1641 
    1303      CH       724.7709    .0456  -7.3912 
    1304      CH      3263.7940    .1000  -6.3501 
    1305      CH      3335.4810    .1000  -6.0304 
    1306 \end{verbatim}
    1307 
    1308 To load a line catalog then save it in the internal format:
    1309 
    1310 \begin{verbatim}
    1311   ASAP>jpl = linecatalog('jpl_pruned.txt')
    1312   ASAP>jpl.save('jpl.tbl')
    1313 \end{verbatim}
    1314 
    1315 Later the saved line catalog can reloaded:
    1316 
    1317 \begin{verbatim}
    1318   ASAP>jpl = linecatalog('jpl.tbl')
    1319 \end{verbatim}
    1320 
    1321 {\em NOTE:} Due to a bug in ipython, if you do not \cmd{del} the
    1322 linecatalog table before quiting asap, you will be left with temporary
    1323 files. It is safe to delete these once asap has finished.
    1324 
    1325 \subsection{Line selection}
    1326 
    1327 \index{Linecatalog!line selection}The linecatalog has a number of
    1328 selection functions to select a range of lines from a larger catalog
    1329 (the JPL catalog has $>$180000 lines for
    1330 example). \cmd{set\_frequency\_limits} selects on frequency range,
    1331 \cmd{set\_strength\_limits} selects on intensity while \cmd{set\_name}
    1332 selects on molecule name (wild cards allowed). The \cmd{summary}
    1333 function lists the currently selected lines.
    1334 
    1335 \begin{verbatim}
    1336   ASAP>jpl = linecatalog('jpl.tbl')
    1337   ASAP>jpl.set_frequency_limits(80,115,'GHz') # Lines for 3mm receiver
    1338   ASAP>jpl.set_name('*OH')                    # Select all alcohols
    1339   ASAP>jpl.set_name('OH')                     # Select only OH molecules
    1340   ASAP>jpl.summary()
    1341 
    1342   ASAP>jpl.reset()                            # Selections are accumulative
    1343   ASAP>jpl.set_frequency_limits(80,115,'GHz')
    1344   ASAP>jpl.set_strength_limits(-2,10)         # Select brightest lines
    1345   ASAP>jpl.summary()
    1346 \end{verbatim}
    1347 
    1348 \subsection{Using Linecatalog}
    1349 
    1350 The line catalogs can be used for line overlays on the plotter or with
    1351 \cmd{set\_restfreq}.
    1352 
    1353 \subsubsection{Plotting linecatalog}
    1354 
    1355 \index{Linecatalog!plotting}
    1356 
    1357 The plotter \cmd{plot\_lines} function takes a line catalog as an
    1358 argument and overlays the lines on the spectrum. {\em Currently this
    1359 only works when plotting in units of frequency (Hz, GHz etc).} If a
    1360 large line catalog has been loaded (e.g. JPL) it is highly recommended
    1361 that you use the selection functions to narrow down the number of
    1362 lines.  By default the line catalog overlay is plotted assuming a line
    1363 velocity of 0.0. This can be set using the \cmd{doppler} argument (in
    1364 km/s). Each time \cmd{plot\_lines} is called the new lines are added
    1365 to any existing line catalog annotations. These are all removed after
    1366 the next call to \cmd{plotter.plot()}.
    1367 
    1368 \begin{verbatim}
    1369   ASAP>jpl = linecatalog('jpl.tbl')
    1370   ASAP>jpl.set_frequency_limits(23,24,'GHz')
    1371   ASAP>data.set_unit('GHz')            # Only works with freq axis currently
    1372   ASAP>plotter.plot(data)
    1373   ASAP>plotter.plot_lines(jpl)
    1374 
    1375   ASAP>plotter.plot()                  # Reset plotter
    1376   ASAP>plotter.plot_lines(jpl,doppler=-10,location='Top')
    1377                              # On top with -10 km/s velocity
    1378 \end{verbatim}
    1379 
    1380 \subsubsection{Setting Rest Frequencies}
    1381 
    1382 \index{Linecatalog!set\_restfreq}A linecatalog can be used as an
    1383 argument for \cmd{set\_restfreqs}. If a personal line catalog has been
    1384 used (which has the same size as the number of number of IFs) or
    1385 linecatalog selection has been used to reduce the number of entries,
    1386 the line catalog can be used directly as an argument to
    1387 \cmd{set\_restfreqs}, e.g.:
    1388 \begin{verbatim}
    1389   ASAP>jpl = linecatalog('jpl.tbl')
    1390   ASAP>jpl.set_frequency_limits(23.66,23.75,'GHz')
    1391   ASAP>data = scantable('data.rpf')
    1392   ASAP>data.set_restfreqs(jpl)
    1393 \end{verbatim}
    1394 
    1395 If a larger linecatalog is used, individual elements can be used. Use
    1396 the \cmd{summary} to get the index number of the rest frequency you
    1397 wish to use. E.g.:
    1398 
    1399 \begin{verbatim}
    1400   ASAP>jpl.summary()
    1401   ASAP>data.set_restfreqs([jpl[11],[jpl[21]])
    1402 \end{verbatim}
    1403 
    1404 For data with many IFs, such as from MOPS, the user it is recommended
    1405 that the user creates their own line cstalog for the data and use this
    1406 to set the rest frequency for each IF.
     1283  ASAP> plotter.axhline(6.0,0.2,0.8, color='red', linewidth=3)
     1284  ASAP> plotter.text(-10,7,"CO", fontsize=20)
     1285\end{verbatim}
    14071286
    14081287\section{Fitting}
     
    14171296
    14181297\begin{verbatim}
    1419  ASAP>f = fitter()
    1420  ASAP>f.set_function(gauss=2) # Fit two Gaussians
    1421  ASAP>f.set_scan(scans)
    1422  ASAP>selection = selector()
    1423  ASAP>selection.set_polarisations(1) # Fit the second polarisation
    1424  ASAP>scans.set_selection(selection)
    1425  ASAP>scans.set_unit('km/s')  # Make fit in velocity units
    1426  ASAP>f.fit(1)                # Run the fit on the second row in the table
    1427  ASAP>f.plot()                # Show fit in a plot window
    1428  ASAP>f.get_parameters()      # Return the fit paramaters
     1298 ASAP> f = fitter()
     1299 ASAP> f.set_function(gauss=2) # Fit two Gaussians
     1300 ASAP> f.set_scan(scans)
     1301 ASAP> selection = selector()
     1302 ASAP> selection.set_polarisations(1) # Fit the second polarisation
     1303 ASAP> scans.set_selection(selection)
     1304 ASAP> scans.set_unit('km/s')  # Make fit in velocity units
     1305 ASAP> f.fit(1)                # Run the fit on the second row in the table
     1306 ASAP> f.plot()                # Show fit in a plot window
     1307 ASAP> f.get_parameters()      # Return the fit paramaters
    14291308\end{verbatim}
    14301309
     
    14371316
    14381317\begin{verbatim}
    1439   ASAP>f = fitter()
    1440   ASAP>f.set_function(gauss=2)
    1441   ASAP>scans.set_unit('km/s')  # Set the mask in channel units
    1442   ASAP>msk = s.create_mask([1800,2200])
    1443   ASAP>scans.set_unit('km/s')  # Make fit in velocity units
    1444   ASAP>f.set_scan(s,msk)
    1445   ASAP>f.fit()
    1446   ASAP>f.plot()
    1447   ASAP>f.get_parameters()
     1318  ASAP> f = fitter()
     1319  ASAP> f.set_function(gauss=2)
     1320  ASAP> scans.set_unit('km/s')  # Set the mask in channel units
     1321  ASAP> msk = s.create_mask([1800,2200])
     1322  ASAP> scans.set_unit('km/s')  # Make fit in velocity units
     1323  ASAP> f.set_scan(s,msk)
     1324  ASAP> f.fit()
     1325  ASAP> f.plot()
     1326  ASAP> f.get_parameters()
    14481327\end{verbatim}
    14491328
     
    14521331
    14531332\begin{verbatim}
    1454   ASAP>f = fitter()
    1455   ASAP>f.set_function(gauss=2)
    1456   ASAP>f.set_scan(s,msk)
    1457   ASAP>f.fit() # Fit using auto-estimates
     1333  ASAP> f = fitter()
     1334  ASAP> f.set_function(gauss=2)
     1335  ASAP> f.set_scan(s,msk)
     1336  ASAP> f.fit() # Fit using auto-estimates
    14581337  # Set Peak, centre and fwhm for the second gaussian.
    14591338  # Force the centre to be fixed
    1460   ASAP>f.set_gauss_parameters(0.4,450,150,0,1,0,component=1)
    1461   ASAP>f.fit() # Re-run the fit
     1339  ASAP> f.set_gauss_parameters(0.4,450,150,0,1,0,component=1)
     1340  ASAP> f.fit() # Re-run the fit
    14621341\end{verbatim}
    14631342
     
    14701349\begin{verbatim}
    14711350  # Plot the residual
    1472   ASAP>f.plot(residual=True)
     1351  ASAP> f.plot(residual=True)
    14731352
    14741353  # Plot the first 2 componentsa
    1475   ASAP>f.plot(components=[0,1])
     1354  ASAP> f.plot(components=[0,1])
    14761355
    14771356  # Plot the first and third component plus the model sum
    1478   ASAP>f.plot(components=[-1,0,2])  # -1 means the compoment sum
     1357  ASAP> f.plot(components=[-1,0,2])  # -1 means the compoment sum
    14791358\end{verbatim}
    14801359
     
    14851364
    14861365\begin{verbatim}
    1487   ASAP>f.store_fit()
     1366  ASAP> f.storefit()
    14881367\end{verbatim}
    14891368
     
    14971376
    14981377\begin{verbatim}
    1499   ASAP>scans.get_fit(4) # Print fits for row 4
    1500 \end{verbatim}
    1501 
    1502 A fit can also be exported to an ASCII file using the \cmd{store\_fit}
    1503 function. Simply give the name of the output file requires as an
    1504 argument.
    1505 
    1506 \begin{verbatim}
    1507   ASAP>f.store_fit('myfit.txt')
     1378  ASAP> scans.get_fit(4) # Print fits for row 4
    15081379\end{verbatim}
    15091380
     
    15281399
    15291400\begin{verbatim}
    1530   ASAP>scans.rotate_xyphase(10.5)            # Degrees
     1401  ASAP> scans.rotate_xyphase(10.5)            # Degrees
    15311402\end{verbatim}
    15321403
     
    15411412
    15421413\begin{verbatim}
    1543   ASAP>scans.rotate_linpolphase(-45) # Degrees; correct for receiver mounting
     1414  ASAP> scans.rotate_linpolphase(-45) # Degrees; correct for receiver mounting
    15441415\end{verbatim}
    15451416
     
    15501421
    15511422\begin{verbatim}
    1552   ASAP>scans.invert_phase()
     1423  ASAP> scans.invert_phase()
    15531424\end{verbatim}
    15541425
    15551426Depending on how the correlator is configured, ``BA'' may be
    1556 correlated instead of ``AB''. Use \cmd{swap\_linears} to correct for
     1427correlated insead of ``AB''. Use \cmd{swap\_linears} to correct for
    15571428this problem:
    15581429
    15591430\begin{verbatim}
    1560   ASAP>scans.swap_linears()
     1431  ASAP> scans.swap_linears()
    15611432\end{verbatim}
    15621433
     
    15681439
    15691440\begin{verbatim}
    1570   ASAP>stokescans = linearscans.convert_pol("stokes")
     1441  ASAP> stokescans = linearscans.convert_pol("stokes")
    15711442\end{verbatim}
    15721443
     
    15871458
    15881459\begin{verbatim}
    1589   ASAP>selection = selector()
    1590 
    1591   ASAP>selection.set_polarisations(``I Q U V'')
     1460  ASAP> selection = selector()
     1461
     1462  ASAP> selection.set_polarisations(``I Q U V'')
    15921463  ASAP  plotter.set_selection(selection);              # Select I, Q, U \& V
    15931464
    1594   ASAP>selection.set_polarisations(``I Q'')
     1465  ASAP> selection.set_polarisations(``I Q'')
    15951466  ASAP  plotter.set_selection(selection);              # Select just I \& Q
    15961467
    1597   ASAP>selection.set_polarisations(``RR LL'')
     1468  ASAP> selection.set_polarisations(``RR LL'')
    15981469  ASAP  plotter.set_selection(selection);              # Select just RR \& LL
    15991470
    1600   ASAP>selection.set_polarisations(``XX YY'')
     1471  ASAP> selection.set_polarisations(``XX YY'')
    16011472  ASAP  plotter.set_selection(selection);              # Select linears
    16021473
    1603   ASAP>selection.set_polarisations(``I Plinear'')
     1474  ASAP> selection.set_polarisations(``I Plinear'')
    16041475  ASAP  plotter.set_selection(selection);              # Fractional linear
    16051476
    1606   ASAP>selection.set_polarisations(``Pangle'')
     1477  ASAP> selection.set_polarisations(``Pangle'')
    16071478  ASAP  plotter.set_selection(selection);              # Position angle
    16081479
     
    16121483describe in section~\ref{sec:selection}.
    16131484
     1485\subsection{Saving}
     1486
     1487\index{Polarisation!saving}When saving data using the \cmd{save}
     1488function, the \cmd{stokes} argument can be used to save the data as
     1489Stoke values when saving in FITS format.
     1490
     1491Example:
     1492
     1493\begin{verbatim}
     1494  ASAP> scans.save('myscan.sdfits', 'SDFITS', stokes=True)
     1495\end{verbatim}
     1496
    16141497\section{Specialised Processing}
    16151498
     
    16181501MX mode is a specific observing approach with a multibeam where a
    16191502single source is observed cycling through each beam. The scans when
    1620 the beam is off source is used as a reference for the on-source
     1503the beam is off source is used as a reference for the onsource
    16211504scan. The function \cmd{mx\_quotient} is used to make a quotient
    16221505spectrum from an MX cycle. This works averaging the ``off-source''
     
    16261509single scan (it the scan numbers are re-labelled to be the same). Note
    16271510that the current version of \cmd{mx\_quotient} only handles a single
    1628 MX cycle, i.e. if each beam has observed the source multiple times you
     1511MX cycle, ie if each beam has observed the source multiple times you
    16291512will need to use the selector object multiple times to select a single
    16301513MX cycle, run \cmd{mx\_quotient} for each cycle then merge the
     
    16341517
    16351518\begin{verbatim}
    1636   ASAP>scans = scantable('mydata.rpf')
    1637   ASAP>q = scans.mx_quotient()
    1638   ASAP>plotter.plot(q)
     1519  ASAP> scans = scantable('mydata.rpf')
     1520  ASAP> q = scans.mx_quotient()
     1521  ASAP> plotter.plot(q)
    16391522\end{verbatim}
    16401523
     
    16441527
    16451528\begin{verbatim}
    1646   ASAP>av = q.average_beam()
     1529  ASAP> av = q.average_beam()
    16471530\end{verbatim}
    16481531
     
    16501533
    16511534{\em FILL ME IN}
    1652 
    1653 \subsection{Disk Based Processing}
    1654 \index{Scantable!disk based}
    1655 
    1656 Normally scantables exist entirely in memory during an ASAP
    1657 session. This has the advantage of speed, but causes limits on the
    1658 size of the dataset which can be loaded. ASAP can use ``disk based''
    1659 scan tables which cache the bulk of the scantable on disk and require
    1660 significantly less memory usage.
    1661 
    1662 To use disk based tables you either need to change the default in your
    1663 \cmd{.asaprc} file, e.g.
    1664 \begin{verbatim}
    1665    scantable.storage          : disk
    1666 \end{verbatim}
    1667 
    1668 or use set the ``\cmd{rc}'' value while running asap to change this
    1669 on-the-fly. E.g.
    1670 \begin{verbatim}
    1671   ASAP>rc('scantable',storage='disk')
    1672   ASAP>data = scantable('data.rpf')     # Loaded using disk based table
    1673   ASAP>rc('scantable',storage='memory') # Memory tables will be used now
    1674 \end{verbatim}
    1675 
    1676 Changing the ``\cmd{rc}'' value affects the next time the
    1677 \cmd{scantable} constructor is called.
    1678 
    1679 {\bf NOTE: } Currently a bug in ipython means temporary files are not
    1680 cleaned up properly when you exit ASAP. If you use disk based scan
    1681 tables your directory will be left with 'tabXXXXX\_X' directories. These can
    1682 be safely removed if ASAP is not running.
    16831535
    16841536\section{Scantable Mathematics}
     
    16921544{\em Currently mathematics between two scantables is not available }
    16931545
    1694 %  ASAP>sum = scan1+scan2
    1695 \begin{verbatim}
    1696   ASAP>scan2 = scan1+2.0
    1697   ASAP>scan *= 1.05
     1546%  ASAP> sum = scan1+scan2
     1547\begin{verbatim}
     1548  ASAP> scan2 = scan1+2.0
     1549  ASAP> scan *= 1.05
    16981550\end{verbatim}
    16991551
    17001552\section{Scripting}
    17011553
    1702 \index{Scripting}Because ASAP is based on python, it easy for the user
     1554\index{Scripting}Because asap is based on python, it easy for the user
    17031555write their own scripts and functions to process data. This is highly
    17041556recommended as most processing of user data could then be done in a
    17051557couple of steps using a few simple user defined functions. A Python
    1706 primer is beyond the scope of this userguide. See the ASAP home pages
     1558primer is beyond the scope of this userguide. See the asap home pages
    17071559for a scripting tutorial or the main python website for comprehensive
    17081560documentation.
     
    17101562\hspace{1cm} http://www.atnf.csiro.au/computing/software/asap/tutorials
    17111563
    1712 \hspace{1cm} http://svn.atnf.csiro.au/trac/asap/wiki
    1713 
    17141564\hspace{1cm} http://www.python.org/doc/Introduction.html
    17151565
    17161566\subsection{Running scripts}
    17171567
    1718 The ASAP global function \cmd{execfile} reads the named text file and
     1568The asap global function \cmd{execfile} reads the named text file and
    17191569executes the contained python code. This file can either contain
    17201570function definitions which will be used in subsequent processing or
    17211571just a set of commands to process a specific dataset.
    17221572
    1723 As an alternative to run scripts without entering ASAP, create a script which
    1724 starts with.
    1725 
    1726 \begin{verbatim}
    1727 from asap import *
    1728 
    1729 <your code>
    1730 \end{verbatim}
    1731 
    1732 And run it with \cmd{python scriptname}.
    1733 
    17341573\subsection{asapuserfuncs.py}
    17351574
    17361575The file $\sim$/.asap/asapuserfuncs.py is automatically read in when
    1737 ASAP is started. The user can use this to define a set of user
    1738 functions which are automatically available each time ASAP is
     1576asap is started. The user can use this to define a set of user
     1577functions which are automatically available each time asap is
    17391578used. The \cmd{execfile} function can be called from within this file.
    17401579
     
    17421581
    17431582In the following section a few examples of end-to-end processing of
    1744 some data in ASAP are given.
     1583some data in asap are given.
    17451584
    17461585\subsection{Mopra}
     
    17481587
    17491588The following example is of some dual polarisation, position switched
    1750 data from Mopra. The source has been observed multiple times split
    1751 into a number of separate RPFITS files. To make the processing easier,
    1752 the first step is to \cmd{cat} the separate RPFITS files together and
    1753 load as a whole (future versions of ASAP will make this unnecessary).
     1589data from Mopra. The source has been observed mulitple times split
     1590into a number of seperate rpfits files. To make the processing easier,
     1591the first step is to \cmd{cat} the seeprate rpfits files together and
     1592load as a whole (future versions of asap will make this unnecessary).
    17541593
    17551594
     
    18111650
    18121651\index{Parkes}\index{Polarisation}The following example is processing
    1813 of some Parkes polarimetric observations of OH masers at
     1652of some Parkes polarmetric observations of OH masers at
    181416531.6~GHz. Because digital filters where used in the backend, the
    18151654baselines are stable enough not to require a quotient spectra. The
    181616554~MHz bandwidth is wide enough to observe both the 1665 and 1667~MHz
    18171656OH maser transitions. Each source was observed once for about 10
    1818 minutes. Tsys information was not written to the RPFITS file (a
     1657minutes. Tsys information was not written to the rpfits file (a
    18191658nominal 25K values was used), so the amplitudes need to be adjusted
    18201659based on a separate log file. A simple user function is used to
     
    18421681\end{verbatim}
    18431682
    1844 The typical ASAP session would be
     1683The typical asap session would be
    18451684
    18461685\begin{verbatim}
     
    19271766limitations. The data is position switched, observing first an
    19281767reference to the west, then the source twice and finally reference to
    1929 the east. Important to note, that \cmd{auto\_quotient} should be executed
    1930 using the \cmd{mode} `time'.
     1768the east.
    19311769
    19321770\begin{verbatim}
     
    19371775
    19381776# Make the quotient spectra
    1939 q = d.auto_quotient(mode='time')
     1777q = d.auto_quotient()
    19401778print q
    19411779
     
    19881826\index{Functions!summary}%
    19891827\begin{verbatim}
    1990    [The scan container]
     1828
     1829    [The scan container]
    19911830        scantable           - a container for integrations/scans
    19921831                              (can open asap/rpfits/sdfits and ms files)
     
    20141853            get_abcissa     - get the abcissa values and name for a given
    20151854                              row (time)
    2016             get_column_names - get the names of the columns in the scantable
    2017                                for use with selector.set_query
    20181855            set_freqframe   - set the frame info for the Spectral Axis
    20191856                              (e.g. 'LSRK')
     
    20301867            set_restfreqs   - set a list of rest frequencies
    20311868            flag            - flag selected channels in the data
     1869            lag_flag        - flag specified frequency in the data
    20321870            save            - save the scantable to disk as either 'ASAP',
    20331871                              'SDFITS' or 'ASCII'
     
    20721910     [Selection]
    20731911         selector              - a selection object to set a subset of a scantable
    2074            set_cycles         - set (a list of) cycles by index
     1912            set_scans          - set (a list of) scans by index
     1913            set_cycles         - set (a list of) cycles by index
    20751914            set_beams          - set (a list of) beamss by index
    20761915            set_ifs            - set (a list of) ifs by index
     
    20791918            set_names          - set a selection by name (wildcards allowed)
    20801919            set_tsys           - set a selection by tsys thresholds
    2081             set_query          - set a selection by SQL-like query, e.g. BEAMNO==1
    20821920            reset              - unset all selections
    20831921            +                  - merge to selections
     
    21501988            arrow           - draw arrow annotations either in data or relative
    21511989                              coordinates
    2152             axhline,axvline - draw horizontal/vertical lines
    2153             axhspan,axvspan - draw horizontal/vertical regions
    2154 
    2155         xyplotter           - matplotlib/pylab plotting functions
    2156 
    2157     [Reading files]
    2158         reader              - access rpfits/sdfits files
     1990            set_abcissa     - specify a user label for the abcissa
     1991            set_ordinate    - specify a user label for the ordinate
     1992            set_layout      - specify the multi-panel layout (rows,cols)
     1993            set_colors      - specify a set of colours to use
     1994            set_linestyles  - specify a set of linestyles to use if only
     1995                              using one color
     1996            set_font        - set general font properties, e.g. 'family'
     1997            set_histogram   - plot in historam style
     1998            set_mask        - set a plotting mask for a specific polarization
     1999            text            - draw text annotations either in data or relative
     2000                              coordinates
    21592001            arrow           - draw arrow annotations either in data or relative
    21602002                              coordinates
     
    22182060histogram rather than lines.}
    22192061
     2062{\em MALTE TO FIX}
     2063
    22202064\asaprc{plotter.colours}{}{Set default colours for plotting}
    22212065
     
    22252069
    22262070% scantable
    2227 \asaprc{scantable.save}{{\bf ASAP} SDFITS ASCII MS2}{Default output
     2071\asaprc{scantable.save}{{\bf ASAP} SDFITS FITS ASCII MS2}{Default output
    22282072format when saving}
    22292073
     
    22432087\subsection{Installation}
    22442088
    2245 \index{Installation}
    2246 
    2247 Please refer to the asap wiki for instructions on downloading and/or
    2248 building asap from source.
    2249 
    2250 \hspace{1cm}\cmd{http://www.atnf.csiro.au/computing/software/asap/}
     2089\index{Installation}ASAP depends on a number of third-party libraries which you must
     2090have installed before attempting to build ASAP. These are:
     2091
     2092\begin{itemize}
     2093\item AIPS++
     2094\item Boost
     2095\item Matplotlib
     2096\item python/ipython
     2097\end{itemize}
     2098
     2099Debian Linux is currently supported and we intend also
     2100to support other popular Linux flavours, Solaris and Mac.
     2101
     2102Of the dependencies, AIPS++ is the most complex to install.
    22512103
    22522104\printindex
Note: See TracChangeset for help on using the changeset viewer.