Changeset 538


Ignore:
Timestamp:
03/08/05 11:51:55 (19 years ago)
Author:
phi196
Message:

Updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/cookbook.tex

    r537 r538  
    11%% TODO
    2 %% Help doco
    3 %% .asaprc
    42%% Intro
    5 %% Plotter options - pol etc
    63%% Fit saving
    74
     
    5451\end{verbatim}
    5552
    56 This starts the asap. To quit, you need to type  \verb+^+-d (control-d).
     53This starts the asap. To quit, you need to type \verb+^+-d (control-d).
    5754
    5855\section{Interface}
     
    9996some way or change global properties of the object. In this document
    10097member functions will be referred to simply as functions. From the
    101 command line, the user can excute these functions using the syntax:
     98command line, the user can execute these functions using the syntax:
    10299\begin{verbatim}
    103100  ASAP> out = object.function(arguments)
     
    105102
    106103Where \cmd{out} is the name of the returned variable (could be a new
    107 scantable object, or a vector of data, or a status retrn),  \cmd{object} is the
     104scantable object, or a vector of data, or a status return),  \cmd{object} is the
    108105object variable name (set by the user), \cmd{function} is the name of
    109106the member function and \cmd{arguments} is a list of arguments to the
     
    123120
    124121Some functions do not make sense to be implemented as member
    125 functions, typically fuctions which operate on more than one scantable
     122functions, typically functions which operate on more than one scantable
    126123(e.g. time averaging of many scans). These functions will always be
    127 refered to as global functions.
    128 
    129 \subsection{Interactive enviroment}
     124referred to as global functions.
     125
     126\subsection{Interactive environment}
    130127
    131128ipython has a number of useful interactive features and a few things to be aware
     
    136133Tab completion is enabled for all function names. If you type the
    137134first few letters of a function name, then type <TAB> the function
    138 name will be auto completed if it is un-ambigious, or a list of
     135name will be auto completed if it is un-ambiguous, or a list of
    139136possibilities will be given. Auto-completion works for the user
    140137object names as well as function names. It does not work for filenames,
     
    169166\subsection{Help}
    170167
    171 Help me...
     168ASAP has built in help for all functions. To get a list of functions type:
     169
     170\begin{verbatim}
     171  ASAP> commands
     172\end{verbatim}
     173
     174To get help on specific functions, the built in help needs to be given
     175the object and function name. E.g.
     176
     177\begin{verbatim}
     178  ASAP> help scantable.get_scan
     179  ASAP> help scantable.stats
     180  ASAP> help plotter.plot
     181  ASAP> help fitter.plot
     182
     183  ASAP> scans = scantable('mydata.asap')
     184  ASAP> help scans.get_scan # Same as above
     185
     186  ASAP> help average_time # Global functions just need their name
     187
     188\end{verbatim}
     189
     190Note that if you just type \cmd{help} the internal ipython help is
     191invoked, which is probably {\em not} what you want. Type \verb+^+-d
     192(control-d) to escape from this.
    172193
    173194\subsection{.asaprc}
    174195
     196ASAP use a \cmd{.asaprc} file to control the users preferences of
     197default values for various functions arguments. This includes the
     198defaults for aguments such as \cmd{insitu}, scantable \cmd{freqframe}
     199and the plotters \cmd{set\_mode} values. The help on individual
     200functons says which agruments can be set default values from the
     201\cmd{.asaprc} file. To get a sample contents for the \cmd{.asaprc}
     202file use then command \cmd{list\_rcparameters}.
     203
     204Common values include:
     205\begin{verbatim}
     206  # apply operations on the input scantable or return new one
     207  insitu                     : False
     208
     209  # default ouput format when saving scantable
     210  scantable.save             : 'ASAP'
     211
     212
     213  # default frequency frame to set when function
     214  # scantable.set_freqframe is called
     215  scantable.freqframe        : 'LSRK'
     216
     217  # auto averaging on read
     218  scantable.autoaverage      : True
     219\end{verbatim}
    175220
    176221\section{Scantables}
     
    213258
    214259Two important columns are those that describe the frequency setup.  We mention
    215 them explicitly here because you need to be able to undertand the presentation
     260them explicitly here because you need to be able to understand the presentation
    216261of the frequency information and possibly how to manipulate it.
    217262
     
    276321\end{verbatim}
    277322
    278 
    279 
    280323\subsection{State}
    281 
    282324
    283325Each scantable contains "state"; these are properties  applying to all
     
    285327
    286328Examples are the selection of beam, IF and polarisation,  spectral unit
    287 (e.g. $km/s$) frequency reference frame (e.g. BARY) and velocity doppler
     329(e.g. $km/s$) frequency reference frame (e.g. BARY) and velocity Doppler
    288330type (e.g. RADIO).
    289 
    290 
    291331
    292332\subsubsection{Units, Doppler and Frequency Reference Frame}
     
    306346can be computed in any of these units), plotting and mask creation.
    307347
    308 The velocity doppler can be changed with the \cmd{set\_doppler}
     348The velocity Doppler can be changed with the \cmd{set\_doppler}
    309349function, and the frequency reference frame can be changed with the
    310350\cmd{set\_freqframe} function.
     
    335375
    336376\begin{verbatim}
    337   ASAP> scans.set_restfreqs(freqs=1.667359e9, source='NGC253', theif=0)   # Selected for specified source/IF
    338   ASAP> scans.set_restfreqs(freqs=1.667359e9)                             # Selected for all sources and IFs
     377  # Select for specified source/IF
     378  ASAP> scans.set_restfreqs(freqs=1.667359e9, source='NGC253', theif=0)   
     379
     380  # Select for all sources and IFs
     381  ASAP> scans.set_restfreqs(freqs=1.667359e9)                             
    339382\end{verbatim}
    340383
     
    348391
    349392\begin{verbatim}
    350   ASAP> scans.set_restfreqs(freqs=1.667359e9, source='NGC253', theif=0)   # Selected for specified source/IF
    351   ASAP> scans.set_restfreqs(freqs=1.667359e9)                             # Selected for all sources and IFs
     393  # Select for specified source/IF
     394  ASAP> scans.set_restfreqs(freqs=1.667359e9, source='NGC253', theif=0)   
     395
     396  # Select for all sources and IFs
     397  ASAP> scans.set_restfreqs(freqs=1.667359e9)                             
    352398\end{verbatim}
    353399
     
    390436Most functions work on all rows of a scan table. Exceptions are the
    391437fitter and plotter. If you wish to only operate on a selected set of
    392 scantable rows, usw the \cmd{get_scan} function to copy the rows into
     438scantable rows, use the \cmd{get\_scan} function to copy the rows into
    393439a new scantable.
    394440
     
    501547
    502548In the following section, a simple data reduction to form a quotient
    503 spectrum of a single source is followed. Variations of this approach
    504 are given later.
     549spectrum of a single source is followed. In the following it has been
     550assume that the \cmd{.asaprc} file has been used to set \cmd{insitu}
     551to a default value or \cmd{True}.
    505552
    506553%\subsection{Editing}
     
    770817  ASAP> ss = scans.get_scan(10) # Get the 11th scan (zero based)
    771818  ASAP> ss = scans.get_scan(range(10)) # Get the first 10 scans
     819  ASAP> ss = scans.get_scan(range(10,20)) # Get the next 10 scans
    772820  ASAP> ss = scans.get_scan([2,4,6,8,10]) # Get a selection of scans
    773821
     
    839887
    840888
    841 
    842889\section{Plotter}
    843890
     
    847894``plotter''. This would normally be used for standard plotting.
    848895
    849 The plotter, optionally, will run in a mulipanel mode and contain
     896The plotter, optionally, will run in a multipanel mode and contain
    850897multiple plots per panel. The user must tell the plotter how they want
    851898the data distributed. This is done using the set\_mode function. The
    852899default can be set in the users {\tt .asaprc} file. The units (and frame
    853 etc) of the abcissa will be whatever has previously been set by
    854 set\_unit, set\_freqframe etc.
     900etc) of the abscissa will be whatever has previously been set by
     901\cmd{set\_unit}, \cmd{set\_freqframe} etc.
    855902
    856903Typical plotter usage would be:
     
    865912scanrow in a separate panel.
    866913
    867 Other possbilities include:
     914Other possibilities include:
    868915
    869916\begin{verbatim}
    870917  # Plot multiple IFs per panel
    871918  ASAP> plotter.set_mode(stacking='i',panelling='t')
    872   more????
     919
     920  # Plot multiple beams per panel
     921  ASAP> plotter.set_mode(stacking='b',panelling='t')
     922
     923  # Plot one IF per panel, time stacked
     924  ASAP> plotter.set_mode('t', 'i')
     925
     926  # Plot each scan in a seperate panel
     927  ASAP> plotter.set_mode('t', 's')
     928
     929\end{verbatim}
     930
     931\subsection{Plot Selection}
     932\label{sec:plotter_cursor}
     933
     934The plotter can plot up to 25 panels and stacked spectra per
     935panel. If you have data larger than this (or for your own sanity) you
     936need to select a subset of this data. This is particularly true for
     937multibeam or multi IF data. The plotter \cmd{set\_cursor} function is
     938used to select a subset of the data. The arguments \cmd{row},
     939\cmd{beam} and \cmd{IF} all accept a vector if indices corresponding
     940to tow, beam or IF selection. Only the selected data will be plotted.
     941So select on polarisation, see section~\ref{sec:polplot}.
     942
     943Examples:
     944
     945\begin{verbatim}
     946  # Select second IF
     947  ASAP> plotter.set_cursor(IF=[1])
     948
     949  # Select first 4 beams
     950  ASAP> plotter.set_cursor(beam=[0,1,2,3])
     951
     952  # Select a few rows
     953  ASAP> plotter.set_cursor(row=[2,4,6,10])
     954
     955  # Multiple selection
     956  ASAP> plotter.set_cursor(IF=[1], beam=[0,2], row=range(10))
    873957\end{verbatim}
    874958
     
    900984
    901985\end{itemize}
     986
     987\subsection{Plot selection}
    902988
    903989\subsection{Other control}
     
    9891075  # Plot the first and third component plus the model sum
    9901076  ASAP> f.plot(components=[-1,0,2])  # -1 means the compoment sum
    991 
    9921077\end{verbatim}
    9931078
     
    9981083cases will be added on an as needed basic.
    9991084
    1000 But how do you actually do it...
     1085Conversions of linears to Stokes or Circular polarisations are done
     1086``on-the-fly''. Leakage cannot be corrected for nor are there routines
     1087able to calibrate position angle offsets.
     1088
     1089\subsection{Simple Calibration}
     1090
     1091{\em Currently the receiver position angle is not stored in the rpfits
     1092file. This serverly hampers correct handling of polarimetry.}
     1093
     1094It is possible that there is a phase offset between polarisation which
     1095will effect the phase of the cross polarisation
     1096correlation. \cmd{rotate\_xyphase} can be used to correct for this
     1097error. The user must know how to determine the size of the phase
     1098offset.
     1099
     1100\begin{verbatim}
     1101  ASAP> scans.rotate_xyphase(10.5)
     1102\end{verbatim}
     1103
     1104Note that if this function is run twice, the sum of the two values is
     1105applied.
     1106
     1107A correction for the receiver paralactic angle may need to be made,
     1108either because of how it is mounted or if paralactifiying had to track
     1109at 90 degrees rather than 0. Use \cmd{rotate\_linpolphase} to correct
     1110the position angle. Running this function twice results in the sum of
     1111the corrections being applied.
     1112
     1113\begin{verbatim}
     1114  ASAP> scans.rotate_linpolphase(-20) # Correct for receiver mounting
     1115
     1116  # Receiver was tracking 90 degrees rather than 0
     1117  ASAP> scans.rotate_linpolphase(90) 
     1118\end{verbatim}
     1119
     1120\subsection{Plotting}
     1121\label{sec:polplot}
     1122
     1123To plot stokes values, the plotter \cmd{set\_cursor} function should
     1124be called first using the \cmd{pol} argument. The values which can be
     1125plotted include a selection of [I,Q,U,V], [I, Plinear, Pangle, V] or
     1126[XX, YY, Real(XY), Imaginary(XY)]. (Plinear and Pangle are the
     1127percentage and position angle of linear polarisation). Conversion to
     1128circular polarisations are currently not available.
     1129
     1130Example:
     1131
     1132\begin{verbatim}
     1133  ASAP> plotter.set_cursor(pol=[``I'',''Q'']
     1134  ASAP> plotter.set_cursor(pol=[``XX'',''YY'']
     1135  ASAP> plotter.set_cursor(pol=[``I'',''Plinear'']
     1136\end{verbatim}
     1137
     1138Row, beam and IF selection are also available in \cmd{set\_cursor} as
     1139describe in section~\ref{sec:plotter_cursor}.
     1140
     1141\subsection{Saving}
     1142
     1143When saving data using the \cmd{save} function, the \cmd{stokes}
     1144argument can be used to save the data as Stoke values when saving in
     1145FITS format.
     1146
     1147Example:
     1148
     1149\begin{verbatim}
     1150  ASAP> scans.save('myscan.sdfits', 'SDFITS', stokes=True)
     1151\end{verbatim}
    10011152
    10021153\section{Function Summary}
     
    11131264                              range(3) = [0,1,2], range(2,5) = [2,3,4]
    11141265        help                - print help for one of the listed functions
    1115         execfile            - execute an asap script, e.g. execfile('myscript')        list_rcparameters   - print out a list of possible values to be
    1116                               put into $HOME/.asaprc
     1266        execfile            - execute an asap script, e.g. execfile('myscript')
     1267        list_rcparameters   - print out a list of possible values to be
     1268                              put into \$HOME/.asaprc
    11171269        mask_and,mask_or,
    11181270        mask_not            - boolean operations on masks created with
     
    11281280            ASAP> help scantable.summary # to get help on the scantable's
    11291281            ASAP> help average_time
    1130 
    1131 
    1132 \end{verbatim}
    1133 
    1134 \section{Scripting}
    1135 
    1136 Malte to add something
     1282\end{verbatim}
     1283
     1284%\section{Scripting}
     1285
     1286%Malte to add something
    11371287
    11381288\section{Appendix}
    11391289
    11401290\subsection{Installation}
    1141 
    11421291
    11431292ASAP depends on a number of third-party libraries which you must
Note: See TracChangeset for help on using the changeset viewer.