Skip to content

What_does_the_'reduction_axes'_keyword_do?

Gijs Molenaar edited this page Feb 13, 2014 · 2 revisions

I've been using the MeqMean node to obtain the mean of a child node for the case where a tile has > 1 sample in the time domain but has only a single frequency channel. That works fine for what I want at the moment.

But if I expand the test to a number of frequency channels, it looks from the MeqMean code that I will then get a value returned that is the mean of the contents of the time-frequency cell. Is there some other way I can average the contents in time but NOT in frequency so that I get a vector that's a function of frequency, but has been averaged in time?

Of course. :) You need to create the node as e.g.:

Meq.Mean(reduction_axes=['time'],...)

The default (when no reduction_axes is specified) is to take the mean along all axes. You can also take the mean along several axes by specifying a list. BTW, this works for other nodes such as Min, Max, Sum, Product, etc.

  • use the following node to get a single visibility averaged over a time-frequency tile (the Meq.Mean node has a child named 'predict')
ns.mean << Meq.Mean(predict,reduction_axes=["time", "freq"]);
  • use the following node to obtain spectra averaged over a time block
ns.mean << Meq.Mean(predict,reduction_axes="time");
  • use the following node to get spectra averaged over frequency for each integration in a time block (tile). This equates to getting standard 'continuum' visibilities as a function of time.
ns.mean << Meq.Mean(predict,reduction_axes="freq");
Clone this wiki locally