- Timestamp:
- 09/06/06 16:08:24 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tags/Release2.1.0b/doc/userguide.tex
r1215 r1243 124 124 functions using the syntax: 125 125 \begin{verbatim} 126 ASAP> 126 ASAP>out = object.function(arguments) 127 127 \end{verbatim} 128 128 … … 136 136 137 137 \begin{verbatim} 138 ASAP> 139 ASAP> 140 ASAP> 141 ASAP> 142 ASAP> 143 ASAP> 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) 144 144 \end{verbatim} 145 145 … … 168 168 Example 169 169 \begin{verbatim} 170 ASAP> 171 ASAP> 172 ASAP> 170 ASAP>scans = scantable('MyData.rpf') 171 ASAP>scans.se<TAB> 172 ASAP>scans.set_in<TAB> 173 173 scans.set_cursor scans.set_freqframe scans.set_selection 174 174 scans.set_doppler scans.set_instrument scans.set_unit 175 175 scans.set_fluxunit scans.set_restfreqs 176 176 177 ASAP> 177 ASAP>scans.set_instrument() 178 178 \end{verbatim} 179 179 … … 204 204 205 205 \begin{verbatim} 206 ASAP> 207 ASAP> 208 ASAP> 209 ASAP> 206 ASAP>pwd 207 ASAP>ls 208 ASAP>cd /my/data/directory 209 ASAP>! mozilla& 210 210 \end{verbatim} 211 211 … … 216 216 217 217 \begin{verbatim} 218 ASAP> 218 ASAP>commands() 219 219 \end{verbatim} 220 220 … … 223 223 224 224 \begin{verbatim} 225 ASAP> 226 ASAP> 227 ASAP> 228 ASAP> 229 230 ASAP> 231 ASAP> 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 232 232 \end{verbatim} 233 233 … … 235 235 236 236 \begin{verbatim} 237 ASAP> 237 ASAP>help average_time 238 238 \end{verbatim} 239 239 … … 285 285 normally contain 13 beams, 1 IF and 2 polarisations, Parkes 286 286 methanol-multibeam data would contain 7 beams, 2 IFs and 2 287 polarisations while the Mopra 8-GHz MOP DS filterbank will produce one287 polarisations while the Mopra 8-GHz MOPS filterbank will produce one 288 288 beam, many IFs, and 2-4 polarisations. 289 289 290 290 All of the combinations of Beams/IFs an Polarisations are 291 contained in sep erate rows. These rows are grouped in cycles (same time stamp).291 contained in separate rows. These rows are grouped in cycles (same time stamp). 292 292 293 293 A collection of cycles for one source is termed a scan (and each scan 294 294 has a unique numeric identifier, the SCANNO). A scantable is then a 295 295 collection of one or more scans. If you have scan-averaged your data 296 in time, i.e. you have aver egaed all cycles within a scan, then each296 in time, i.e. you have averaged all cycles within a scan, then each 297 297 scan would hold just one (averaged) integration. 298 298 … … 302 302 changed via the {\tt .asaprc} resource file. 303 303 304 For example a Mopra scan with a 4s inte rgration time, two IFs and304 For example a Mopra scan with a 4s integration time, two IFs and 305 305 dual polarisations has two (2s) cycles. 306 306 \begin{verbatim} … … 345 345 346 346 \begin{verbatim} 347 ASAP> 348 ASAP> 347 ASAP>scans = scantable('MyData.rpf') 348 ASAP>scans.summary() # Brief listing 349 349 350 350 # Equivalent to brief summary function call 351 ASAP> 351 ASAP>print scan 352 352 \end{verbatim} 353 353 … … 356 356 of summary is redirected into your current pager specified by the 357 357 \$PAGER environment variable. If you find the screen is reset to the 358 original state when summary is finished (i ethe output from summary358 original state when summary is finished (i.e. the output from summary 359 359 disappears), you may need to set the \$LESS environment variable to 360 360 include the \cmd{-X} option. … … 403 403 404 404 \begin{verbatim} 405 ASAP> 406 ASAP> 407 ASAP> 408 ASAP> 409 410 ASAP> 411 ASAP> 412 ASAP> 413 414 ASAP> 415 416 ASAP> 417 ASAP> 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 418 419 419 \end{verbatim} … … 455 455 456 456 \begin{verbatim} 457 ASAP> 458 ASAP> 459 ASAP> 460 ASAP> 461 ASAP> 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 462 462 \end{verbatim} 463 463 … … 479 479 \begin{verbatim} 480 480 # Set all IFs 481 ASAP> 481 ASAP>scans.set_restfreqs(freqs=1.667359e9) 482 482 \end{verbatim} 483 483 … … 489 489 \begin{verbatim} 490 490 # Set rest frequency for all IFs 491 ASAP> 491 ASAP>scans.set_restfreqs(freqs=[1.6654018e9,1.667359e9,]) 492 492 493 493 \end{verbatim} … … 501 501 502 502 \begin{verbatim} 503 ASAP> 503 ASAP>scans.set_restfreqs(freqs=['OH1665','OH1667']) 504 504 \end{verbatim} 505 505 } … … 532 532 533 533 # Select channel range for baselining 534 ASAP> 535 ASAP> 534 ASAP>scans.set_unit('channels') 535 ASAP>msk = scans.create_mask([100,400],[600,800]) 536 536 537 537 # Select velocity range for fitting 538 ASAP> 539 ASAP> 538 ASAP>scans.set_unit('km/s') 539 ASAP>msk = scans.create_mask([-30,-10]) 540 540 \end{verbatim} 541 541 … … 546 546 Example : 547 547 \begin{verbatim} 548 ASAP> 549 ASAP> 548 ASAP>scans.set_unit('channels') 549 ASAP>msk = scans.create_mask([0,100],[900-1023], invert=True) 550 550 \end{verbatim} 551 551 … … 556 556 557 557 \begin{verbatim} 558 ASAP> 559 ASAP> 558 ASAP>scans.set_unit('km/s') 559 ASAP>msk = q.create_mask([-30,-10], row=5) 560 560 \end{verbatim} 561 561 … … 566 566 567 567 \begin{verbatim} 568 ASAP> 569 ASAP> 570 ASAP> 571 ASAP> 572 573 ASAP> 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 574 574 \end{verbatim} 575 575 … … 585 585 586 586 \begin{verbatim} 587 ASAP> 587 ASAP>list_scans() 588 588 The user created scantables are: 589 589 ['s', 'scans', 'av', 's2', 'ss'] 590 590 591 ASAP> 592 ASAP> 591 ASAP>del s2 592 ASAP>del ss 593 593 \end{verbatim} 594 594 … … 611 611 612 612 \begin{verbatim} 613 ASAP> 613 ASAP>scan = scantable('2004-11-23_1841-P484.rpf') 614 614 615 615 # Don't scan average the data 616 ASAP> 616 ASAP>scan = scantable('2004-11-23_1841-P484.rpf', average=False) 617 617 \end{verbatim} 618 618 … … 634 634 635 635 \begin{verbatim} 636 ASAP> 637 ASAP> 638 ASAP> 639 ASAP> 636 ASAP>r = reader('2003-03-16_082048_t0002.rpf') 637 ASAP>r.summary() 638 ASAP>scan = r.read() 639 ASAP>del r 640 640 \end{verbatim} 641 641 … … 655 655 656 656 \begin{verbatim} 657 ASAP> 657 ASAP>q = s.auto_quotient() 658 658 \end{verbatim} 659 659 … … 663 663 664 664 \begin{verbatim} 665 ASAP> 665 ASAP>q = s.auto_quotient(preserve=True) 666 666 \end{verbatim} 667 667 … … 678 678 For Mopra and Parkes data: 679 679 \begin{verbatim} 680 ASAP> 681 ASAP> 680 ASAP>r = scans.get_scan('*_R') 681 ASAP>s = scans.get_scan('*_S') 682 682 \end{verbatim} 683 683 684 684 For Tidbinbilla data 685 685 \begin{verbatim} 686 ASAP> 687 ASAP> 686 ASAP>r = scans.get_scan('*_[ew]') 687 ASAP>s = scans.get_scan('*_[^ew]') 688 688 \end{verbatim} 689 689 … … 693 693 694 694 \begin{verbatim} 695 ASAP> 695 ASAP>q = s.quotient(r) 696 696 \end{verbatim} 697 697 … … 708 708 709 709 \begin{verbatim} 710 ASAP> 710 ASAP>av = q.average_time() 711 711 \end{verbatim} 712 712 … … 715 715 716 716 \begin{verbatim} 717 ASAP> 717 ASAP>av = average_time(q1, q2, q3) 718 718 \end{verbatim} 719 719 … … 723 723 724 724 \begin{verbatim} 725 ASAP> 725 ASAP>av = average_time(q, weight='tintsys') 726 726 \end{verbatim} 727 727 … … 730 730 731 731 \begin{verbatim} 732 ASAP> 733 ASAP> 732 ASAP>msk = scans.create_mask([200,400],[600,800]) 733 ASAP>av = average_time(scans, mask=msk, weight='var') 734 734 \end{verbatim} 735 735 736 736 If you have not observed your data with Doppler tracking (or run 737 \cmd{freq\_align} explicit ally) you should align the data in frequency737 \cmd{freq\_align} explicitly) you should align the data in frequency 738 738 before averaging. 739 739 740 740 \begin{verbatim} 741 ASAP> 741 ASAP>av = scans.average_time(align=True) 742 742 \end{verbatim} 743 743 … … 752 752 753 753 \begin{verbatim} 754 ASAP> 755 ASAP> 754 ASAP>msk = scans.create_mask([100,400],[600,900]) 755 ASAP>scans.poly_baseline(msk, order=1) 756 756 \end{verbatim} 757 757 … … 771 771 772 772 \begin{verbatim} 773 ASAP> 773 ASAP>scans.auto_poly_baseline(order=2,threshold=5) 774 774 \end{verbatim} 775 775 … … 786 786 \begin{verbatim} 787 787 # Don't try and fit the edge of the bandpass which is noisier 788 ASAP> 788 ASAP>scans.auto_poly_baseline(edge=(500,450),order=3,threshold=3) 789 789 790 790 # Only fit a given region around the line 791 ASAP> 792 ASAP> 793 ASAP> 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) 794 794 795 795 \end{verbatim} … … 801 801 802 802 \begin{verbatim} 803 ASAP> 803 ASAP>scans.average_pol() 804 804 \end{verbatim} 805 805 … … 823 823 824 824 \begin{verbatim} 825 ASAP> 825 ASAP>scans = scantable('2004-11-23_1841-P484.rpf', unit='Jy') 826 826 # Or in two steps 827 ASAP> 828 ASAP> 827 ASAP>scans = scantable('2004-11-23_1841-P484.rpf') 828 ASAP>scans.set_fluxunit('Jy') 829 829 \end{verbatim} 830 830 … … 840 840 841 841 \begin{verbatim} 842 ASAP> 843 ASAP> 842 ASAP>scans = scantable('2004-11-23_1841-P484.rpf') 843 ASAP>scans.set_feedtype('circular') 844 844 \end{verbatim} 845 845 … … 852 852 853 853 \begin{verbatim} 854 ASAP> 854 ASAP>scans.scale(1.05, tsys=True) 855 855 \end{verbatim} 856 856 … … 866 866 867 867 \begin{verbatim} 868 ASAP> 869 ASAP> 870 ASAP> 871 ASAP> 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 872 872 \end{verbatim} 873 873 … … 884 884 885 885 \begin{verbatim} 886 ASAP> 886 ASAP>scans.recalc_azel() # recalculate az/el based on pointing 887 887 \end{verbatim} 888 888 … … 897 897 898 898 \begin{verbatim} 899 ASAP> 900 ASAP> 899 ASAP>scans.gain_el() # If gain table known 900 ASAP>scans.gain_el(poly=[3.58788e-1,2.87243e-2,-3.219093e-4]) 901 901 \end{verbatim} 902 902 … … 906 906 907 907 \begin{verbatim} 908 ASAP> 908 ASAP>scans.opacity(0.083) 909 909 \end{verbatim} 910 910 … … 916 916 \label{sec:freqalign} 917 917 918 \index{Frequency alignment}\index{Vel icity alignment}When time918 \index{Frequency alignment}\index{Velocity alignment}When time 919 919 averaging a series of scans together, it is possible that the velocity 920 920 scales are not exactly aligned. This may be for many reasons such as … … 927 927 928 928 \begin{verbatim} 929 ASAP> 930 ASAP> 929 ASAP>scans.freq_align() 930 ASAP>av = average_time(scans) 931 931 \end{verbatim} 932 932 … … 940 940 941 941 \begin{verbatim} 942 ASAP> 943 ASAP> 944 ASAP> 945 ASAP> 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) 946 946 \end{verbatim} 947 947 … … 960 960 961 961 \begin{verbatim} 962 ASAP> 963 ASAP> 964 ASAP> 965 ASAP> 966 967 ASAP> 968 ASAP> 969 970 ASAP> 971 ASAP> 972 ASAP> 973 ASAP> 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) 974 974 975 975 \end{verbatim} … … 978 978 979 979 \begin{verbatim} 980 ASAP> 980 ASAP>ss = scans 981 981 \end{verbatim} 982 982 … … 986 986 987 987 \begin{verbatim} 988 ASAP> 988 ASAP>ss = scans.copy() 989 989 \end{verbatim} 990 990 … … 1024 1024 1025 1025 \begin{verbatim} 1026 ASAP> 1027 ASAP> 1028 ASAP> 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 1029 1029 \end{verbatim} 1030 1030 1031 1031 \section{Plotter} 1032 1032 1033 \index{Plotter}Scantable spectra can be plotted at any time. An asapplotter object is 1034 used for plotting, meaning multiple plot windows can be active at the 1035 same time. On start up a default asapplotter object is created called 1036 ``plotter''. This would normally be used for standard plotting. 1037 1038 The plotter, optionally, will run in a multipanel mode and contain 1033 \index{Plotter}Scantable spectra can be plotted at any time. An 1034 asapplotter object is used for plotting, meaning multiple plot windows 1035 can be active at the same time. On start up a default asapplotter 1036 object is created called ``plotter''. This would normally be used for 1037 standard plotting. 1038 1039 The plotter, optionally, will run in a multi-panel mode and contain 1039 1040 multiple plots per panel. The user must tell the plotter how they want 1040 1041 the data distributed. This is done using the set\_mode function. The … … 1046 1047 1047 1048 \begin{verbatim} 1048 ASAP> 1049 ASAP> 1050 ASAP> 1049 ASAP>scans.set_unit('km/s') 1050 ASAP>plotter.set_mode(stacking='p',panelling='t') 1051 ASAP>plotter.plot(scans) 1051 1052 \end{verbatim} 1052 1053 … … 1058 1059 \begin{verbatim} 1059 1060 # Plot multiple IFs per panel 1060 ASAP> 1061 ASAP>plotter.set_mode(stacking='i',panelling='t') 1061 1062 1062 1063 # Plot multiple beams per panel 1063 ASAP> 1064 ASAP>plotter.set_mode(stacking='b',panelling='t') 1064 1065 1065 1066 # Plot one IF per panel, time stacked 1066 ASAP> 1067 ASAP>plotter.set_mode('t', 'i') 1067 1068 1068 1069 # Plot each scan in a seperate panel 1069 ASAP> 1070 ASAP>plotter.set_mode('t', 's') 1070 1071 1071 1072 \end{verbatim} … … 1080 1081 should be used for this purpose. Selection can either be applied to 1081 1082 the scantable or directly to the plotter, the end result is the same. 1082 You don't have to reset the scantable s lection though, if you set1083 You don't have to reset the scantable selection though, if you set 1083 1084 the selection on the plotter. 1084 1085 … … 1086 1087 1087 1088 \begin{verbatim} 1088 ASAP> 1089 ASAP>selection = selector() 1089 1090 # Select second IF 1090 ASAP> 1091 ASAP> 1091 ASAP>selection.set_ifs(1) 1092 ASAP>plotter.set_selection(selection) 1092 1093 1093 1094 # Select first 4 beams 1094 ASAP> 1095 ASAP> 1095 ASAP>selection.set_beams([0,1,2,3]) 1096 ASAP>plotter.set_selection(selection) 1096 1097 1097 1098 # Select a few scans 1098 ASAP> 1099 ASAP> 1099 ASAP>selection.set_scans([2,4,6,10]) 1100 ASAP>plotter.set_selection(selection) 1100 1101 1101 1102 # Multiple selection 1102 ASAP> 1103 ASAP> 1104 ASAP> 1103 ASAP>selection.set_ifs(1) 1104 ASAP>selection.set_scans([2,4,6,10]) 1105 ASAP>plotter.set_selection(selection) 1105 1106 1106 1107 \end{verbatim} … … 1130 1131 region. Use the plot history to unzoom again. 1131 1132 1132 \item[Adjust] (rectangle with 4 arrows) adjust subplot param aters1133 \item[Adjust] (rectangle with 4 arrows) adjust subplot parameters 1133 1134 (space at edge of plots) 1134 1135 … … 1150 1151 1151 1152 \begin{verbatim} 1152 ASAP> 1153 ASAP> 1154 ASAP> 1155 ASAP> 1153 ASAP>scans.set_unit('km/s') 1154 ASAP>plotter.plot(scans) 1155 ASAP>plotter.set_range(-150,-50) 1156 ASAP>plotter.set_range() # To reset 1156 1157 \end{verbatim} 1157 1158 … … 1159 1160 1160 1161 \begin{verbatim} 1161 ASAP> 1162 ASAP>plotter.set_range(-10,30,-1,6.6) 1162 1163 \end{verbatim} 1163 1164 … … 1165 1166 1166 1167 \begin{verbatim} 1167 ASAP> 1168 ASAP> 1168 ASAP>plotter.save('myplot.ps') 1169 ASAP>plotter.save('myplot.png', dpi=80) 1169 1170 \end{verbatim} 1170 1171 … … 1172 1173 1173 1174 The plotter allows the user to change most properties such as text 1174 size and colour. The \cmd{commands} func ation and {\cmd help\1175 size and colour. The \cmd{commands} function and {\cmd help\ 1175 1176 asapplotter} list all the possible commands that can be used with the 1176 1177 plotter. … … 1187 1188 plots. Allowable values are 'line', 'dashed', 'dotted', 'dashdot', 1188 1189 'dashdotdot' and 'dashdashdot. Example: }{ 1189 ASAP> 1190 ASAP> 1190 ASAP>plotter.set\_linestyles('line dash cotted datshot.)\\ 1191 ASAP>plotter.set\_font(size=10)\\ 1191 1192 } 1192 1193 1193 1194 \commanddef{set\_font}{Change the font style and size. Example}{ 1194 ASAP> 1195 ASAP> 1196 ASAP> 1195 ASAP>plotter.set\_font(weight='bold')\\ 1196 ASAP>plotter.set\_font(size=10)\\ 1197 ASAP>plotter.set\_font(style='italic')\\ 1197 1198 } 1198 1199 1199 \commanddef{set\_layout}{Change the multi-panel layout, i enow many1200 \commanddef{set\_layout}{Change the multi-panel layout, i.e. now many 1200 1201 rows and columns}{ 1201 ASAP> 1202 ASAP>plotter.set\_layout(3,2) 1202 1203 } 1203 1204 1204 1205 \commanddef{set\_legend}{Set the position, size and optional value of the legend}{ 1205 ASAP> 1206 ASAP> 1207 ASAP> 1208 ASAP> 1209 ASAP> 1210 ASAP> 1206 ASAP>plotter.set\_legend(fontsize=16)\\ 1207 ASAP>plotter.set\_legend(mode=0) \# ASAP chooses where to put the legend\\ 1208 ASAP>plotter.set\_legend(mode=4) \# Put legend on lower right\\ 1209 ASAP>plotter.set\_legend(mode=-1) \# No legend\\ 1210 ASAP>plotter.set\_legend(mp=['RR','LL']) \# Specify legend labels\\ 1211 ASAP>plotter.set\_legend(mp=[r'\$\^\{12\}CO\$',r'\$\^\{13\}CO\$']) \# Latex labels 1211 1212 } 1212 1213 1213 1214 \commanddef{set\_title}{Set the plot title. If multiple panels are 1214 1215 plotted, multiple titles have to be specified}{ 1215 ASAP> 1216 ASAP> 1216 ASAP>plotter.set\_title(`G323.12$-$1.79`)\\ 1217 ASAP>plotter.set\_title([`SiO`, 'Methanol'], fontsize=18)\\ 1217 1218 } 1218 1219 1219 1220 \subsection{Plotter Annotations} 1220 1221 1221 The plotter allows various anno ntations (lines, arrows, text and1222 The plotter allows various annotations (lines, arrows, text and 1222 1223 ``spans'') to be added to the plot. These annotations are 1223 1224 ``temporary'', when the plotter is next refreshed … … 1225 1226 will be removed. 1226 1227 1227 \bigcommanddef{arrow(x,y,x+dx,y+dy)}{Draw an arrow from a specif ed1228 \bigcommanddef{arrow(x,y,x+dx,y+dy)}{Draw an arrow from a specified 1228 1229 \cmd{(x,y)} position to \cmd{(x+dx, y+dy)}. The values are in world 1229 1230 coordinates. \em {HOW TO SET ARROW HEAD??}}{ 1230 ASAP> 1231 ASAP>plotter.arrow(-40,7,35,0) 1231 1232 } 1232 1233 1233 1234 \bigcommanddef{axhline(y, xmin, xmax)}{Draw a horizontal line at the 1234 specif ed \cmd{y} position (in world coordinates) between xmin and xmax1235 (in relative coordinates, i e0.0 is the left hand edge of the plot1235 specified \cmd{y} position (in world coordinates) between xmin and xmax 1236 (in relative coordinates, i.e. 0.0 is the left hand edge of the plot 1236 1237 while 1.0 is the right side of the plot.}{ 1237 ASAP> 1238 ASAP>plotter.axhline(6.0,0.2,0.8) 1238 1239 } 1239 1240 1240 1241 \bigcommanddef{avhline(x, ymin, ymax)}{Draw a vertical line at the 1241 specif ed \cmd{x} position (in world coordinates) between \cmd{ymin}1242 and \cmd{ymax} (in relative coordinates, i e0.0 is the left hand edge1242 specified \cmd{x} position (in world coordinates) between \cmd{ymin} 1243 and \cmd{ymax} (in relative coordinates, i.e. 0.0 is the left hand edge 1243 1244 of the plot while 1.0 is the right side of the plot).}{ 1244 ASAP> 1245 ASAP>plotter.axvline(-50.0,0.1,1.0) 1245 1246 } 1246 1247 1247 1248 \bigcommanddef{axhspan(ymin, ymax, \\ \hspace*{20mm}xmin, 1248 1249 xmax)}{Overlay a transparent colour rectangle. \cmd{ymin} and 1249 \cmd{ymax} are given in world coord nates while \cmd{xmin} and1250 \cmd{ymax} are given in world coordinates while \cmd{xmin} and 1250 1251 \cmd{xmax} are given in relative coordinates}{ 1251 ASAP> 1252 ASAP>plotter.axhspan(2,4,0.25,0.75) 1252 1253 } 1253 1254 1254 1255 \bigcommanddef{axvspan(xmin, xmax, \\ \hspace*{20mm} ymin, 1255 1256 ymax)}{Overlay a transparent colour rectangle. \cmd{ymin} and 1256 \cmd{ymax} are given in relative coord nates while \cmd{xmin} and1257 \cmd{ymax} are given in relative coordinates while \cmd{xmin} and 1257 1258 \cmd{xmax} are given in world coordinates}{ 1258 ASAP> 1259 ASAP>plotter.axvspan(-50,60,0.2,0.5) 1259 1260 } 1260 1261 … … 1281 1282 Examples: 1282 1283 \begin{verbatim} 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} 1284 ASAP>plotter.axhline(6.0,0.2,0.8, color='red', linewidth=3) 1285 ASAP>plotter.text(-10,7,"CO", fontsize=20) 1286 \end{verbatim} 1287 1288 \section{Line Catalog} 1289 1290 \index{Linecatalog}ASAP can load and manipulate line catlogs to retrieve rest frequencies 1291 for \cmd{set\_restfreqs} and for line identification in the 1292 plotter. No line catalogs are built into ASAP, the user must load a 1293 ASCII based table (which can optionally be saved in an internal 1294 format) either of the users own creation or a standard line catalog 1295 such as the JPL line catalog or Lovas. The ATNF asap ftp area as 1296 copies of the JPL and Lovas catalog in the appropriate format. All 1297 line catalogs are loaded into a ``linecatalog'' object. 1298 1299 \subsection{Loading a Line Catalog} 1300 1301 \index{Linecatalog|loading}The ASCII text line catalog must have at 1302 least 4 columns. The first four columns must contain (in order): 1303 Molecule name, frequency in MHz, frequency error and ``intensity'' 1304 (any units). If the molecule name contains any spaces, they must be 1305 wrapped in quotes \verb+""+. 1306 1307 A sample from the JPL line catalog: 1308 1309 \begin{verbatim} 1310 H2D+ 3955.2551 228.8818 -7.1941 1311 H2D+ 12104.7712 177.1558 -6.0769 1312 H2D+ 45809.2731 118.3223 -3.9494 1313 CH 701.6811 .0441 -7.1641 1314 CH 724.7709 .0456 -7.3912 1315 CH 3263.7940 .1000 -6.3501 1316 CH 3335.4810 .1000 -6.0304 1317 \end{verbatim} 1318 1319 To load a line catalog then save it in the internal format: 1320 1321 \begin{verbatim} 1322 ASAP>jpl = linecatalog('jpl_pruned.txt') 1323 ASAP>jpl.save('jpl.tbl') 1324 \end{verbatim} 1325 1326 Later the saved line catalog can reloaded: 1327 1328 \begin{verbatim} 1329 ASAP>jpl = linecatalog('jpl.tbl') 1330 \end{verbatim} 1331 1332 \subsection{Line selection} 1333 1334 \index{Linecatalog|line selection}The linecatalog has a number of 1335 selection functions to select a range of lines from a larger catalog 1336 (the JPL catalog has $>$180000 lines for 1337 example). \cmd{set\_frequency\_limits} selects on frequency range, 1338 \cmd{set\_strength\_limits} selects on intensity while \cmd{set\_name} 1339 selects on molecule name (wild cards allowed). 1340 1341 \begin{verbatim} 1342 ASAP>jpl = linecatalog('jpl.tbl') 1343 ASAP>jpl.set_frequency_limits(80,115,'GHz') # Lines for 3mm receiver 1344 ASAP>jpl.set_name('*OH') # Select all alcohols 1345 ASAP>jpl.set_name('OH') # Select only OH molecules 1346 ASAP>jpl.summary() 1347 1348 ASAP>jpl.reset() # Selections are accumulative 1349 ASAP>jpl.set_frequency_limits(80,115,'GHz') 1350 ASAP>jpl.set_strength_limits(-2,10) # Select brightest lines 1351 ASAP>jpl.summary() 1352 \end{verbatim} 1353 1354 \subsection{Using Linecatalog} 1355 1356 The line catalogs can be used for line overlays on the plotter or with 1357 \cmd{set\_restfreq}. 1358 1359 \subsubsection{Plotting linecatalog} 1360 1361 \index{Linecatalog|plotting} 1362 1363 The plotter \cmd{plot\_lines} function takes a line catalog as an 1364 argument and overlays the lines on the spectrum. {\em Currently this 1365 only works when plotting in units of frequency (Hz, GHz etc).} If a 1366 large line catalog has been loaded (e.g. JPL) it is highly recommended 1367 that you use the selection functions to narrow down the number of 1368 lines. By default the line catalog overlay is plotted assuming a line 1369 velocity of 0.0. This can be set using the \cmd{doppler} argument (in 1370 km/s). Each time \cmd{plot\_lines} is called the new lines are added 1371 to any existing line catalog annotations. These are all removed after 1372 the next call to \cmd{plotter.plot()}. 1373 1374 \begin{verbatim} 1375 ASAP>jpl = linecatalog('jpl.tbl') 1376 ASAP>jpl.set_frequency_limits(23,24,'GHz') 1377 ASAP>data.set_unit('GHz') # Only works with freq axis currently 1378 ASAP>plotter.plot(data) 1379 ASAP>plotter.plot_lines(jpl) 1380 1381 ASAP>plotter.plot() # Reset plotter 1382 ASAP>plotter.plot_lines(jpl,doppler=-10,location='Top') # On top with -10 km/s velocity 1383 \end{verbatim} 1384 1385 \subsubsection{Setting Rest Frequencies} 1386 1387 \index{Linecatalog|set_restfreq} 1286 1388 1287 1389 \section{Fitting} … … 1296 1398 1297 1399 \begin{verbatim} 1298 ASAP> 1299 ASAP> 1300 ASAP> 1301 ASAP> 1302 ASAP> 1303 ASAP> 1304 ASAP> 1305 ASAP> 1306 ASAP> 1307 ASAP> 1400 ASAP>f = fitter() 1401 ASAP>f.set_function(gauss=2) # Fit two Gaussians 1402 ASAP>f.set_scan(scans) 1403 ASAP>selection = selector() 1404 ASAP>selection.set_polarisations(1) # Fit the second polarisation 1405 ASAP>scans.set_selection(selection) 1406 ASAP>scans.set_unit('km/s') # Make fit in velocity units 1407 ASAP>f.fit(1) # Run the fit on the second row in the table 1408 ASAP>f.plot() # Show fit in a plot window 1409 ASAP>f.get_parameters() # Return the fit paramaters 1308 1410 \end{verbatim} 1309 1411 … … 1316 1418 1317 1419 \begin{verbatim} 1318 ASAP> 1319 ASAP> 1320 ASAP> 1321 ASAP> 1322 ASAP> 1323 ASAP> 1324 ASAP> 1325 ASAP> 1326 ASAP> 1420 ASAP>f = fitter() 1421 ASAP>f.set_function(gauss=2) 1422 ASAP>scans.set_unit('km/s') # Set the mask in channel units 1423 ASAP>msk = s.create_mask([1800,2200]) 1424 ASAP>scans.set_unit('km/s') # Make fit in velocity units 1425 ASAP>f.set_scan(s,msk) 1426 ASAP>f.fit() 1427 ASAP>f.plot() 1428 ASAP>f.get_parameters() 1327 1429 \end{verbatim} 1328 1430 … … 1331 1433 1332 1434 \begin{verbatim} 1333 ASAP> 1334 ASAP> 1335 ASAP> 1336 ASAP> 1435 ASAP>f = fitter() 1436 ASAP>f.set_function(gauss=2) 1437 ASAP>f.set_scan(s,msk) 1438 ASAP>f.fit() # Fit using auto-estimates 1337 1439 # Set Peak, centre and fwhm for the second gaussian. 1338 1440 # Force the centre to be fixed 1339 ASAP> 1340 ASAP> 1441 ASAP>f.set_gauss_parameters(0.4,450,150,0,1,0,component=1) 1442 ASAP>f.fit() # Re-run the fit 1341 1443 \end{verbatim} 1342 1444 … … 1349 1451 \begin{verbatim} 1350 1452 # Plot the residual 1351 ASAP> 1453 ASAP>f.plot(residual=True) 1352 1454 1353 1455 # Plot the first 2 componentsa 1354 ASAP> 1456 ASAP>f.plot(components=[0,1]) 1355 1457 1356 1458 # Plot the first and third component plus the model sum 1357 ASAP> 1459 ASAP>f.plot(components=[-1,0,2]) # -1 means the compoment sum 1358 1460 \end{verbatim} 1359 1461 … … 1364 1466 1365 1467 \begin{verbatim} 1366 ASAP> f.storefit()1468 ASAP>f.store_fit() 1367 1469 \end{verbatim} 1368 1470 … … 1376 1478 1377 1479 \begin{verbatim} 1378 ASAP> scans.get_fit(4) # Print fits for row 4 1480 ASAP>scans.get_fit(4) # Print fits for row 4 1481 \end{verbatim} 1482 1483 A fit can also be exported to an ASCII file using the \cmd{store\_fit} 1484 function. Simply give the name of the output file requires as an 1485 argument. 1486 1487 \begin{verbatim} 1488 ASAP>f.store_fit('myfit.txt') 1379 1489 \end{verbatim} 1380 1490 … … 1399 1509 1400 1510 \begin{verbatim} 1401 ASAP> 1511 ASAP>scans.rotate_xyphase(10.5) # Degrees 1402 1512 \end{verbatim} 1403 1513 … … 1412 1522 1413 1523 \begin{verbatim} 1414 ASAP> 1524 ASAP>scans.rotate_linpolphase(-45) # Degrees; correct for receiver mounting 1415 1525 \end{verbatim} 1416 1526 … … 1421 1531 1422 1532 \begin{verbatim} 1423 ASAP> 1533 ASAP>scans.invert_phase() 1424 1534 \end{verbatim} 1425 1535 1426 1536 Depending on how the correlator is configured, ``BA'' may be 1427 correlated ins ead of ``AB''. Use \cmd{swap\_linears} to correct for1537 correlated instead of ``AB''. Use \cmd{swap\_linears} to correct for 1428 1538 this problem: 1429 1539 1430 1540 \begin{verbatim} 1431 ASAP> 1541 ASAP>scans.swap_linears() 1432 1542 \end{verbatim} 1433 1543 … … 1439 1549 1440 1550 \begin{verbatim} 1441 ASAP> 1551 ASAP>stokescans = linearscans.convert_pol("stokes") 1442 1552 \end{verbatim} 1443 1553 … … 1458 1568 1459 1569 \begin{verbatim} 1460 ASAP> 1461 1462 ASAP> 1570 ASAP>selection = selector() 1571 1572 ASAP>selection.set_polarisations(``I Q U V'') 1463 1573 ASAP plotter.set_selection(selection); # Select I, Q, U \& V 1464 1574 1465 ASAP> 1575 ASAP>selection.set_polarisations(``I Q'') 1466 1576 ASAP plotter.set_selection(selection); # Select just I \& Q 1467 1577 1468 ASAP> 1578 ASAP>selection.set_polarisations(``RR LL'') 1469 1579 ASAP plotter.set_selection(selection); # Select just RR \& LL 1470 1580 1471 ASAP> 1581 ASAP>selection.set_polarisations(``XX YY'') 1472 1582 ASAP plotter.set_selection(selection); # Select linears 1473 1583 1474 ASAP> 1584 ASAP>selection.set_polarisations(``I Plinear'') 1475 1585 ASAP plotter.set_selection(selection); # Fractional linear 1476 1586 1477 ASAP> 1587 ASAP>selection.set_polarisations(``Pangle'') 1478 1588 ASAP plotter.set_selection(selection); # Position angle 1479 1589 … … 1492 1602 1493 1603 \begin{verbatim} 1494 ASAP> 1604 ASAP>scans.save('myscan.sdfits', 'SDFITS', stokes=True) 1495 1605 \end{verbatim} 1496 1606 … … 1501 1611 MX mode is a specific observing approach with a multibeam where a 1502 1612 single source is observed cycling through each beam. The scans when 1503 the beam is off source is used as a reference for the on source1613 the beam is off source is used as a reference for the on-source 1504 1614 scan. The function \cmd{mx\_quotient} is used to make a quotient 1505 1615 spectrum from an MX cycle. This works averaging the ``off-source'' … … 1509 1619 single scan (it the scan numbers are re-labelled to be the same). Note 1510 1620 that the current version of \cmd{mx\_quotient} only handles a single 1511 MX cycle, i eif each beam has observed the source multiple times you1621 MX cycle, i.e. if each beam has observed the source multiple times you 1512 1622 will need to use the selector object multiple times to select a single 1513 1623 MX cycle, run \cmd{mx\_quotient} for each cycle then merge the … … 1517 1627 1518 1628 \begin{verbatim} 1519 ASAP> 1520 ASAP> 1521 ASAP> 1629 ASAP>scans = scantable('mydata.rpf') 1630 ASAP>q = scans.mx_quotient() 1631 ASAP>plotter.plot(q) 1522 1632 \end{verbatim} 1523 1633 … … 1527 1637 1528 1638 \begin{verbatim} 1529 ASAP> 1639 ASAP>av = q.average_beam() 1530 1640 \end{verbatim} 1531 1641 … … 1533 1643 1534 1644 {\em FILL ME IN} 1645 1646 \subsection{Disk Based Processing} 1647 \index{Scantable|disk based} 1648 1649 Normally scantables exisit entirely in memory during an ASAP 1650 session. This has the adtantage of speed, but causes limits on the 1651 size of the dataset which can be loaded. ASAP can use ``disk based'' 1652 scan tables which 1653 1654 {\bf NOTE: } Currently a bug in ipython means temporary files are not 1655 cleaned up properly when you exit ASAP. If you use disk based scan 1656 tables your directory will be left with 'tmp*' directories. These can 1657 be safely removed if ASAP is not running. 1535 1658 1536 1659 \section{Scantable Mathematics} … … 1544 1667 {\em Currently mathematics between two scantables is not available } 1545 1668 1546 % ASAP> 1547 \begin{verbatim} 1548 ASAP> 1549 ASAP> 1669 % ASAP>sum = scan1+scan2 1670 \begin{verbatim} 1671 ASAP>scan2 = scan1+2.0 1672 ASAP>scan *= 1.05 1550 1673 \end{verbatim} 1551 1674 1552 1675 \section{Scripting} 1553 1676 1554 \index{Scripting}Because asapis based on python, it easy for the user1677 \index{Scripting}Because ASAP is based on python, it easy for the user 1555 1678 write their own scripts and functions to process data. This is highly 1556 1679 recommended as most processing of user data could then be done in a 1557 1680 couple of steps using a few simple user defined functions. A Python 1558 primer is beyond the scope of this userguide. See the asaphome pages1681 primer is beyond the scope of this userguide. See the ASAP home pages 1559 1682 for a scripting tutorial or the main python website for comprehensive 1560 1683 documentation. … … 1566 1689 \subsection{Running scripts} 1567 1690 1568 The asapglobal function \cmd{execfile} reads the named text file and1691 The ASAP global function \cmd{execfile} reads the named text file and 1569 1692 executes the contained python code. This file can either contain 1570 1693 function definitions which will be used in subsequent processing or … … 1574 1697 1575 1698 The file $\sim$/.asap/asapuserfuncs.py is automatically read in when 1576 asapis started. The user can use this to define a set of user1577 functions which are automatically available each time asapis1699 ASAP is started. The user can use this to define a set of user 1700 functions which are automatically available each time ASAP is 1578 1701 used. The \cmd{execfile} function can be called from within this file. 1579 1702 … … 1581 1704 1582 1705 In the following section a few examples of end-to-end processing of 1583 some data in asapare given.1706 some data in ASAP are given. 1584 1707 1585 1708 \subsection{Mopra} … … 1587 1710 1588 1711 The following example is of some dual polarisation, position switched 1589 data from Mopra. The source has been observed mul itple times split1590 into a number of sep erate rpfitsfiles. To make the processing easier,1591 the first step is to \cmd{cat} the se eprate rpfitsfiles together and1592 load as a whole (future versions of asapwill make this unnecessary).1712 data from Mopra. The source has been observed multiple times split 1713 into a number of separate RPFITS files. To make the processing easier, 1714 the first step is to \cmd{cat} the separate RPFITS files together and 1715 load as a whole (future versions of ASAP will make this unnecessary). 1593 1716 1594 1717 … … 1655 1778 4~MHz bandwidth is wide enough to observe both the 1665 and 1667~MHz 1656 1779 OH maser transitions. Each source was observed once for about 10 1657 minutes. Tsys information was not written to the rpfitsfile (a1780 minutes. Tsys information was not written to the RPFITS file (a 1658 1781 nominal 25K values was used), so the amplitudes need to be adjusted 1659 1782 based on a separate log file. A simple user function is used to … … 1681 1804 \end{verbatim} 1682 1805 1683 The typical asapsession would be1806 The typical ASAP session would be 1684 1807 1685 1808 \begin{verbatim}
Note:
See TracChangeset
for help on using the changeset viewer.