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 | plotter.plot(plotscans) |
---|
50 | selection.set_polarisations(['I','Q', 'U', 'V']) |
---|
51 | plotter.set_selection(selection) |
---|
52 | plotter.save('output/parkes_iquv.png',dpi=80) |
---|
53 | selection.set_polarisations(['I','Plinear']) |
---|
54 | plotter.set_selection(selection) |
---|
55 | plotter.save('output/parkes_iplin.png',dpi=80) |
---|
56 | selection.set_polarisations(['RR','LL']) |
---|
57 | plotter.set_selection(selection) |
---|
58 | plotter.save('output/parkes_rrll.png',dpi=80) |
---|
59 | |
---|
60 | print "Parkes-Pol Test successful" |
---|