def boolean_to_scatter(bool_array, x_array, y_array): y_indices, x_indices = np.where(bool_array) scatter_x = x_array[x_indices] scatter_y = y_array[y_indices] return scatter_x, scatter_y