1 # Tests the Meqtree ParAngle (Parallactic Angle) node
2 # Copyright: The MeqTree Foundation
3
4 # standard preamble
5 from Timba.TDL import *
6 from Timba.Meq import meq
7 from Timba.Meq import meqds
8
9 # Timba.TDL.Settings.forest_state is a standard TDL name.
10 # This is a record passed to Set.Forest.State.
11 Settings.forest_state.cache_policy = 100;
12
13 def _define_forest (ns):
14 """define_forest() is a standard TDL name. """;
15 # set up a sequence of nodes for testing of the ParAngle node
16
17 # first define an RA and DEC (in radians)
18 ra = 0.0
19 dec = 0.0
20 ns.ra0 << Meq.Parm(ra,node_groups='Parm')
21 ns.dec0 << Meq.Parm(dec,node_groups='Parm')
22
23 # then create a MeqComposer containing ra dec children
24 ns.RADec <<Meq.Composer(ns.ra0, ns.dec0)
25
26
27 # station positions ITRF X,Y,Z for 'pseudo' VLA telescope
28 # for aips++ MVDirection object (units are metres).
29 X_pos = -1597262.96
30 Y_pos = -5043205.54
31 Z_pos = 3554901.34
32 ns.x_pos << Meq.Parm(X_pos,node_groups='Parm')
33 ns.y_pos << Meq.Parm(Y_pos,node_groups='Parm')
34 ns.z_pos << Meq.Parm(Z_pos,node_groups='Parm')
35
36 # create a MeqComposer containing X_pos, Y_pos, Z_pos children
37 ns.XYZ <<Meq.Composer(ns.x_pos, ns.y_pos, ns.z_pos)
38
39 # we should now be able to create an ParAngle node with X,Y,Z station positions
40 ns.ParAngle << Meq.ParAngle(radec=ns.RADec, xyz=ns.XYZ)
41
42 # Note: you could also use an observatory name
43 # ns.ParAngle1 << Meq.ParAngle(radec=ns.RADec, observatory = 'VLA')
44
45
46 def _test_forest (mqs,parent):
47 """test_forest() is a standard TDL name. """;
48
49 ####
50 # time and frequency domain
51 # time - cover one day
52 t0 = 0.01;
53 t1 = 86400.01;
54
55 # any old frequency
56 f1 = 299792458.0;
57 f0 = 0.9*f1;
58
59 ####
60 # Make cells array - we will compute Parallactic Angle over a period
61 # of one day divided into 120 segments
62
63 cells = meq.cells(meq.domain(f0,f1,t0,t1),num_freq=1,num_time=120);
64
65 # define request
66 request = meq.request(cells,rqtype='e1')
67
68 # execute request
69 a = mqs.meq('Node.Execute',record(name='ParAngle',request=request),wait=True);
70
71 # The following is the testing branch, executed when the script is run directly
72 # via 'python script.py'
73 if __name__ == '__main__':
74 Timba.TDL._dbg.set_verbose(5);
75 ns = NodeScope();
76 _define_forest(ns);
77 # resolves nodes
78 ns.Resolve();
