1 
   2 # A Python TDL script to test the LST node
   3 
   4 from Timba.TDL import *
   5 from Timba.Meq import meq
   6 from Timba.Meq import meqds
   7 
   8 # setup a bookmark for display of results with a 'Result Plotter'
   9 Settings.forest_state = record(bookmarks=[
  10   record(name='LST',page=[
  11     record(udi="/node/LST",viewer="Result Plotter",pos=(0,0)),
  12     record(udi="/node/LST1",viewer="Result Plotter",pos=(1,0))]
  13 )]);
  14 
  15 # Timba.TDL.Settings.forest_state is a standard TDL name.
  16 # This is a record passed to Set.Forest.State.
  17 Settings.forest_state.cache_policy = 100;
  18 
  19 def _define_forest (ns):
  20   """define_forest() is a standard TDL name. When a forest script is
  21   loaded by, e.g., the browser, this method is automatically called to
  22   define the forest. The 'ns' argument is a NodeScope object in which
  23   the forest is to be defined, usually this is simply the global scope.
  24   """;
  25 # ITRF station positions for one of the VLA telescopes
  26 # (units are metres)
  27   X_pos = -1597262.96
  28   Y_pos = -5043205.54
  29   Z_pos = 3554901.34
  30   ns.x_pos << Meq.Parm(X_pos,node_groups='Parm')
  31   ns.y_pos << Meq.Parm(Y_pos,node_groups='Parm')
  32   ns.z_pos << Meq.Parm(Z_pos,node_groups='Parm')
  33 
  34 # create a  MeqComposer containing X_pos, Y_pos, Z_pos children
  35   ns.XYZ <<Meq.Composer(ns.x_pos, ns.y_pos, ns.z_pos)
  36 
  37 # we should be able to create an LST node with X,Y,Z station positions
  38   ns.LST << Meq.LST(xyz=ns.XYZ)
  39 
  40 # we should also be able to create an LST node with an Observatory name
  41   ns.LST1 << Meq.LST(observatory='VLA')
  42 
  43 # create a ReqSeq node to call the two LST nodes
  44   ns.reqseq <<Meq.ReqSeq(ns.LST,ns.LST1)
  45 
  46 def _test_forest (mqs,parent):
  47   """test_forest() is a standard TDL name. When a forest script is
  48   loaded by, e.g., the browser, and the "test" option is set to true,
  49   this method is automatically called after define_forest() to run a
  50   test on the forest. The 'mqs' argument is a meqserver proxy object.
  51   """;
  52 
  53 ####
  54 # time and frequency domain
  55 # time - cover one day
  56   t0 = 0.01;
  57   t1 = 86400.01;
  58 
  59 # any old frequency
  60   f1 =  299792458.0;
  61   f0 = 0.9*f1;
  62 
  63 ####
  64 # Make cells array - we will compute Azimuth and Elevation over a period
  65 # of one day divided into 120 segments
  66 
  67   cells = meq.cells(meq.domain(f0,f1,t0,t1),num_freq=1,num_time=120);
  68 
  69 # define request
  70   request = meq.request(cells,rqtype='e1')
  71 
  72 # execute request
  73   a = mqs.meq('Node.Execute',record(name='reqseq',request=request),wait=True);
  74 
  75 # The following is the testing branch, executed when the script is run directly
  76 # via 'python script.py'
  77 if __name__ == '__main__':
  78   Timba.TDL._dbg.set_verbose(5);
  79   ns = NodeScope();
  80   _define_forest(ns);
  81   # resolves nodes
  82   ns.Resolve();

MeqLST.py (last edited 2008-01-15 00:07:38 by TonyWillis)