| 1 | #!/usr/bin/env python | 
|---|
| 2 | from asap import * | 
|---|
| 3 |  | 
|---|
| 4 | import os | 
|---|
| 5 | outdir = "./output" | 
|---|
| 6 | if not os.path.exists(outdir): | 
|---|
| 7 | os.mkdir(outdir) | 
|---|
| 8 |  | 
|---|
| 9 | rcParams['verbose'] = 0 | 
|---|
| 10 | rcParams['plotter.ganged'] = 0 | 
|---|
| 11 |  | 
|---|
| 12 | # Don't plot to the screen... | 
|---|
| 13 | del plotter | 
|---|
| 14 | plotter = asapplotter(False) | 
|---|
| 15 |  | 
|---|
| 16 | print "Test of Parkes polarimetry (P484)" | 
|---|
| 17 |  | 
|---|
| 18 | data_1665 = scantable('data/parkes-pol.rpf') | 
|---|
| 19 | data_1665.rotate_linpolphase(-45) | 
|---|
| 20 | data_1665.rotate_xyphase(-2) | 
|---|
| 21 | data_1665.set_unit('km/s') | 
|---|
| 22 | data_1665.set_freqframe('LSRK') | 
|---|
| 23 |  | 
|---|
| 24 | # Look at the first scan | 
|---|
| 25 | selection = selector() | 
|---|
| 26 | selection.set_scans(0) | 
|---|
| 27 | data_1665.set_selection(selection) | 
|---|
| 28 |  | 
|---|
| 29 | d1_5 = data_1665.copy() | 
|---|
| 30 | d1_7 = data_1665.copy() | 
|---|
| 31 |  | 
|---|
| 32 | d1_7.set_restfreqs([1667.3590],'MHz') | 
|---|
| 33 |  | 
|---|
| 34 | # Baseline both | 
|---|
| 35 | msk = d1_5.create_mask([-30,-25],[-5,0]) | 
|---|
| 36 | d1_5.poly_baseline(msk,1) | 
|---|
| 37 | msk = d1_7.create_mask([-30,-25],[-5,0]) | 
|---|
| 38 | d1_7.poly_baseline(msk,1) | 
|---|
| 39 |  | 
|---|
| 40 | # merge the two scans back together into a new scantable | 
|---|
| 41 | plotscans = merge(d1_5,d1_7) | 
|---|
| 42 | print plotscans.summary() | 
|---|
| 43 | del d1_5,d1_7,data_1665 | 
|---|
| 44 | # Plot the results | 
|---|
| 45 | plotter.set_mode('p','s') | 
|---|
| 46 | plotter.set_layout(2,1) | 
|---|
| 47 | plotter.set_range(-30,0) | 
|---|
| 48 | selection.reset() | 
|---|
| 49 | selection.set_polarisations(['I','Q', 'U', 'V']) | 
|---|
| 50 | plotter.set_selection(selection) | 
|---|
| 51 | selection.set_polarisations(['I','Plinear']) | 
|---|
| 52 | plotter.set_selection(selection) | 
|---|
| 53 | selection.set_polarisations(['RR','LL']) | 
|---|
| 54 | plotter.set_selection(selection) | 
|---|
| 55 | plotter.plot(plotscans) | 
|---|
| 56 | plotter.save('output/parkes_rrll.png',dpi=80) | 
|---|
| 57 |  | 
|---|
| 58 | print "Parkes-Pol Test successful" | 
|---|