@@ -196,19 +196,54 @@ def test_mwa_pointing(delay_set, az_val, za_range):
196196 assert np .rad2deg (za_array [max_nn_loc ]) < za_range [1 ]
197197
198198
199- def test_mwa_fhd_decompose (mwa_beam_1ppd ):
199+ @pytest .mark .parametrize (
200+ ["approach" , "inplace" ],
201+ [
202+ ("decompose" , None ),
203+ ("separate" , True ),
204+ ("separate" , False ),
205+ ("joint" , True ),
206+ ("joint" , False ),
207+ ],
208+ )
209+ def test_mwa_fhd_decompose (mwa_beam_1ppd , approach , inplace ):
200210 mwa_beam = mwa_beam_1ppd
201211 # select to above the horizon
202212 mwa_beam .select (axis2_inds = np .nonzero (mwa_beam .axis2_array <= np .pi / 2 ))
203213
204214 small_za_ind = np .nonzero (np .isclose (mwa_beam .axis2_array , 2.0 * np .pi / 180 ))
205215
206- firesp , fproj = mwa_beam .decompose_feed_iresponse_projection ()
207-
216+ if approach == "decompose" :
217+ firesp , fproj = mwa_beam .decompose_feed_iresponse_projection ()
218+ elif approach == "joint" :
219+ rets = mwa_beam .efield_to_feed_projection (
220+ return_feed_iresponse = True , inplace = inplace
221+ )
222+ if inplace :
223+ firesp = rets
224+ fproj = mwa_beam
225+ else :
226+ firesp = rets [1 ]
227+ fproj = rets [0 ]
228+ else :
229+ mwa_beam2 = mwa_beam .copy ()
230+ ret0 = mwa_beam .efield_to_feed_iresponse (inplace = inplace )
231+ ret1 = mwa_beam2 .efield_to_feed_projection (
232+ return_feed_iresponse = False , inplace = inplace
233+ )
234+ if inplace :
235+ firesp = mwa_beam
236+ fproj = mwa_beam2
237+ else :
238+ firesp = ret0
239+ fproj = ret1
240+
241+ # feed I response should have a real component that is positive near zenith
208242 assert np .all (firesp .data_array [0 , :, :, small_za_ind ].real > 0 )
209243
210244 az_array , za_array = np .meshgrid (mwa_beam .axis1_array , mwa_beam .axis2_array )
211245
246+ # MWA fproj is pretty similar to dipole_fproj up to mutual coupling effects
212247 dipole_beam = ShortDipoleBeam ()
213248
214249 dipole_fproj = dipole_beam .feed_projection_eval (
@@ -218,7 +253,6 @@ def test_mwa_fhd_decompose(mwa_beam_1ppd):
218253 )
219254 dipole_fproj = dipole_fproj .reshape (2 , 2 , mwa_beam .Naxes2 , mwa_beam .Naxes1 )
220255
221- # MWA fproj is pretty similar to dipole_fproj up to mutual coupling effects
222256 # they are very similar near zenith
223257 fproj_diff = fproj .data_array [:, :, 0 ] - dipole_fproj
224258
0 commit comments