So I ran into some roadblocks over the past couple days while getting density catalogues. Reviewing the code caused me to realize an issue, which upon fixing resulted in a different 2D distribution. I’ve included how I get the number of galaxies within 126 pixels, as well as the distance to the 5th nearest neighbour for random points. This is AFTER fixing the code, but a sanity check would be great!
#c is a skycoord object containing all galaxies from the CLAUDS catalog with i < 24.5
#r_u is a skycoord object with all the random point locations (100000 of them)
for i in range(0, len(r_u)):
coord = r_u[i]
# The sum of nearby should give me the number of objects (since it becomes a truth array)
nearby = c.separation(coord) < (126 * 0.168) * u.arcsec
# Get the 5th nearest neighbor by getting the index and then checking the separation distance (a slightly roundabout way but should work)
nearest_neighbors = coord.match_to_catalog_sky(c, nthneighbor=5)
nn = c[nearest_neighbors[0]]
sep = nn.separation(coord).arcsec
rows.append([(r_u[i].ra * u.deg).value, (r_u[i].dec * u.deg).value, sum(nearby), sep])
The updated 2D histogram, as well as the same plot with the clusters from Angelo’s catalogue overlaid, look like this:
As you can see you get this strange bow-tie shape, but there definitely seems to be a more defined distribution than before. The reason for that empty space on the bottom left is a consequence of how I get the values. You can’t have a position of the 5th nearest neighbour below 21 arcseconds (126 pixels) if you have less than 5 objects within that space.
There are still bugfixes to be done on the simulation code. An initial attempt to run the code on Cedar (with the now-incorrect catalogues) failed unfortunately, and I’m still looking into why. I had to retool the code quite a bit to use a density catalogue instead of picking images at random, and while it worked in tests I wasn’t entirely confident that I would have results by our next meeting.
That being said, much of the code is in place to quickly remake the density catalogues if there are issues. I also wrote some code to match these positions with the COSMOS coverage map, meaning getting the required positions is a simple exercise. I am still working on making a system that allows you to manually select which profiles it extracts (for the benefit of time), but it is definitely giving me trouble.
I also wrote some code to generate some cutouts, which can be seen below. I selected three bins (left and upper, middle, and lower right), and grabbed cutouts from them. There doesn’t seem to be much difference visually (after fixing up the code) so perhaps there are some bugs that need to be found.

I have an idea to rectify this though, at least for the technical paper. Since we are running sims, why don’t we simulate regions of different densities? Since we have KDEs, we could make a simulated background and add galaxies at random (using 2D Sersic profiles). I’ve done this sort of testing before, so it should not be very difficult. Another advantage to this is that we can simulate regions that won’t be found in COSMOS (such as, say, hyper-dense environments that are beyond the scope of the density KDEs I get for COSMOS).
UPDATE: Here is the 2D KDE (after cleaning up the code) with both the Camira clusters as well as the spectroscopic clusters chosen from the BCGs. I was able to speed up the the process of getting the 5th nearest neighbour, but wasn’t able to find a method to quickly get the number of objects within a given distance. As for the plot, looks like the x-ray clusters have greater numbers towards the bottom of the plot (as expected), but there is still a distribution. Maybe those groups have low numbers? If you have a group of 4 galaxies tightly clustered but isolated, the distance to the 5th nearest neighbour will be high.


