| 1 | <html> | 
|---|
| 2 | <head> | 
|---|
| 3 | <title>Mopra 2005 Workshop - Data reduction tutorial worksheet</title> | 
|---|
| 4 | <style type="text/css" media="all"> | 
|---|
| 5 | div.shell { | 
|---|
| 6 | background-color: #dbfff9; | 
|---|
| 7 | padding: 0.1em; | 
|---|
| 8 | } | 
|---|
| 9 | div.code { | 
|---|
| 10 | background-color: #c9ffbf; | 
|---|
| 11 | padding: 0.1em; | 
|---|
| 12 | } | 
|---|
| 13 | div.main { | 
|---|
| 14 | margin: 0.2em 0.2em 0.2em 0.2em; | 
|---|
| 15 | text-align: left; | 
|---|
| 16 | font-family: sans-serif; | 
|---|
| 17 | width: auto; | 
|---|
| 18 | } | 
|---|
| 19 | h1.custom { | 
|---|
| 20 | background-color: #aaaaaa; | 
|---|
| 21 | color: #000000; | 
|---|
| 22 | padding: 0.5em; | 
|---|
| 23 | font-family: sans-serif; | 
|---|
| 24 | font-size: x-large; | 
|---|
| 25 | } | 
|---|
| 26 | </style> | 
|---|
| 27 | </head> | 
|---|
| 28 | <body> | 
|---|
| 29 | <div> | 
|---|
| 30 | <h1 class=custom> | 
|---|
| 31 | Introduction | 
|---|
| 32 | </h1> | 
|---|
| 33 | <div class=main align=center> | 
|---|
| 34 | This is a short tutorial on how to use ASAP for simple on of dual IF | 
|---|
| 35 | observations. It is highly customisable via ".aipsrc" parameters. It | 
|---|
| 36 | can read rpfits,sdfits and measurement sets, and export to sdfits, ms, | 
|---|
| 37 | ASCII and image fits.  ASAP provides a lot more functionality, such as | 
|---|
| 38 | frequency alignment, averaging which can't be presented here. | 
|---|
| 39 | </div> | 
|---|
| 40 | <h1 class=custom> | 
|---|
| 41 | Part I - Reduction | 
|---|
| 42 | </h1> | 
|---|
| 43 | <div class=main align=center> | 
|---|
| 44 | To start ASAP type the follwing at  the *nix command line prompt | 
|---|
| 45 | <div class=shell> | 
|---|
| 46 | <pre> | 
|---|
| 47 | localhost> asap | 
|---|
| 48 | </pre> | 
|---|
| 49 | </div> | 
|---|
| 50 | To get the list of available commands in asap type: | 
|---|
| 51 | <div class=code><pre> | 
|---|
| 52 | commands() | 
|---|
| 53 | </pre></div> | 
|---|
| 54 | Help can be accessed by using <em>help</em>: | 
|---|
| 55 | <div class=code><pre> | 
|---|
| 56 | help(scantable) | 
|---|
| 57 | help(scantable.summary) | 
|---|
| 58 | </pre></div> | 
|---|
| 59 | To start we are reading in the data into a scantable, which can be accessed via th variable <em>s</em>. After reading in we have a look at the data. | 
|---|
| 60 | <div class=code><pre> | 
|---|
| 61 | s = scantable("2005-05-08_0350.rpf") | 
|---|
| 62 | s.summary() | 
|---|
| 63 | </pre></div> | 
|---|
| 64 | We can plot the scan now. First we set up the plotter to plot "IF" as stcked colours and "time" across panels. Then we issue th plot command. | 
|---|
| 65 | <div class=code><pre> | 
|---|
| 66 | plotter.set_mode("IF","time") | 
|---|
| 67 | plotter.plot(s) # plot s | 
|---|
| 68 | </pre></div> | 
|---|
| 69 | Now we can build the quotient. This applies the quotient to both IFs. We are taking all scans ending in "_S" to be "on" source and all "_R" to be "off". | 
|---|
| 70 | <div class=code><pre> | 
|---|
| 71 | q = quotient(s.get_scan("*_S"),s.get_scan("*_R")) | 
|---|
| 72 | plotter.plot(q) # plot q | 
|---|
| 73 | </pre></div> | 
|---|
| 74 | Now we can set some information anbout the velocity setup. We set the rest frequencies for 13Co and SiO and want to operate in "LSRK". | 
|---|
| 75 | <div class=code><pre> | 
|---|
| 76 | restfreqs = [110.201,86.243]     # 13CO-1/0, SiO the two IF | 
|---|
| 77 | q.set_restfreqs(restfreqs,"GHz") # set the restfrequencies, as not in data | 
|---|
| 78 | q.set_unit("km/s")               # set the unit to be used from now on | 
|---|
| 79 | q.set_freqframe("LSRK")          # set frequency frame | 
|---|
| 80 | plotter.plot()                   # replot, should show velocity now | 
|---|
| 81 | </pre></div> | 
|---|
| 82 | Now we can subtract a baseline. ASAP can do this automatically if ther is good S/N and the lines aren't too broad. | 
|---|
| 83 | <div class=code><pre> | 
|---|
| 84 | q.auto_poly_baseline() # determine and subtract a poly baseline automatically | 
|---|
| 85 | plotter.plot() # replot | 
|---|
| 86 | </pre></div> | 
|---|
| 87 | We can zoom in on the spectrum and format the title and legend. ASAP accepts LATEX math expressions. | 
|---|
| 88 | <div class=code><pre> | 
|---|
| 89 | plotter.set_range(-35,35)                                  # zoom in  bit | 
|---|
| 90 | plotter.set_legend([r"$^{13}CO(1\leftarrow 0)$",r"$SiO$"]) # make nice latex IF labels | 
|---|
| 91 | plotter.set_title(['Mopra Tutorial 2005'])                 # set the title | 
|---|
| 92 | </pre></div> | 
|---|
| 93 | Now convert Brightness temperature to Flux density. | 
|---|
| 94 | <div class=code><pre> | 
|---|
| 95 | q.convert_flux() # K -> Jy | 
|---|
| 96 | plotter.plot() | 
|---|
| 97 | </pre></div> | 
|---|
| 98 | This "final" plot can be saved now as "png", "ps" or "eps" | 
|---|
| 99 | <div class=code><pre> | 
|---|
| 100 | plotter.save("tutorial.png") | 
|---|
| 101 | plotter.save("tutorial.eps") | 
|---|
| 102 | </pre></div> | 
|---|
| 103 | We can also do some stats on the spectra. We select a line free region first, which get applied to the statistics. | 
|---|
| 104 | <div class=code><pre> | 
|---|
| 105 | msk = q.create_mask([-70,20], [20,70]) # line free region - two windows | 
|---|
| 106 | rms = q.stats("rms",msk) | 
|---|
| 107 | med = q.stats("median",msk) | 
|---|
| 108 | </pre></div> | 
|---|
| 109 | </div> | 
|---|
| 110 | <h1 class=custom> | 
|---|
| 111 | Part II - Fitting | 
|---|
| 112 | </h1> | 
|---|
| 113 | <div class=main align=center> | 
|---|
| 114 | This part shows how easy it is to fit gaussian line profiles. | 
|---|
| 115 | <div class=code><pre> | 
|---|
| 116 | f = fitter() | 
|---|
| 117 | f.set_scan(q) | 
|---|
| 118 | </pre></div> | 
|---|
| 119 | We start with the first spectrum (IF=0) bys setting the cursor. We want to fits to gaussian components. | 
|---|
| 120 | <div class=code><pre> | 
|---|
| 121 | q.set_cursor(IF=0) | 
|---|
| 122 | f.set_function(gauss=2) # fit two gaussians | 
|---|
| 123 | f.fit() | 
|---|
| 124 | f.plot( | 
|---|
| 125 | </pre></div> | 
|---|
| 126 | The second IFs spectrum is more complex. We select it and fit seven gaussians to it. Here we also plot residuals, the individual components and the fit parameters. | 
|---|
| 127 | <div class=code><pre> | 
|---|
| 128 | q.set_cursor(IF=1) | 
|---|
| 129 | f.set_function(gauss=7) | 
|---|
| 130 | f.fit() | 
|---|
| 131 | f.plot(residual=True) | 
|---|
| 132 | f.plot(components=[0,1,2,3,4,5,6,-1]) | 
|---|
| 133 | f.plot(components=[0,1,2,3,4,5,6,-1],plotparms=True) | 
|---|
| 134 | </pre></div> | 
|---|
| 135 | </div> | 
|---|
| 136 | <h1 class=custom> | 
|---|
| 137 | Appendix | 
|---|
| 138 | </h1> | 
|---|
| 139 | <div class=main align=center> | 
|---|
| 140 | More info can be found on the ASAP homepage | 
|---|
| 141 | <a href="http://www.atnf.csiro.au/computing/software/asap"> | 
|---|
| 142 | http://www.atnf.csiro.au/computing/software/asap</a> | 
|---|
| 143 | </div> | 
|---|
| 144 | </body> | 
|---|
| 145 | </html> | 
|---|