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.parallactify(True)
|
---|
20 | data_1665.rotate_linpolphase(-45)
|
---|
21 | data_1665.rotate_xyphase(-2)
|
---|
22 | data_1665.set_unit('km/s')
|
---|
23 | data_1665.set_freqframe('LSRK')
|
---|
24 |
|
---|
25 | # Look at the first scan
|
---|
26 | selection = selector()
|
---|
27 | selection.set_scans(0)
|
---|
28 | data_1665.set_selection(selection)
|
---|
29 |
|
---|
30 | d1_5 = data_1665.copy()
|
---|
31 | d1_7 = data_1665.copy()
|
---|
32 |
|
---|
33 | d1_7.set_restfreqs([1667.3590],'MHz')
|
---|
34 |
|
---|
35 | # Baseline both
|
---|
36 | msk = d1_5.create_mask([-30,-25],[-5,0])
|
---|
37 | d1_5.poly_baseline(msk,1)
|
---|
38 | msk = d1_7.create_mask([-30,-25],[-5,0])
|
---|
39 | d1_7.poly_baseline(msk,1)
|
---|
40 |
|
---|
41 | # merge the two scans back together into a new scantable
|
---|
42 | plotscans = merge(d1_5,d1_7)
|
---|
43 | toggle_verbose()
|
---|
44 | plotscans.summary()
|
---|
45 | toggle_verbose()
|
---|
46 | del d1_5,d1_7,data_1665
|
---|
47 | # Plot the results
|
---|
48 | plotter.set_mode('p','s')
|
---|
49 | plotter.set_layout(2,1)
|
---|
50 | plotter.set_range(-30,0)
|
---|
51 | selection.reset()
|
---|
52 | plotter.plot(plotscans)
|
---|
53 | selection.set_polarisations(['I','Q', 'U', 'V'])
|
---|
54 | plotter.set_selection(selection)
|
---|
55 | plotter.save('output/parkes_iquv.png',dpi=80)
|
---|
56 | selection.set_polarisations(['I','Plinear'])
|
---|
57 | plotter.set_selection(selection)
|
---|
58 | plotter.save('output/parkes_iplin.png',dpi=80)
|
---|
59 | selection.set_polarisations(['RR','LL'])
|
---|
60 | plotter.set_selection(selection)
|
---|
61 | plotter.save('output/parkes_rrll.png',dpi=80)
|
---|
62 |
|
---|
63 | print "Parkes-Pol Test successful"
|
---|