Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Working with lightcone data - maps and objects

This tutorial compares lightcone halos around redshift 1.45 to a projected density map over the same redshift range, both with visual inspection and a more quantitative correlation coefficent.

  • Visualize the particle density in a map

  • Visualize the halo density in a lightcone catalog

  • Compute the correlation coefficient to see how these compare

Data Lightcone Catalogs and Maps
Tasks Spatial Operations Visualization

We start with loading important libraries. These include numpy, matplotlib, scipy and astropy. For working with map-based data we add healpy and healsparse. I also include one additional library not included in the opencosmo environment, which is treecorr, to compute the correlations for the correlation coefficient.

The API for the map class can be found here, but let’s play around with it a bit.

First let’s read in the density map, and have a look at some of the more important properties. In particular we should look at the resolution (nsiden_{\rm{side}} in Healpix notation), and make sure your machine has enough memory to look at maps like this. If not we can downgrade with the

ds_map.with_resolution(new_nside)

command, which will downgrade and update the metadata accordingly

{'rho': 'Total matter density in shell'} 

resolution is nside =  4096 

redshift range =  (1.405457156534227, 1.4814814814814818) 

ordering =  NESTED 

cosmology =  FlatLambdaCDM(H0=67.66 km / (Mpc s), Om0=0.3096446816186967, Tcmb0=0.0 K, Neff=3.04, m_nu=None, Ob0=0.04897468161869667)

Loading the map

To load the data we use the get_data command as usual, but this time we have the option of “healpix”, which returns the data as a numpy array, or “healsparse” which returns it as a healpix sparse map. Looking at this you can see that the values are pretty high! This is because the units are in solar masses per steradian divided by little h, which gives pretty extreme numbers.

<Figure size 1050x540 with 6 Axes>

Small cutouts

If we want to zoom in to a specific area around a halo we can do that using the cone search method and it returns a healsparse map that we can look at. You can treat it as a normal HealSparse map and use the native healsparse methods at this point. I’m going to quickly visualize the cutout area.

<Figure size 400x400 with 1 Axes>

Reading in the halos

I’ve queried the halo lightcone data on the same redshift slice as the map is built on so we can directly compare the two. We don’t natively have an RA or dec column, so we’ll start by creating one using the with_new_colums method. See the full details of creating new columns here: https://opencosmo.readthedocs.io/en/stable/cols.html.

Inspecting the halos and map

We can then apply the exact same selection we made to the map, and create a histogram of the halos to compare to our density map. Side by side they look pretty similar!

<Figure size 800x400 with 2 Axes>

Cross-correlating the overdensity and the halo data

We can quantify this by cross-correlating these maps using treecorr. We first need to create a set of randoms to compare to the halo objects. We’re just going to create a rectangle then cut it using the same method that opencosmo uses under the hood.

And then we can create the treecorr catalogs. We’re converting the map into an overdensity to get rid of those pesky large numbers, and limiting ourselves to small-ish scales that are covered by the mask.

Results

We can see how correlated these fields are using the correlation coefficient. They’re not absolutely perfect (halos and dark matter particles aren’t exactly the same after all), but the correlation is pretty high as you’d expect.

This is a rough method designed to demonstrate working with the lightcone data in a practical way, so please don’t hold it against me if this field is too small or the mask too weird for an arbitrary correlation measurement! However we can now quantitatively say that our eyes were not lying to us and these fields are pretty similar :)

<Figure size 640x480 with 1 Axes>