Closed ronniyjoseph closed 2 years ago
@ronniyjoseph Thanks for pointing this out. I don't think we want a meshgrid
implementation because most of the time our sources do not occur on a mesh 😆. I think we always want to have a flat array coming in, so we'll add some checks to catch when that's not happening and give a better error message.
Hi folks, I was playing around with AnalyticBeam and noticed a difference between how interp() deals with the
az_array
and za arrays
for Gaussian beams vs the Airy and uniform. The'uniform'
and'airy beam'
are pretty much agnostic to the shapes of the inputaz_array
and inputza_array
, but when using the'gaussian'
beam these need to be flattened before passing to.interp()
, caused byhttps://github.com/RadioAstronomySoftwareGroup/pyuvsim/blob/1ef8cdbfd98fc6f49b598f75d759852407601ebf/pyuvsim/analyticbeam.py#L151
Minimum working example:
Works fine, but with
You get a classic shape mismatch error between the
za_array
andfrequency_array
in line 151.Flattening like the above makes my problem go away (which also seems more in-line with the pyuvsim documentation). It seems that
numpy.meshgrid
actually flattens nd-arrays (not really in the numpy documentation) hence why the non-flattened case works for the Airy beam.I'll gladly accept that I simply shouldn't be passing multi-dimensional arrays to
.interp()
. An alternative would be anp.meshgrid
implementation in the gaussian interpolation, and some flattening afterwards?