def center_fov(lon, lat): # We assume here that any non-finite and non-sensible values have already # been filtered out lon = u.Quantity(lon, u.deg, copy=False) lat = u.Quantity(lat, u.deg, copy=False) unit_sph = UnitSphericalRepresentation(lon, lat, copy=False) cen = unit_sph.mean() sep = angular_separation(lon, lat, cen.lon, cen.lat).to(u.deg).value.max() return cen.lon.to(u.deg).value, cen.lat.to(u.deg).value, sep
def center_fov(lon, lat): # We need to filter out any non-finite values keep = np.isfinite(lon) & np.isfinite(lat) lon, lat = lon[keep], lat[keep] lon = u.Quantity(lon, u.deg, copy=False) lat = u.Quantity(lat, u.deg, copy=False) unit_sph = UnitSphericalRepresentation(lon, lat, copy=False) cen = unit_sph.mean() sep = angular_separation(lon, lat, cen.lon, cen.lat).to(u.deg).value.max() return cen.lon.to(u.deg).value, cen.lat.to(u.deg).value, sep