Hello Dr. Lewis.

I reproduced the warning once more, it seems that it's tied to changing of cosmological parameters, which is necessary for me because I need to take derivatives in order to compute Fisher matrices.

The example below won't run as is without two more modules, and I apologize for that but I feared the example would get too convoluted to be understandable. I attempted to attach the files to this post, but it says the files are invalid. I can share them over email if it would help.

Code: Select all

```
import camb
print "Using CAMB version", camb.__version__
print "Located at", camb.__file__
import copy
#this is just a dictionary with values of the Planck 2018 cosmological parameters
from planck2018 import cosmology as fiducial_cosmology
#this modifies the dictionary to change the cosmology slightly
import cosmology_modifier
#cosmological_parameters = ['w_b', 'w_DM', 'tau', 'n', 'ln10As', 'mnu', 'nnu', 'omega_lambda_0']
lmax = 8000
def getCAMBpars( cosmology, lmax ):
'''
Given a cosmology, sets parameters for CAMB and returns a CAMBdata instance.
'''
pars = camb.CAMBparams()
#set cosmology
pars.set_cosmology(H0=cosmology['h']*100.0, ombh2=cosmology['w_b'], omch2=cosmology['w_DM']\
, omk=cosmology['omega_k_0'], num_massive_neutrinos=cosmology['num_massive_neutrinos'],\
mnu=cosmology['mnu'], nnu=cosmology['nnu'], meffsterile=cosmology['meffsterile'],\
standard_neutrino_neff=cosmology['standard_neutrino_neff'], tau=cosmology['tau']\
, TCMB = cosmology['Tcmb']/(1.0E6) )
pars.InitPower.set_params(As=cosmology['As'], ns=cosmology['n'])
pars.set_nonlinear_lensing(True)
pars.set_for_lmax(lmax, lens_potential_accuracy=1);
return pars
def get_TP_Cl( cambresults, cosmology, lmax ):
#give CAMB the cosmology, which might be slightly different from the cosmology the results were built from
cambpars = getCAMBpars( cosmology, lmax )
#get the power spectrum you want, without recalculating cambresults
powers = cambresults.\
get_cmb_power_spectra(cambpars, lmax=lmax, spectra=['total', 'unlensed_scalar'], CMB_unit='muK', raw_cl=True)
return powers
fiducial_cambpars = getCAMBpars( fiducial_cosmology, lmax )
cambresults = camb.get_results( fiducial_cambpars )
#get CMB T and E spectra for fiducial cosmology
cl = get_TP_Cl( cambresults, fiducial_cosmology, lmax )
#return to fiducial cosmology
perturbed_cosmology = copy.deepcopy( fiducial_cosmology )
#modify dimensionless baryon density in Hubble units
cosmology_modifier.modify_cosmology\
( perturbed_cosmology, fiducial_cosmology, 'w_b', cosmology_modifier.POSITIVE_STEP, keep_flatness = False)
#get CMB T and E spectra for slightly modified cosmology
cl = get_TP_Cl( cambresults, perturbed_cosmology, lmax )
#return to fiducial cosmology
perturbed_cosmology = copy.deepcopy( fiducial_cosmology )
#modify amplitude of primordial fluctuations
cosmology_modifier.modify_cosmology\
( perturbed_cosmology, fiducial_cosmology, 'ln10As', cosmology_modifier.POSITIVE_STEP, keep_flatness = False)
#get CMB T and E spectra for slightly modified cosmology
cl = get_TP_Cl( cambresults, perturbed_cosmology, lmax )
#return to fiducial cosmology
perturbed_cosmology = copy.deepcopy( fiducial_cosmology )
#modify optical depth to reionization
cosmology_modifier.modify_cosmology\
( perturbed_cosmology, fiducial_cosmology, 'tau', cosmology_modifier.POSITIVE_STEP, keep_flatness = False)
#get CMB T and E spectra for slightly modified cosmology
cl = get_TP_Cl( cambresults, perturbed_cosmology, lmax )
#return to fiducial cosmology
perturbed_cosmology = copy.deepcopy( fiducial_cosmology )
#modify dimensionless dark matter density in Hubble units
cosmology_modifier.modify_cosmology\
( perturbed_cosmology, fiducial_cosmology, 'w_DM', cosmology_modifier.POSITIVE_STEP, keep_flatness = False)
#get CMB T and E spectra for slightly modified cosmology
cl = get_TP_Cl( cambresults, perturbed_cosmology, lmax )
```

In short, what I'm doing is giving CAMB the cosmological parameter values from the best fit cosmology of Planck 2018. I then calculate CMB T and E power spectra for this fiducial cosmology. (no warnings up to this point)

Then I increase

[math]\omega_b by 0.1% and recalculate the power spectra. I use a camb.results instance so not everything has to be recalculated, but I do inform CAMB of the modified cosmology. The warnings appear here.

I then return to the fiducial cosmology and now modify

[math]A_s, and I get no warnings. I also don't get any warnings in the next step when I modify

[math]\tau but the warnings appear again when I change

[math]\omega_{DM}.

I'm afraid I don't understand this behavior.

I appreciate your assistance.

Felipe Maldonado