-
Notifications
You must be signed in to change notification settings - Fork 2
MultiDimensionalDomains
> Hi Oleg
>
> I'm attempting my first fumblings around in TDL-land and want to create an
> n-dimensional (> 2) equivalent of the flagger_test function in
> MeqServer/test/meqtest.g
>
> So how does one go about defining a domain greater than 2? In glish if I do
> something like domain := meq.domain(-1,1,-1,1,-1,1) everything falls over.
>
> Does one first have to define a non-standrad axis_map record. (I see that
> Ronald's PatchComposer c++ node adds on L,M,U & V axes, but obviously
> I want to do all the n-dim domain stuff in a script.)
>
> Anyway, advice needed for domains > 2!
>
> Cheers
>
> Tony
> ___________
> Tony Willis
> National Research Council Tony.Willis@nrc-cnrc.gc.ca
> Box 248 (250)493-2277
> Penticton, BC V2A 6J9 fax: 493-7767
> Government of Canada Gouvernement du Canada
>
>
Hi Tony --
The meq.domain() and meq.cells() functions in Glish (and Python, for that matter) only support freq/time domains at the moment. However, both a domain and a cells objects in Python (or Glish) is a record, so the quickest way to do it is start with a 2D domain, and add fields to it so as to add dimensions.
-
First, you have to define the extra axes. forest_state.axis_map defines the domain "names". If you are not using any of Ronald's nodes, then this will contain time and freq only. You can use mqs.meq('Get.Forest.State',[=],wait_reply=T) to get the current state; you'll get back the forest state record including axis_map. Now modify this map by inserting more elements into it, each element is a little record of the form [id='l'], [id='m'], etc -- then give it back to the kernel using mqs.meq('Set.Forest.State',[axis_map=your_modified_map]).
-
Now, a 2D domain is a record of the form, e.g. [freq=[0 1] , time=[0 1] ]. Assuming you've defined extra axes l/m, you can just say:
dom := meq.domain(0,1,0,1); dom.l := [0.,1.] dom.m := [0.,1.]
BTW, don't try to build up a domain record from scratch -- it needs some magic to be recognized as a Domain object on the C++ side. You must call meq.domain() to make a 2D domain first, and then extend it as above.
3. Cells is a bit more elaborate but the same principle holds. Create a 2D cells, then add extra fields. Easiest thing is to copy them from another axis (otherwise you have to worry about getting cell sizes and segments right). E.g.:
* ```
c := meq.cells(dom,8,4);
c.grid.l := c.grid.m := c.grid.freq;
c.cell_size.l := c.cell_size.m := c.cell_size.freq;
c.segments.l := c.segments.m := c.segments.freq;
1a. As an alternative, you can dispence with axis names and use axis numbers instead, by referring to them simply as '2', '3', etc. ('0' and '1' being time/freq). This makes record access in Glish somewhat more clumsy, e.g.:
dom['2'] := [0.,1.]
etc... but saves you the trouble of manipulating forest state.
Hope this gets you started. We certainly need a more user-friendly way to do it, but I'm not going to implement anything more on the Glish side... all the more reason for you to go TDL ASAP.
Cheers, Oleg