I'm trying to modify CAMB 1.5.6 and add a new fluid to the code, which has a specific equation of state and Omega. I think I handled the Fortran part correctly (but I could be wrong). My problem is with the Python interface. I'm not exactly sure where to make the changes. I've made some modifications to camb.py (line 245) and model.py (lines 197, 430, 502), but when I try to run the code, I have to include my new Omega (I also can't give it a zero value or anything below 0.001) in the .set_cosmology(), or it gives me this error:
Code: Select all
CAMBError Traceback (most recent call last)
Cell In[1], line 12
9 pars.InitPower.set_params(As=2e-9, ns=0.965)
11 # Calculate results
---> 12 results = camb.get_results(pars)
14 # Get the power spectra
15 powers = results.get_cmb_power_spectra(pars)
File ~/anaconda3/lib/python3.10/site-packages/camb-1.5.6-py3.10-linux-x86_64.egg/camb/camb.py:37, in get_results(params)
35 if _debug_params:
36 print(params)
---> 37 res.calc_power_spectra(params)
38 return res
File ~/anaconda3/lib/python3.10/site-packages/camb-1.5.6-py3.10-linux-x86_64.egg/camb/results.py:336, in CAMBdata.calc_power_spectra(self, params)
329 """
330 Calculates transfer functions and power spectra.
331
332 :param params: optional :class:`~.model.CAMBparams` instance with parameters to use
333
334 """
335 if params is not None:
--> 336 self.calc_transfers(params, only_transfers=False)
337 else:
338 self._check_powers()
File ~/anaconda3/lib/python3.10/site-packages/camb-1.5.6-py3.10-linux-x86_64.egg/camb/results.py:318, in CAMBdata.calc_transfers(self, params, only_transfers, only_time_sources)
315 self._check_powers(params)
316 if CAMBdata_gettransfers(byref(self), byref(params), byref(c_int(1 if only_transfers else 0)),
317 byref(c_int(1 if only_time_sources else 0))):
--> 318 config.check_global_error('calc_transfer')
File ~/anaconda3/lib/python3.10/site-packages/camb-1.5.6-py3.10-linux-x86_64.egg/camb/_config.py:51, in _config.check_global_error(self, reference)
49 reference = ''
50 if err:
---> 51 raise CAMBError(reference + '%s' % err)
52 else:
53 raise CAMBError(reference + 'Error code: %s' % code)
CAMBError: Error in Fortran called from calc_transfer:
ThemoData Init: failed to find end of recombination
Thank you.