- Timestamp:
- 11/24/05 14:57:27 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/cookbook.tex
r548 r738 32 32 %\section{Documentation Standards} 33 33 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 35 35 36 36 \section{Installation and Running} 37 37 38 Currently there are installations running on Linux machines at 38 Currently there are installations running on Linux machines at 39 39 40 40 \begin{itemize} … … 85 85 \end{itemize} 86 86 87 There can be many objects of the same type. Each object is referred to 87 There can be many objects of the same type. Each object is referred to 88 88 by a variable name made by the user. The name of this variable is not 89 89 important and can be set to whatever the user prefers (ie ``s'' and … … 145 145 ASAP> scans.se<TAB> 146 146 scans.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 147 scans.set_doppler scans.set_instrument scans.setbeam 148 scans.set_fluxunit scans.set_restfreqs scans.setif 149 149 ASAP> scans.set_in<TAB> 150 150 ASAP> scans.set_instrument … … 196 196 197 197 \begin{verbatim} 198 ASAP> help average_time 198 ASAP> help average_time 199 199 \end{verbatim} 200 200 … … 203 203 (control-d) to escape from this. 204 204 205 \subsection{ .asaprc}205 \subsection{Customisation - .asaprc} 206 206 207 207 ASAP use an \cmd{.asaprc} file to control the user's preference of … … 218 218 insitu : False 219 219 220 # default ou put format when saving scantable220 # default output format when saving scantable 221 221 scantable.save : 'ASAP' 222 222 … … 266 266 267 267 The data are stored in columns (the length of a column is the number of 268 rows/integrations of course). 268 rows/integrations of course). 269 269 270 270 Two important columns are those that describe the frequency setup. We mention … … 295 295 ['s', 'scans', 'av', 's2', 'ss'] 296 296 297 ASAP> del s2 297 ASAP> del s2 298 298 ASAP> del ss 299 299 \end{verbatim} … … 310 310 311 311 # Equivalent to brief summary function call 312 ASAP> print scan 312 ASAP> print scan 313 313 \end{verbatim} 314 314 315 315 Most 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. 316 it also prints out the FreqIDs and RestFreqIDs to which we alluded above. 317 317 These are the last column of the listing. 318 318 … … 320 320 the FreqIDs and RestFreqIDs that it encountered for each scan. If you'd 321 321 like 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. 322 argument to True and the frequency table will be listed at the end. 323 323 FreqID of 3 say, refers to the fourth row of the frequency table (ASAP 324 324 is 0-relative). The list of rest frequencies, to which the RestFreqIDs … … 337 337 338 338 Each scantable contains "state"; these are properties applying to all 339 of the data in the scantable. 339 of the data in the scantable. 340 340 341 341 Examples are the selection of beam, IF and polarisation, spectral unit … … 347 347 The information describing the frequency setup for each integration 348 348 is stored fundamentally in frequency in the reference frame 349 of observation (E.g. TOPO). 349 of observation (E.g. TOPO). 350 350 351 351 When required, this is converted to the desired reference frame … … 358 358 scantable. All functions will (where relevant) work with the selected 359 359 unit until this changes. This is mainly important for fitting (the fits 360 can be computed in any of these units), plotting and mask creation. 360 can be computed in any of these units), plotting and mask creation. 361 361 362 362 The velocity definition can be changed with the \cmd{set\_doppler} … … 390 390 \begin{verbatim} 391 391 # 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) 393 393 394 394 # Select for all sources and IFs 395 ASAP> scans.set_restfreqs(freqs=1.667359e9) 395 ASAP> scans.set_restfreqs(freqs=1.667359e9) 396 396 \end{verbatim} 397 397 … … 406 406 \begin{verbatim} 407 407 # 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) 409 409 410 410 # Select for all sources and IFs 411 ASAP> scans.set_restfreqs(freqs=1.667359e9) 411 ASAP> scans.set_restfreqs(freqs=1.667359e9) 412 412 \end{verbatim} 413 413 … … 423 423 \end{verbatim} 424 424 425 425 426 426 427 427 \subsection{Data Selection} 428 428 429 429 Data selection is currently fairly limited. This will be improved in 430 the future. 430 the future. 431 431 432 432 … … 482 482 ASAP> scans.set_unit('channels') 483 483 ASAP> msk = scans.create_mask([100,400],[600,800]) 484 484 485 485 # Select velocity range for fitting 486 486 ASAP> scans.set_unit('km/s') … … 495 495 \begin{verbatim} 496 496 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) 498 498 \end{verbatim} 499 499 … … 535 535 will have one row per scan). The recognised input file formats are 536 536 RPFITS, SDFITS (singledish fits), ASAP's scantable format and aips++ 537 MeasurementSet2 format. 537 MeasurementSet2 format. 538 538 539 539 … … 557 557 RPFITS files. To read multiple RPFITS files, the old reader must be 558 558 destroyed before the new file is opened. However, multiple readers can 559 be created and attached to SDFITS files. 559 be created and attached to SDFITS files. 560 560 561 561 … … 564 564 \begin{verbatim} 565 565 ASAP> r = reader('2003-03-16_082048_t0002.rpf') 566 ASAP> r.summary 566 ASAP> r.summary 567 567 ASAP> scan = r.read() 568 568 ASAP> s = r.read(range(100)) # To read in the first 100 integrations … … 580 580 581 581 %How and when? 582 \subsection{Auto quotient} 583 Quotients 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 589 If this is not sufficient the following alternative method can be used. 582 590 583 591 \subsection{Separate reference and source observations} … … 654 662 655 663 To make a baseline fit, you must first create a mask of channels to 656 use in the baseline fit. 664 use in the baseline fit. 657 665 658 666 \begin{verbatim} 659 667 ASAP> msk = scans.create_mask([100,400],[600,900]) 660 ASAP> scans.poly_baseline(msk, 1) 668 ASAP> scans.poly_baseline(msk, 1) 661 669 \end{verbatim} 662 670 … … 671 679 emission and fits a polynomial baseline to that data. The user can use 672 680 masks to fix the range of channels or velocity range for the fit as 673 well as mark the band edge as invalid. 681 well as mark the band edge as invalid. 674 682 675 683 Simple example … … 741 749 742 750 \begin{verbatim} 743 ASAP> scans.scale(1.05, tsys=True) 751 ASAP> scans.scale(1.05, tsys=True) 744 752 \end{verbatim} 745 753 … … 763 771 764 772 As higher frequencies (particularly $>$20~GHz) it is important to make 765 corrections for atmospheric opacity and gain-elevation effects. 773 corrections for atmospheric opacity and gain-elevation effects. 766 774 767 775 Gain-elevation curves for some telescopes and frequencies are known to … … 826 834 reference time then the scantables averaged. The simplest way of 827 835 doing this is to allow ASAP to choose the reference time for the first 828 scantable then using this time for the subsequent scantables. 836 scantable then using this time for the subsequent scantables. 829 837 830 838 \begin{verbatim} … … 905 913 \end{itemize} 906 914 907 The default output format can be set in the users {\tt .asaprc} file. 915 The default output format can be set in the users {\tt .asaprc} file. 908 916 Typical usages are: 909 917 … … 1012 1020 \item[Zoom] (the letter with the magnifying glass) lets you draw a 1013 1021 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. 1015 1023 1016 1024 \item[Save] (floppy disk). Save the plot as a postscript or .png file … … 1040 1048 \end{verbatim} 1041 1049 1042 To save a hardcopy of the current plot, use the save function, e.g. 1050 To save a hardcopy of the current plot, use the save function, e.g. 1043 1051 1044 1052 \begin{verbatim} … … 1091 1099 ASAP> f.set_scan(s,msk) 1092 1100 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. 1094 1102 # Force the centre to be fixed 1095 1103 ASAP> f.set_gauss_parameters(0.4,450,150,0,1,0,component=1) … … 1105 1113 \begin{verbatim} 1106 1114 # Plot the residual 1107 ASAP> f.plot(residual=True) 1115 ASAP> f.plot(residual=True) 1108 1116 1109 1117 # Plot the first 2 componentsa 1110 ASAP> f.plot(components=[0,1]) 1118 ASAP> f.plot(components=[0,1]) 1111 1119 1112 1120 # Plot the first and third component plus the model sum … … 1125 1133 This will be saved to disk with the data, if the ``ASAP'' file format 1126 1134 is selected. Multiple fits to the same data can be stored in the 1127 scantable. 1135 scantable. 1128 1136 1129 1137 The scantable function \cmd{get\_fit} can be used to retrieve the … … 1143 1151 Conversions of linears to Stokes or Circular polarisations are done 1144 1152 ``on-the-fly''. Leakage cannot be corrected for nor are these routines 1145 able to calibrate position angle offsets. 1153 able to calibrate position angle offsets. 1146 1154 1147 1155 \subsection{Simple Calibration} … … 1175 1183 1176 1184 # Receiver was tracking 90 degrees rather than 0 1177 ASAP> scans.rotate_linpolphase(90) 1185 ASAP> scans.rotate_linpolphase(90) 1178 1186 \end{verbatim} 1179 1187 … … 1215 1223 1216 1224 \begin{verbatim} 1225 [The scan container] 1217 1226 scantable - a container for integrations/scans 1218 1227 (can open asap/rpfits/sdfits and ms files) … … 1252 1261 history - print the history of the scantable 1253 1262 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 1255 1264 or a list of scans 1256 1265 average_pol - average the polarisations together. … … 1258 1267 all polarisations will contain the 1259 1268 averaged spectrum. 1269 auto_quotient - return the on/off quotient with 1270 automatic detection of the on/off scans 1260 1271 quotient - return the on/off quotient 1261 1272 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 1263 1274 bin - return a scan with binned channels 1264 1275 resample - return a scan with resampled channels 1265 1276 smooth - return the spectrally smoothed scan 1266 1277 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 1268 1279 gain_el - apply gain-elevation correction 1269 1280 opacity - apply opacity correction … … 1276 1287 [Math] Mainly functions which operate on more than one scantable 1277 1288 1278 average_time - return the (weighted) time average 1289 average_time - return the (weighted) time average 1279 1290 of a list of scans 1280 1291 quotient - return the on/off quotient … … 1314 1325 set_abcissa - specify a user label for the abcissa 1315 1326 set_layout - specify the multi-panel layout (rows,cols) 1316 1327 1317 1328 [Reading files] 1318 1329 reader - access rpfits/sdfits files … … 1330 1341 execfile - execute an asap script, e.g. execfile('myscript') 1331 1342 list_rcparameters - print out a list of possible values to be 1332 put into .asaprc file1343 put into $HOME/.asaprc 1333 1344 mask_and,mask_or, 1334 1345 mask_not - boolean operations on masks created with 1335 1346 scantable.create_mask 1336 1347 1337 1348 Note: 1338 1349 How to use this with help: … … 1340 1351 [xxx] is just a category 1341 1352 Every 'sub-level' in this list should be replaces by a '.' Period when 1342 using help 1353 using help 1343 1354 Example: 1344 1355 ASAP> help scantable # to get info on ths scantable … … 1376 1387 \item Boost 1377 1388 \item Matplotlib 1378 \item ipython/python1389 \item python/ipython 1379 1390 \end{itemize} 1380 1391 … … 1389 1400 1390 1401 \end{document} 1391 1392
Note:
See TracChangeset
for help on using the changeset viewer.