A usage question about Python sorting code

Hello everyone, I am using the code below to extract the coordinates on the circumference (facet_coordinates) and the indices (boundary_vertices). However, I encountered a very strange error during sorting: my expected result is that the x coordinates are in ascending order (this requirement can be fulfilled); if the x coordinates are the same, the y coordinates should be in ascending order (but the result I got for this requirement was descending order for the y coordinates). However, when I print facet_coordinates and define it directly, I get the correct result. I have not been able to find the reason behind this issue and hope to receive some help.

# Obtain the vertex coordinates and indices on the circumference, and then sort them.
import dolfinx
import joblib
import numpy as np
from mpi4py import MPI
from dolfinx.io import gmshio
# obtain coordinates on boundary
mesh, cell_markers, facet_markers = gmshio.read_from_msh("m.msh", MPI.COMM_WORLD, gdim=2)
facets = facet_markers.find(14)
send_coordinates = []
# Calculate all the coordinates
coordinates = mesh.geometry.x
# Obtain the indices of the boundary vertices
boundary_vertices = dolfinx.mesh.compute_incident_entities(mesh.topology, facets, mesh.topology.dim-1, 0)
for vertex in boundary_vertices:
    send_coordinates.append(coordinates[vertex])
# Convert the list of coordinates to array
facet_coordinates = np.asarray(send_coordinates).reshape(-1, coordinates.shape[1])
# Sort by x coordinates, and if the x coordinates are the same, sort by y coordinates
sort_idx = np.lexsort((facet_coordinates[:, 1], facet_coordinates[:, 0]))
# Reorder using the sorted position indices
sorted_i = [boundary_vertices[i] for i in sort_idx]
sorted_coordinates = facet_coordinates[sort_idx]
# print results
for (index, coord) in zip(sorted_i, sorted_coordinates):
    print(index, coord)

The incorrect result is as follows (y coordinates in descending order):

132 [-7.12500000e+00 -1.49481173e-14  0.00000000e+00]
123 [-6.77627768  2.20174608  0.        ]
169 [-6.77627768 -2.20174608  0.        ]
105 [-5.76424608  4.18796992  0.        ]
179 [-5.76424608 -4.18796992  0.        ]
133 [-4.18796992  5.76424608  0.        ]
312 [-4.18796992 -5.76424608  0.        ]
145 [-2.20174608  6.77627768  0.        ]
343 [-2.20174608 -6.77627768  0.        ]
197 [-1.06381942e-14  7.12500000e+00  0.00000000e+00]
462 [-7.63711251e-15 -7.12500000e+00  0.00000000e+00]
213 [2.20174608 6.77627768 0.        ]
486 [ 2.20174608 -6.77627768  0.        ]
389 [4.18796992 5.76424608 0.        ]
702 [ 4.18796992 -5.76424608  0.        ]
407 [5.76424608 4.18796992 0.        ]
728 [ 5.76424608 -4.18796992  0.        ]
503 [6.77627768 2.20174608 0.        ]
712 [ 6.77627768 -2.20174608  0.        ]
532 [7.125 0.    0.   ]

Print facet_coordinates and redefine it:

# Convert the list of coordinates to array
facet_coordinates = np.asarray(send_coordinates).reshape(-1, coordinates.shape[1])

# Print facet_coordinates and redefine it
print(facet_coordinates)
facet_coordinates = np.array([
 [-5.76424608e+00,  4.18796992e+00,  0.00000000e+00],
 [-6.77627768e+00,  2.20174608e+00,  0.00000000e+00],
 [-7.12500000e+00, -1.49481173e-14,  0.00000000e+00],
 [-4.18796992e+00,  5.76424608e+00,  0.00000000e+00],
 [-2.20174608e+00,  6.77627768e+00,  0.00000000e+00],
 [-6.77627768e+00, -2.20174608e+00,  0.00000000e+00],
 [-5.76424608e+00, -4.18796992e+00,  0.00000000e+00],
 [-1.06381942e-14,  7.12500000e+00,  0.00000000e+00],
 [ 2.20174608e+00,  6.77627768e+00,  0.00000000e+00],
 [-4.18796992e+00, -5.76424608e+00,  0.00000000e+00],
 [-2.20174608e+00, -6.77627768e+00,  0.00000000e+00],
 [ 4.18796992e+00,  5.76424608e+00,  0.00000000e+00],
 [ 5.76424608e+00,  4.18796992e+00,  0.00000000e+00],
 [-7.63711251e-15, -7.12500000e+00,  0.00000000e+00],
 [ 2.20174608e+00, -6.77627768e+00,  0.00000000e+00],
 [ 6.77627768e+00,  2.20174608e+00,  0.00000000e+00],
 [ 7.12500000e+00,  0.00000000e+00,  0.00000000e+00],
 [ 4.18796992e+00, -5.76424608e+00,  0.00000000e+00],
 [ 6.77627768e+00, -2.20174608e+00,  0.00000000e+00],
 [ 5.76424608e+00, -4.18796992e+00,  0.00000000e+00]
])
# Sort by x coordinates, and if the x coordinates are the same, sort by y coordinates
sort_idx = np.lexsort((facet_coordinates[:, 1], facet_coordinates[:, 0]))
# Reorder using the sorted position indices
sorted_i = [boundary_vertices[i] for i in sort_idx]
sorted_coordinates = facet_coordinates[sort_idx]
# print results
for (index, coord) in zip(sorted_i, sorted_coordinates):
    print(index, coord)

Obtained the correct result:

132 [-7.12500000e+00 -1.49481173e-14  0.00000000e+00]
169 [-6.77627768 -2.20174608  0.        ]
123 [-6.77627768  2.20174608  0.        ]
179 [-5.76424608 -4.18796992  0.        ]
105 [-5.76424608  4.18796992  0.        ]
312 [-4.18796992 -5.76424608  0.        ]
133 [-4.18796992  5.76424608  0.        ]
343 [-2.20174608 -6.77627768  0.        ]
145 [-2.20174608  6.77627768  0.        ]
197 [-1.06381942e-14  7.12500000e+00  0.00000000e+00]
462 [-7.63711251e-15 -7.12500000e+00  0.00000000e+00]
486 [ 2.20174608 -6.77627768  0.        ]
213 [2.20174608 6.77627768 0.        ]
702 [ 4.18796992 -5.76424608  0.        ]
389 [4.18796992 5.76424608 0.        ]
728 [ 5.76424608 -4.18796992  0.        ]
407 [5.76424608 4.18796992 0.        ]
712 [ 6.77627768 -2.20174608  0.        ]
503 [6.77627768 2.20174608 0.        ]
532 [7.125 0.    0.   ]

This is just a set of coordinate data, and I am confident that it has nothing to do with the grid.

The question is not reproducible, and is not about dolfinx (but about numpy). Closing.