HERA-Team / aipy

Astronomical Interferometry in PYthon (AIPY)
http://pypi.python.org/pypi/aipy
Other
43 stars 29 forks source link

gen_phs bug for single frequency case #19

Open AaronParsons opened 7 years ago

AaronParsons commented 7 years ago
   I find the following sentence in the function`gen_phs` of  `aipy.phs` module, in the case of only a single frequency channel, will get an error. 
     if not srcshape is None: phs *= self.resolve_src(u, v, srcshape=srcshape)

It calls the function `resolve_src`, which returns
     return n.where(x == 0, 1, 2 * _cephes.j1(x)/x).squeeze()

When there is only one frequency channel, phs and x will be an numpy array of shape (N,1), where N is an integer number, then the array returned by resolve_src has a shape (N,) for N>1 and () for N=1. In the former case, the shape of the array phs and the returned array won't match, so an error occurs. While it is OK in all cases for

return n.where(x == 0, 1, 2 * _cephes.j1(x)/x) so maybe it's better to drop the squeeze operation. In addition, in the function sim of aipy.amp module, there is a sentence

u,v,w = self.gen_uvw(i, j, src=s_eqs)

here (u,v,w) has computed, but used nowhere else. It is not a bug, but it takes time whenever sim is called.