lesgourg / class_public

Public repository of the Cosmic Linear Anisotropy Solving System (master for the most recent version of the standard code; GW_CLASS to include Cosmic Gravitational Wave Background anisotropies; classnet branch for acceleration with neutral networks; ExoCLASS branch for exotic energy injection; class_matter branch for FFTlog)
223 stars 291 forks source link

CMB maps #201

Open JavierOrjuela opened 6 years ago

JavierOrjuela commented 6 years ago

Hi, I have modified CLASS code and I want to analyse the information through the maps instead the power spectrum. Working on CAMB code, we have an option in which we can get not only the Cl's data, but also the .FITS. So, I would like to ask you how can I get the maps given the information received from CLASS code. Thanks.

ThomasTram commented 6 years ago

Hi

You can create a representation of the skymap from the Cl's using Healpix. It is probably easiest to do it from Python using the healpy package:

import healpy as hp
cosmo = Class()
cosmo.set({'output':'tCl'})
cosmo.compute()
cl = cosmo.raw_cl()
m = hp.synfast(cl['tt'][2:]*2700**2,100,2200,new=True,sigma=0.005)
hp.mollview(m, coord=['G','E'], title='Histogram equalized Ecliptic', unit='mK', norm='hist', xsize=2000)
hp.graticule()
plt.set_cmap('jet')

You can store the map to a .fits file using hp.write_map(filename, m[, nest, dtype, ...]). image

By the way, I smoothed the map a bit and restricted it to lmax=2200. You should modify these settings for your need.

Cheers, Thomas