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 | print plotscans.summary()
|
---|
44 | del d1_5,d1_7,data_1665
|
---|
45 | # Plot the results
|
---|
46 | plotter.set_mode('p','s')
|
---|
47 | plotter.set_layout(2,1)
|
---|
48 | plotter.set_range(-30,0)
|
---|
49 | selection.reset()
|
---|
50 | plotter.plot(plotscans)
|
---|
51 | selection.set_polarisations(['I','Q', 'U', 'V'])
|
---|
52 | plotter.set_selection(selection)
|
---|
53 | plotter.save('output/parkes_iquv.png',dpi=80)
|
---|
54 | selection.set_polarisations(['I','Plinear'])
|
---|
55 | plotter.set_selection(selection)
|
---|
56 | plotter.save('output/parkes_iplin.png',dpi=80)
|
---|
57 | selection.set_polarisations(['RR','LL'])
|
---|
58 | plotter.set_selection(selection)
|
---|
59 | plotter.save('output/parkes_rrll.png',dpi=80)
|
---|
60 |
|
---|
61 | print "Parkes-Pol Test successful"
|
---|