From 489075e56637d4138ba87b0ef18c9b5029586a93 Mon Sep 17 00:00:00 2001 From: Matthew Kolopanis Date: Tue, 14 Nov 2023 11:31:25 -0700 Subject: [PATCH] force dtypes to match on uvcal inits, otherwise you get floats --- pyuvdata/uvcal/initializers.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pyuvdata/uvcal/initializers.py b/pyuvdata/uvcal/initializers.py index 08f5dd86d2..d70624ada1 100644 --- a/pyuvdata/uvcal/initializers.py +++ b/pyuvdata/uvcal/initializers.py @@ -478,10 +478,19 @@ def new_uvcal_from_uvdata( "ant_array", np.union1d(uvdata.ant_1_array, uvdata.ant_2_array) ) + # Just in case a user inputs their own ant_array kwarg + # make sure this is a numpy array for the following interactions + if not isinstance(ant_array, np.ndarray): + ant_array = np.asarray(ant_array) + if antenna_numbers is not None: - ant_array = np.intersect1d(ant_array, antenna_numbers) + ant_array = np.intersect1d( + ant_array, np.asarray(antenna_numbers, dtype=ant_array.dtype) + ) elif isinstance(antenna_positions, dict): - ant_array = np.intersect1d(ant_array, list(antenna_positions.keys())) + ant_array = np.intersect1d( + ant_array, np.asarray(list(antenna_positions.keys()), dtype=ant_array.dtype) + ) if jones_array is None: if np.all(uvdata.polarization_array < -4):