Changeset 1259
- Timestamp:
- 09/11/06 15:10:05 (18 years ago)
- Location:
- trunk
- Files:
-
- 19 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/SConstruct
r1232 r1259 27 27 ("makedist", 28 28 "Make a binary archive giving a suffix, e.g. sarge or fc5", 29 "") 29 ""), 30 EnumOption("makedoc", "Build the userguide in specified format", 31 "none", 32 ["none", "pdf", "html"], ignorecase=1) 30 33 ) 31 34 … … 76 79 env = conf.Finish() 77 80 78 env["version"] = "2.1.0b 1"81 env["version"] = "2.1.0b2" 79 82 80 83 # general CPPFLAGS … … 149 152 env["stagedir"]) 150 153 env.AddPostAction(arch, Delete("$stagedir")) 154 if env["makedoc"].lower() != "none": 155 env.SConscript("doc/SConscript") 151 156 152 157 if env.GetOption("clean"): -
trunk/doc/CHANGELOG
r1054 r1259 1 1 Changelog 2 2 ========= 3 Release Version 2.1 [2006-09-11] 4 5 * Processing of Multibeam MX data 6 * Line Catalogs for both plotting and setting rest frequencies 7 * median averaging 8 * support of circular polarisations 9 * binaries for fedora (core 3/5), debian, ubuntu, OSX (ppc,intel) 10 * text/arrow/line annonations for plotter 11 * export of fit parameters to text file 12 * disk based scantables for large data sets 13 * re-introduced custom quotients 14 * fixed major fitter bug 15 * fft flagging 16 * full support for MOPS data 3 17 4 18 Release Version 2.0 [2006-04-28] … … 8 22 user interface. 9 23 * Creation of a "selector" object used for data selection. Allow slicing of 10 data in beam, IF, polarisation as well as selection via header values 24 data in beam, IF, polarisation as well as selection via header values 11 25 (e.g. Tsys). set_cursor is now invalid use set_selection instead. 12 26 * Scantables can be merged -
trunk/doc/userguide.tex
r1217 r1259 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} -
trunk/python/__init__.py
r1193 r1259 149 149 # scantable 150 150 151 # default storage of scantable ( memory/disk)151 # default storage of scantable ('memory'/'disk') 152 152 scantable.storage : memory 153 153 # default ouput format when saving … … 355 355 356 356 __date__ = '$Date$'.split()[1] 357 __version__ = '2.1 b'357 __version__ = '2.1' 358 358 359 359 def is_ipython(): 360 return '__IP' in dir(sys.modules["__main__"]) 360 return '__IP' in dir(sys.modules["__main__"]) 361 361 if is_ipython(): 362 362 def version(): print "ASAP %s(%s)"% (__version__, __date__) … … 397 397 get_abcissa - get the abcissa values and name for a given 398 398 row (time) 399 get_column_names - get the names of the columns in the scantable 400 for use with selector.set_query 399 401 set_freqframe - set the frame info for the Spectral Axis 400 402 (e.g. 'LSRK') … … 462 464 set_names - set a selection by name (wildcards allowed) 463 465 set_tsys - set a selection by tsys thresholds 466 set_query - set a selection by SQL-like query, e.g. BEAMNO==1 464 467 reset - unset all selections 465 468 + - merge to selections -
trunk/python/asaplotbase.py
r1153 r1259 13 13 from matplotlib import rc, rcParams 14 14 from asap import rcParams as asaprcParams 15 from matplotlib.ticker import ScalarFormatter15 from matplotlib.ticker import OldScalarFormatter 16 16 from matplotlib.ticker import NullLocator 17 17 from matplotlib.transforms import blend_xy_sep_transform … … 20 20 print "Warning: matplotlib version < 0.87. This might cause errors. Please upgrade." 21 21 22 class MyFormatter(ScalarFormatter):23 def __call__(self, x, pos=None):24 #last = len(self.locs)-225 if pos==0:26 return ''27 else: returnScalarFormatter.__call__(self, x, pos)22 #class MyFormatter(OldScalarFormatter): 23 # def __call__(self, x, pos=None): 24 # last = len(self.locs)-2 25 # if pos==0: 26 # return '' 27 # else: return OldScalarFormatter.__call__(self, x, pos) 28 28 29 29 class asaplotbase: … … 615 615 self.subplots[i]['axes'] = self.figure.add_subplot(rows, 616 616 cols, i+1) 617 self.subplots[i]['axes'].xaxis.set_major_formatter(OldScalarFormatter()) 617 618 else: 618 619 if i == 0: 619 620 self.subplots[i]['axes'] = self.figure.add_subplot(rows, 620 621 cols, i+1) 622 self.subplots[i]['axes'].xaxis.set_major_formatter(OldScalarFormatter()) 621 623 else: 622 624 self.subplots[i]['axes'] = self.figure.add_subplot(rows, … … 624 626 sharex=self.subplots[0]['axes'], 625 627 sharey=self.subplots[0]['axes']) 628 626 629 # Suppress tick labelling for interior subplots. 627 630 if i <= (rows-1)*cols - 1: -
trunk/python/asapplotter.py
r1232 r1259 412 412 if self._data: self.plot(self._data) 413 413 414 def plot_lines(self, linecat=None, doppler=0.0, deltachan=10, rotate= 0.0,414 def plot_lines(self, linecat=None, doppler=0.0, deltachan=10, rotate=90.0, 415 415 location=None): 416 416 """ … … 421 421 deltachan: the number of channels to include each side of the 422 422 line to determine a local maximum/minimum 423 rotate: the rotation for the text label423 rotate: the rotation (in degrees) )for the text label (default 90.0) 424 424 location: the location of the line annotation from the 'top', 425 425 'bottom' or alternate (None - the default) … … 427 427 If the spectrum is flagged no line will be drawn in that location. 428 428 """ 429 if not self._data: return 429 if not self._data: 430 raise RuntimeError("No scantable has been plotted yet.") 430 431 from asap._asap import linecatalog 431 if not isinstance(linecat, linecatalog): return 432 if not self._data.get_unit().endswith("GHz"): return 433 #self._plotter.hold() 432 if not isinstance(linecat, linecatalog): 433 raise ValueError("'linecat' isn't of type linecatalog.") 434 if not self._data.get_unit().endswith("Hz"): 435 raise RuntimeError("Can only overlay linecatalogs when data is in frequency.") 434 436 from matplotlib.numerix import ma 435 437 for j in range(len(self._plotter.subplots)): … … 437 439 lims = self._plotter.axes.get_xlim() 438 440 for row in range(linecat.nrow()): 439 restf = linecat.get_frequency(row)/1000.0 441 # get_frequency returns MHz 442 base = { "GHz": 1000.0, "MHz": 1.0, "Hz": 1.0e-6 } 443 restf = linecat.get_frequency(row)/base[self._data.get_unit()] 440 444 c = 299792.458 441 445 freq = restf*(1.0-doppler/c) … … 482 486 linecat.get_name(row), 483 487 location=loc, rotate=rotate) 484 # self._plotter.release()485 488 self._plotter.show(hardrefresh=False) 486 489 -
trunk/python/linecatalog.py
r1156 r1259 25 25 def __init__(self, name): 26 26 fpath = os.path.abspath(os.path.expandvars(os.path.expanduser(name))) 27 lcbase.__init__(self, fpath) 27 if os.path.exists(fpath): 28 lcbase.__init__(self, fpath) 29 else: 30 msg = "File '%s' not found" % fpath 31 if rcParams['verbose']: 32 print msg 33 return 34 else: 35 raise IOError(msg) 28 36 29 37 def summary(self): … … 96 104 Reset the table to its initial state, i.e. undo all calls to set_ 97 105 """ 98 lcbase.reset( )106 lcbase.reset(self) 99 107 100 108 def get_row(self, row=0): -
trunk/python/scantable.py
r1217 r1259 33 33 if average is None: 34 34 average = rcParams['scantable.autoaverage'] 35 #varlist = vars()35 varlist = vars() 36 36 from asap._asap import stmath 37 37 self._math = stmath() … … 72 72 and isinstance(filename[-1], str): 73 73 self._fill(filename, unit, average) 74 self._add_history("scantable", varlist) 74 75 print_log() 75 76 … … 344 345 print "--------------------------------------------------" 345 346 print out 346 retval = { 'axesnames': ['scanno', 'beamno', 'ifno', 'polno', 'cycleno'], 347 'axes' : axes, 348 'data': statvals} 349 return retval 347 return 348 else: 349 retval = { 'axesnames': ['scanno', 'beamno', 'ifno', 'polno', 'cycleno'], 350 'axes' : axes, 351 'data': statvals} 352 return retval 350 353 351 354 def stddev(self, mask=None): … … 366 369 367 370 368 def column_names(self):371 def get_column_names(self): 369 372 """ 370 373 Return a list of column names, which can be used for selection. 371 374 """ 372 return list(Scantable. column_names(self))375 return list(Scantable.get_column_names(self)) 373 376 374 377 def get_tsys(self): … … 809 812 for i in xrange(len(freqs)): 810 813 sel.set_ifs([i]) 814 self._setselection(sel) 811 815 self._setrestfreqs(freqs[i]["value"], 812 816 freqs[i]["name"], "MHz") 813 self._setselection(sel)814 817 self._setselection(savesel) 815 818 # freqs are to be taken from a linecatalog … … 831 834 832 835 833 def history(self): 836 def history(self, filename=None): 837 """ 838 Print the history. Optionally to a file. 839 """ 834 840 hist = list(self._gethistory()) 835 841 out = "-"*80 … … 848 854 out += "\n %s = %s" % (s[0], s[1]) 849 855 out += "\n"+"-"*80 850 try: 851 from IPython.genutils import page as pager 852 except ImportError: 853 from pydoc import pager 854 pager(out) 856 if filename is not None: 857 if filename is "": 858 filename = 'scantable_history.txt' 859 import os 860 filename = os.path.expandvars(os.path.expanduser(filename)) 861 if not os.path.isdir(filename): 862 data = open(filename, 'w') 863 data.write(out) 864 data.close() 865 else: 866 msg = "Illegal file name '%s'." % (filename) 867 if rcParams['verbose']: 868 print msg 869 else: 870 raise IOError(msg) 871 if rcParams['verbose']: 872 try: 873 from IPython.genutils import page as pager 874 except ImportError: 875 from pydoc import pager 876 pager(out) 877 else: 878 return out 855 879 return 856 857 880 # 858 881 # Maths business … … 1676 1699 self.set_fluxunit(unit) 1677 1700 self.set_freqframe(rcParams['scantable.freqframe']) 1678 #self._add_history("scantable", varlist) 1679 1701 -
trunk/src/LineCatalog.cpp
r1126 r1259 96 96 oss << std::left << setw(20) << getName(i); 97 97 oss << setw(12) << setprecision(8) << std::left << getFrequency(i); 98 oss << setw(12) << setprecision(8) << std::left << getStrength(i); 98 99 oss << endl; 99 100 } … … 103 104 oss << std::left << setw(20) << getName(row); 104 105 oss << setw(12) << setprecision(8) << std::left << getFrequency(row); 106 oss << setw(12) << setprecision(8) << std::left << getStrength(row); 105 107 oss << endl; 106 108 } else { … … 127 129 } 128 130 131 double asap::LineCatalog::getStrength(uint row) const 132 { 133 ROScalarColumn<Double> col(table_, "Column3"); 134 return col(row); 135 } 136 129 137 130 138 } // namespace -
trunk/src/LineCatalog.h
r1126 r1259 85 85 86 86 /** 87 * Return the line strength value for a specific row 88 * @param row the row number 89 * @return a double rest line strength value 90 */ 91 double getStrength(uint row) const; 92 93 /** 87 94 * 88 95 * @param row -
trunk/src/Makefile
r1198 r1259 25 25 26 26 # cfitsio 27 CFITSIOROOT := /usr 28 # If aips++ is build with LFS (default) you need to have 29 # libcfitsio with lfs support 30 # this is default in cfitsio >= 3.0 27 CFITSIOROOT := /usr/local 31 28 CFITSIOINC := -I$(CFITSIOROOT)/include 32 CFITSIOLIB := -L$(CFITSIOROOT) -lcfitsio29 CFITSIOLIB := -L$(CFITSIOROOT)/lib -lcfitsio 33 30 34 31 #rpfits … … 36 33 RPFITSLIB := $(RPFITSROOT)/lib/librpfits.a 37 34 38 G2CROOT := /usr 39 G2CLIB := $(G2CROOT)/lib -lg2c 35 G2CROOT := /usr/local 36 G2CARCH := $(G2CROOT)/lib/gcc/i386-apple-darwin8.7.1/4.2.0/libgcc.a 37 G2CARCH := $(G2CROOT)/lib/gcc/powerpc-apple-darwin8.7.0/4.2.0/libgcc.a 38 G2CLIB := $(G2CROOT)/lib/libgfortran.a $(G2CARCH) 40 39 41 40 # This assumes all casa libs are static only (*.a) … … 79 78 80 79 # has to be build with same g++ version as casa 81 BOOSTROOT := /usr 80 BOOSTROOT := /usr/local 82 81 BOOSTLIB := -L$(BOOSTROOT)/lib -lboost_python 83 82 BOOSTINC := -I$(BOOSTROOT)/include/boost … … 92 91 RowAccumulator.o \ 93 92 Logger.o \ 93 LineCatalog.o \ 94 94 STAttr.o \ 95 95 STHeader.o \ … … 124 124 python_STFitEntry.o \ 125 125 python_STWriter.o \ 126 python_LineCatalog.o \ 126 127 python_asap.o 127 128 -
trunk/src/STMath.cpp
r1232 r1259 350 350 TableRow row(tout); 351 351 ROScalarColumn<Double> offtimeCol(offs, "TIME"); 352 353 352 ArrayColumn<Float> outspecCol(tout, "SPECTRA"); 354 353 ROArrayColumn<Float> outtsysCol(tout, "TSYS"); … … 359 358 ROScalarColumn<Double> offtimeCol(offs, "TIME"); 360 359 Double mindeltat = min(abs(offtimeCol.getColumn() - ontime)); 361 Table sel = offs( abs(offs.col("TIME")-ontime) <= mindeltat 360 // Timestamp may vary within a cycle ???!!! 361 // increase this by 0.5 sec in case of rounding errors... 362 // There might be a better way to do this. 363 mindeltat += 0.5; 364 Table sel = offs( abs(offs.col("TIME")-ontime) <= (mindeltat+0.5) 362 365 && offs.col("BEAMNO") == Int(rec.asuInt("BEAMNO")) 363 366 && offs.col("IFNO") == Int(rec.asuInt("IFNO")) 364 367 && offs.col("POLNO") == Int(rec.asuInt("POLNO")) ); 365 368 369 if ( sel.nrow() < 1 ) { 370 throw(AipsError("No closest in time found... This could be a rounding " 371 "issue. Try quotient instead.")); 372 } 366 373 TableRow offrow(sel); 367 374 const TableRecord& offrec = offrow.get(0);//should only be one row -
trunk/src/STPolCircular.cpp
r1189 r1259 35 35 if ( index == 0 ) 36 36 out = Vector<Float>(getSpectrum(0) + getSpectrum(1)); 37 else if ( index == 3 ) 38 out = Vector<Float>(getSpectrum(0) - getSpectrum(1)); 37 39 } 38 40 return out; -
trunk/src/STWriter.cpp
r1072 r1259 298 298 { 299 299 String poltype = tab.keywordSet().asString("POLTYPE"); 300 if ( poltype != "linear") {300 if ( poltype == "stokes") { 301 301 String msg = "poltype = " + poltype + " not yet supported in output."; 302 302 throw(AipsError(msg)); -
trunk/src/python_Scantable.cpp
r1189 r1259 77 77 (arg("whichrow")=0, arg("poltype")=std::string("")) ) 78 78 .def("poltype", &ScantableWrapper::getPolType ) 79 .def(" column_names", &ScantableWrapper::columnNames)79 .def("get_column_names", &ScantableWrapper::columnNames) 80 80 .def("_getpollabel", &ScantableWrapper::getPolarizationLabel) 81 81 .def("_setspectrum",&ScantableWrapper::setSpectrum, -
trunk/test/file-io.py
r1038 r1259 9 9 rcParams['verbose'] = 0 10 10 11 12 11 print "Test of file i/o" 13 12 rc('plotter', storage='disk') 13 data = scantable('data/tid-t002.rpf') 14 del data 15 rc('plotter',storage='memory') 14 16 data = scantable('data/tid-t002.rpf') 15 17 -
trunk/web/commands.html
r1040 r1259 39 39 ?> 40 40 <!-- Start Content --> 41 <h1> <a href="index.html">ASAP</a>'commands'</h1>41 <h1>ASAP 'commands'</h1> 42 42 <pre class="commands"> 43 43 ASAP> commands() 44 45 44 [The scan container] 46 45 scantable - a container for integrations/scans … … 49 48 get_scan - gets a specific scan out of a scantable 50 49 (by name or number) 50 drop_scan - drops a specific scan out of a scantable 51 (by number) 51 52 set_selection - set a new subselection of the data 52 53 get_selection - get the current selection object … … 67 68 get_abcissa - get the abcissa values and name for a given 68 69 row (time) 70 get_column_names - get the names of the columns in the scantable 71 for use with selector.set_query 69 72 set_freqframe - set the frame info for the Spectral Axis 70 73 (e.g. 'LSRK') … … 72 75 set_dirframe - set the frame for the direction on the sky 73 76 set_instrument - set the instrument name 77 set_feedtype - set the feed type 74 78 get_fluxunit - get the brightness flux unit 75 79 set_fluxunit - set the brightness flux unit … … 80 84 set_restfreqs - set a list of rest frequencies 81 85 flag - flag selected channels in the data 82 save - save the scantable to disk as either 'ASAP' 83 or 'SDFITS' 86 lag_flag - flag specified frequency in the data 87 save - save the scantable to disk as either 'ASAP', 88 'SDFITS' or 'ASCII' 84 89 nbeam,nif,nchan,npol - the number of beams/IFs/Pols/Chans 85 90 nscan - the number of scans in the scantable … … 90 95 or a list of scans 91 96 average_pol - average the polarisations together. 92 The dimension won't be reduced and 93 all polarisations will contain the 94 averaged spectrum. 97 average_beam - average the beams together. 95 98 convert_pol - convert to a different polarisation type 96 99 auto_quotient - return the on/off quotient with 97 automatic detection of the on/off scans 98 (matched pairs and 1 off - n on) 100 automatic detection of the on/off scans (closest 101 in time off is selected) 102 mx_quotient - Form a quotient using MX data (off beams) 99 103 scale, *, / - return a scan scaled by a given factor 100 104 add, +, - - return a scan with given value added … … 131 135 set_names - set a selection by name (wildcards allowed) 132 136 set_tsys - set a selection by tsys thresholds 137 set_query - set a selection by SQL-like query, e.g. BEAMNO==1 133 138 reset - unset all selections 134 139 + - merge to selections … … 141 146 simple_math - simple mathematical operations on two scantables, 142 147 'add', 'sub', 'mul', 'div' 148 quotient - build quotient of the given on and off scans 149 (matched pairs and 1 off/n on are valid) 150 merge - merge a list of scantables 151 152 [Line Catalog] 153 linecatalog - a linecatalog wrapper, taking an ASCII or 154 internal format table 155 summary - print a summary of the current selection 156 set_name - select a subset by name pattern, e.g. '*OH*' 157 set_strength_limits - select a subset by line strength limits 158 set_frequency_limits - select a subset by frequency limits 159 reset - unset all selections 160 save - save the current subset to a table (internal 161 format) 162 get_row - get the name and frequency from a specific 163 row in the table 143 164 [Fitting] 144 165 fitter … … 163 184 called 'plotter' 164 185 plot - plot a scantable 186 plot_lines - plot a linecatalog overlay 165 187 save - save the plot to a file ('png' ,'ps' or 'eps') 166 188 set_mode - set the state of the plotter, i.e. … … 177 199 set_linestyles - specify a set of linestyles to use if only 178 200 using one color 179 set_histrogra, - plot in historam style 201 set_font - set general font properties, e.g. 'family' 202 set_histogram - plot in historam style 180 203 set_mask - set a plotting mask for a specific polarization 204 text - draw text annotations either in data or relative 205 coordinates 206 arrow - draw arrow annotations either in data or relative 207 coordinates 208 axhline,axvline - draw horizontal/vertical lines 209 axhspan,axvspan - draw horizontal/vertical regions 210 211 xyplotter - matplotlib/pylab plotting functions 181 212 182 213 [Reading files] … … 199 230 list_rcparameters - print out a list of possible values to be 200 231 put into $HOME/.asaprc 232 rc - set rc parameters from within asap 201 233 mask_and,mask_or, 202 234 mask_not - boolean operations on masks created with -
trunk/web/index.html
r1071 r1259 47 47 48 48 <h2>Current Release</h2> 49 ASAP latest stable version 2.0 was released on April, 27<sup>th</sup> 2006. It can be obtained in the <a href="#download">Download</a> section.49 <b class="asap">ASAP</b> latest stable version 2.1 was released on September, 11<sup>th</sup> 2006. It can be obtained in the <a href="#download">Download</a> section. 50 50 51 51 <h2>Screenshots</h2> … … 56 56 <pre style="color: blue"> 57 57 Loading ASAP... 58 Welcome to ASAP v2. 0 (2006/04/27) - the ATNF Spectral Analysis Package58 Welcome to ASAP v2.1 (release date) - the ATNF Spectral Analysis Package 59 59 60 60 Please report any bugs via: … … 69 69 <h2>Defects and enhancement requests</h2> 70 70 Bugs and enhancement requests can be submitted online, via the <a href="http://sourcecode.atnf.csiro.au/cgi-bin/trac_asap.cgi/newticket"> 71 ASAP project tracking page</a>. Please also check if the defect has already been sumbitted under71 <b class="asap">ASAP</b> project tracking page</a>. Please also check if the defect has already been submitted under 72 72 <a href="http://sourcecode.atnf.csiro.au/cgi-bin/trac_asap.cgi/report/1">current tickets</a>. 73 73 74 74 75 75 <h2>Documentation</h2> 76 ASAPhas a user guide for general use and telescope specific examples,76 <b class="asap">ASAP</b> has a user guide for general use and telescope specific examples, 77 77 and a reference manual for people who want to write scripts to reduce 78 78 and analyse their data. … … 82 82 <li> Reference manual <a href="refman/">(html)</a> <a href="refman.pdf">(pdf)</a></li> 83 83 <li><a href="tutorials/">Tutorials</a></li> 84 <li>For FAQ's go to the <a href="http://sourcecode.atnf.csiro.au/cgi-bin/trac_asap.cgi/wiki/AsapFaq"></a> 84 85 </ul> 85 86 <p> … … 87 88 <p> 88 89 The <a href="http://sourcecode.atnf.csiro.au/cgi-bin/trac_asap.cgi">Trac page</a> 89 for ASAP also contains information about building from source and code 90 revisions and milestones. The current 90 for <b class="asap">ASAP</b> also contains information about building from source and some more detailed information. It also shows information regarding release dates and milestones. 91 91 92 92 … … 110 110 111 111 <a name="download"><h2>Download</h2></a> 112 ASAP source code and binaries are available in the <a href="http://www.atnf.csiro.au/pub/software/asap/">ATNF ftp area</a> 112 <b class="asap">ASAP</b> binaries are available in the <a href="http://www.atnf.csiro.au/pub/software/asap/current">ATNF ftp area</a> 113 Please also consult the <a href="http://sourcecode.atnf.csiro.au/cgi-bin/trac_asap.cgi/wiki">wiki</a> 113 114 <ul> 114 <li> A binary tar archive of the latest stable release <a 115 href=ftp://ftp.atnf.csiro.au/pub/software/asap/asap_linux.tar.bz2>linux binary</a>. 116 You will need to have the following libraries:<br> 117 gcc-3.3, blas, lapack, g2c, boost_python and of course 118 python2.3.<br> 119 The matplotlib python module has to be installed too. 115 <li> We provide binaries for debian, fedora and OSX based systems. If yours isn't there 116 send a request giving details about your flavour of linux. 120 117 </li> 121 <li>For Mac OSX 10.4 follow <a href="./osx.html">these instructions.</a></li> 122 <li>Current stable release source code snapshot <a 123 href="ftp://ftp.atnf.csiro.au/pub/software/asap/asap_src.tar.bz2">asap source</a> 124 You will need a full aips++ installation, or cyou an try and use the 125 <a href="http://www.atnf.csiro.au/pub/software/asap/casa_asap.tar.bz2">mini-aips++ tree</a>, 126 necessary to build ASAP.</li> 127 <li>The ASAP data package, which contains information about observatories and 128 coordinate frames can be downloaded <a href="http://www.atnf.csiro.au/pub/software/asap/asap_data.tar.bz2">here</a>. 129 You need this if you are building ASAP from source.</li> 118 <li><b class="asap">ASAP</b> source code is available through our subversion repository 119 <pre> 120 svn co http://sourcecode.atnf.csiro.au/repos/asap/branches/Release2.1 asap2.1 121 </pre> 122 </li> 130 123 </ul> 131 124 <p> 132 125 133 126 <h2>Important</h2> 134 ASAPis 0-based, i.e. all ranges (vectors) go from127 <b class="asap">ASAP</b> is 0-based, i.e. all ranges (vectors) go from 135 128 0..n-1, if n is the number of elements. 136 129 <br>
Note:
See TracChangeset
for help on using the changeset viewer.