Changeset 738


Ignore:
Timestamp:
11/24/05 14:57:27 (19 years ago)
Author:
mar637
Message:

added auto_quotient. updated commands to reflect version 1.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/cookbook.tex

    r548 r738  
    3232%\section{Documentation Standards}
    3333
    34 %In most of the examples in this document, it has been assumed that the 
     34%In most of the examples in this document, it has been assumed that the
    3535
    3636\section{Installation and Running}
    3737
    38 Currently there are installations running on Linux machines at 
     38Currently there are installations running on Linux machines at
    3939
    4040\begin{itemize}
     
    8585\end{itemize}
    8686
    87 There can be many objects of the same type. Each object is referred to 
     87There can be many objects of the same type. Each object is referred to
    8888by a variable name made by the user. The name of this variable is not
    8989important and can be set to whatever the user prefers (ie ``s'' and
     
    145145  ASAP> scans.se<TAB>
    146146scans.set_cursor      scans.set_freqframe   scans.set_unit        scans.setpol
    147 scans.set_doppler     scans.set_instrument  scans.setbeam         
    148 scans.set_fluxunit    scans.set_restfreqs   scans.setif     
     147scans.set_doppler     scans.set_instrument  scans.setbeam
     148scans.set_fluxunit    scans.set_restfreqs   scans.setif
    149149  ASAP> scans.set_in<TAB>
    150150  ASAP> scans.set_instrument
     
    196196
    197197\begin{verbatim}
    198   ASAP> help average_time 
     198  ASAP> help average_time
    199199\end{verbatim}
    200200
     
    203203(control-d) to escape from this.
    204204
    205 \subsection{.asaprc}
     205\subsection{Customisation - .asaprc}
    206206
    207207ASAP use an \cmd{.asaprc} file to control the user's preference of
     
    218218  insitu                     : False
    219219
    220   # default ouput format when saving scantable
     220  # default output format when saving scantable
    221221  scantable.save             : 'ASAP'
    222222
     
    266266
    267267The data are stored in columns (the length of a column is the number of
    268 rows/integrations of course). 
     268rows/integrations of course).
    269269
    270270Two important columns are those that describe the frequency setup.  We mention
     
    295295  ['s', 'scans', 'av', 's2', 'ss']
    296296
    297   ASAP> del s2   
     297  ASAP> del s2
    298298  ASAP> del ss
    299299\end{verbatim}
     
    310310
    311311  # Equivalent to brief summary function call
    312   ASAP> print scan                     
     312  ASAP> print scan
    313313\end{verbatim}
    314314
    315315Most of what the \cmd{summary} function  prints out is obvious. However,
    316 it also prints out the FreqIDs and RestFreqIDs to which we alluded above. 
     316it also prints out the FreqIDs and RestFreqIDs to which we alluded above.
    317317These are the last column of the listing.
    318318
     
    320320the FreqIDs and RestFreqIDs that it encountered for each scan.  If you'd
    321321like to see what each FreqID actually means, then set the verbose
    322 argument to True and the frequency table will be listed at the end. 
     322argument to True and the frequency table will be listed at the end.
    323323FreqID of 3 say, refers to the fourth row of the frequency table (ASAP
    324324is 0-relative). The list of rest frequencies, to which the RestFreqIDs
     
    337337
    338338Each scantable contains "state"; these are properties  applying to all
    339 of the data in the scantable. 
     339of the data in the scantable.
    340340
    341341Examples are the selection of beam, IF and polarisation,  spectral unit
     
    347347The information describing the frequency setup for each integration
    348348is stored fundamentally in frequency in the reference frame
    349 of observation (E.g. TOPO).   
     349of observation (E.g. TOPO).
    350350
    351351When required, this is converted to the desired reference frame
     
    358358scantable. All functions will (where relevant) work with the selected
    359359unit until this changes. This is mainly important for fitting (the fits
    360 can be computed in any of these units), plotting and mask creation. 
     360can be computed in any of these units), plotting and mask creation.
    361361
    362362The velocity definition can be changed with the \cmd{set\_doppler}
     
    390390\begin{verbatim}
    391391  # Select for specified source/IF
    392   ASAP> scans.set_restfreqs(freqs=1.667359e9, source='NGC253', theif=0)   
     392  ASAP> scans.set_restfreqs(freqs=1.667359e9, source='NGC253', theif=0)
    393393
    394394  # Select for all sources and IFs
    395   ASAP> scans.set_restfreqs(freqs=1.667359e9)                             
     395  ASAP> scans.set_restfreqs(freqs=1.667359e9)
    396396\end{verbatim}
    397397
     
    406406\begin{verbatim}
    407407  # Select for specified source/IF
    408   ASAP> scans.set_restfreqs(freqs=1.667359e9, source='NGC253', theif=0)   
     408  ASAP> scans.set_restfreqs(freqs=1.667359e9, source='NGC253', theif=0)
    409409
    410410  # Select for all sources and IFs
    411   ASAP> scans.set_restfreqs(freqs=1.667359e9)                             
     411  ASAP> scans.set_restfreqs(freqs=1.667359e9)
    412412\end{verbatim}
    413413
     
    423423\end{verbatim}
    424424
    425  
     425
    426426
    427427\subsection{Data Selection}
    428428
    429429Data selection is currently fairly limited. This will be improved in
    430 the future. 
     430the future.
    431431
    432432
     
    482482  ASAP> scans.set_unit('channels')
    483483  ASAP> msk = scans.create_mask([100,400],[600,800])
    484  
     484
    485485  # Select velocity range for fitting
    486486  ASAP> scans.set_unit('km/s')
     
    495495\begin{verbatim}
    496496  ASAP> scans.set_unit('channels')
    497   ASAP> msk = scans.create_mask([0,100],[900-1023], invert=True)   
     497  ASAP> msk = scans.create_mask([0,100],[900-1023], invert=True)
    498498\end{verbatim}
    499499
     
    535535will have one row per scan).  The recognised input file formats are
    536536RPFITS, SDFITS (singledish fits), ASAP's scantable format and aips++
    537 MeasurementSet2 format. 
     537MeasurementSet2 format.
    538538
    539539
     
    557557RPFITS files.  To read multiple RPFITS files, the old reader must be
    558558destroyed before the new file is opened.  However, multiple readers can
    559 be created and attached to SDFITS files. 
     559be created and attached to SDFITS files.
    560560
    561561
     
    564564\begin{verbatim}
    565565  ASAP> r = reader('2003-03-16_082048_t0002.rpf')
    566   ASAP> r.summary 
     566  ASAP> r.summary
    567567  ASAP> scan = r.read()
    568568  ASAP> s = r.read(range(100)) # To read in the first 100 integrations
     
    580580
    581581%How and when?
     582\subsection{Auto quotient}
     583Quotients can becomputed ``automatically''. This requires the data to have matching source/reference pairs or one refrence for multiple sources.
     584
     585\begin{verbatim}
     586  ASAP> q = s.auto_quotient()
     587\end{verbatim}
     588
     589If this is not sufficient the following alternative method can be used.
    582590
    583591\subsection{Separate reference and source observations}
     
    654662
    655663To make a baseline fit, you must first create a mask of channels to
    656 use in the baseline fit. 
     664use in the baseline fit.
    657665
    658666\begin{verbatim}
    659667 ASAP> msk = scans.create_mask([100,400],[600,900])
    660  ASAP> scans.poly_baseline(msk, 1) 
     668 ASAP> scans.poly_baseline(msk, 1)
    661669\end{verbatim}
    662670
     
    671679emission and fits a polynomial baseline to that data. The user can use
    672680masks to fix the range of channels or velocity range for the fit as
    673 well as mark the band edge as invalid. 
     681well as mark the band edge as invalid.
    674682
    675683Simple example
     
    741749
    742750\begin{verbatim}
    743   ASAP> scans.scale(1.05, tsys=True) 
     751  ASAP> scans.scale(1.05, tsys=True)
    744752\end{verbatim}
    745753
     
    763771
    764772As higher frequencies (particularly $>$20~GHz) it is important to make
    765 corrections for atmospheric opacity and gain-elevation effects. 
     773corrections for atmospheric opacity and gain-elevation effects.
    766774
    767775Gain-elevation curves for some telescopes and frequencies are known to
     
    826834reference time then the scantables averaged. The simplest way of
    827835doing this is to allow ASAP to choose the reference time for the first
    828 scantable then using this time for the subsequent scantables. 
     836scantable then using this time for the subsequent scantables.
    829837
    830838\begin{verbatim}
     
    905913\end{itemize}
    906914
    907 The default output format can be set in the users {\tt .asaprc} file. 
     915The default output format can be set in the users {\tt .asaprc} file.
    908916Typical usages are:
    909917
     
    10121020\item[Zoom] (the letter with the magnifying glass) lets you draw a
    10131021       rectangle around a region of interest then zooms in on that
    1014        region. Use the plot history to unzoom again. 
     1022       region. Use the plot history to unzoom again.
    10151023
    10161024\item[Save] (floppy disk). Save the plot as a postscript or .png file
     
    10401048\end{verbatim}
    10411049
    1042 To save a hardcopy of the current plot, use the save function, e.g. 
     1050To save a hardcopy of the current plot, use the save function, e.g.
    10431051
    10441052\begin{verbatim}
     
    10911099  ASAP> f.set_scan(s,msk)
    10921100  ASAP> f.fit() # Fit using auto-estimates
    1093   # Set Peak, centre and fwhm for the second gaussian. 
     1101  # Set Peak, centre and fwhm for the second gaussian.
    10941102  # Force the centre to be fixed
    10951103  ASAP> f.set_gauss_parameters(0.4,450,150,0,1,0,component=1)
     
    11051113\begin{verbatim}
    11061114  # Plot the residual
    1107   ASAP> f.plot(residual=True) 
     1115  ASAP> f.plot(residual=True)
    11081116
    11091117  # Plot the first 2 componentsa
    1110   ASAP> f.plot(components=[0,1]) 
     1118  ASAP> f.plot(components=[0,1])
    11111119
    11121120  # Plot the first and third component plus the model sum
     
    11251133This will be saved to disk with the data, if the ``ASAP'' file format
    11261134is selected. Multiple fits to the same data can be stored in the
    1127 scantable. 
     1135scantable.
    11281136
    11291137The scantable function \cmd{get\_fit} can be used to retrieve the
     
    11431151Conversions of linears to Stokes or Circular polarisations are done
    11441152``on-the-fly''. Leakage cannot be corrected for nor are these routines
    1145 able to calibrate position angle offsets. 
     1153able to calibrate position angle offsets.
    11461154
    11471155\subsection{Simple Calibration}
     
    11751183
    11761184  # Receiver was tracking 90 degrees rather than 0
    1177   ASAP> scans.rotate_linpolphase(90) 
     1185  ASAP> scans.rotate_linpolphase(90)
    11781186\end{verbatim}
    11791187
     
    12151223
    12161224\begin{verbatim}
     1225    [The scan container]
    12171226        scantable           - a container for integrations/scans
    12181227                              (can open asap/rpfits/sdfits and ms files)
     
    12521261            history         - print the history of the scantable
    12531262            get_fit         - get a fit which has been stored witnh the data
    1254             average_time    - return the (weighted) time average of a scan 
     1263            average_time    - return the (weighted) time average of a scan
    12551264                              or a list of scans
    12561265            average_pol     - average the polarisations together.
     
    12581267                              all polarisations will contain the
    12591268                              averaged spectrum.
     1269            auto_quotient   - return the on/off quotient with
     1270                              automatic detection of the on/off scans
    12601271            quotient        - return the on/off quotient
    12611272            scale           - return a scan scaled by a given factor
    1262             add             - return a scan with given value added 
     1273            add             - return a scan with given value added
    12631274            bin             - return a scan with binned channels
    12641275            resample        - return a scan with resampled channels
    12651276            smooth          - return the spectrally smoothed scan
    12661277            poly_baseline   - fit a polynomial baseline to all Beams/IFs/Pols
    1267             auto_poly_baseline - automatically fit a polynomial baseline 
     1278            auto_poly_baseline - automatically fit a polynomial baseline
    12681279            gain_el         - apply gain-elevation correction
    12691280            opacity         - apply opacity correction
     
    12761287     [Math] Mainly functions which operate on more than one scantable
    12771288
    1278             average_time    - return the (weighted) time average 
     1289            average_time    - return the (weighted) time average
    12791290                              of a list of scans
    12801291            quotient        - return the on/off quotient
     
    13141325            set_abcissa     - specify a user label for the abcissa
    13151326            set_layout      - specify the multi-panel layout (rows,cols)
    1316            
     1327
    13171328    [Reading files]
    13181329        reader              - access rpfits/sdfits files
     
    13301341        execfile            - execute an asap script, e.g. execfile('myscript')
    13311342        list_rcparameters   - print out a list of possible values to be
    1332                               put into .asaprc file
     1343                              put into $HOME/.asaprc
    13331344        mask_and,mask_or,
    13341345        mask_not            - boolean operations on masks created with
    13351346                              scantable.create_mask
    1336        
     1347
    13371348    Note:
    13381349        How to use this with help:
     
    13401351        [xxx] is just a category
    13411352        Every 'sub-level' in this list should be replaces by a '.' Period when
    1342         using help 
     1353        using help
    13431354        Example:
    13441355            ASAP> help scantable # to get info on ths scantable
     
    13761387\item Boost
    13771388\item Matplotlib
    1378 \item ipython/python
     1389\item python/ipython
    13791390\end{itemize}
    13801391
     
    13891400
    13901401\end{document}
    1391 
    1392 
Note: See TracChangeset for help on using the changeset viewer.