Skip to content

Problem with the Python Wrapper #630

@MicheleSantoni

Description

@MicheleSantoni

Good afternoon,
I am compiling the python wrapper for HI_CLASS to call its features for modified gravity on another script in Python.
However, each time I do all the procedure it creates a library which has only the CLASS functions or, at least, they do not coincide with the functions in the file.ini: (as an easy example)

import classy
from classy import Class
print('Check for the classy library')
print("USING CLASSY FROM:", classy.__file__)
print(Class.__doc__)

cosmo = Class()
cosmo.set({
    'gravity_model': 'propto_omega',
    'parameters_smg': 'alpha_K, alpha_B',
    'alpha_K': 0.1,
    'alpha_B': 0.05,
    'output': 'mPk',
})
cosmo.compute()

Check for the classy library
USING CLASSY FROM: /path/to/ ... /hi_class_public/python/build/lib.linux-x86_64-cpython-311/classy.cpython-311-x86_64-linux-gnu.so

Class wrapping, creates the glue between C and python

The actual Class wrapping, the only class we will call from MontePython
(indeed the only one we will import, with the command:
from classy import Class

Traceback (most recent call last):
File "/home/cptsu4/santoni/home_cpt/Home_CPT/hi_class_public/python/test.py", line 20, in
cosmo.compute()
File "classy.pyx", line 376, in classy.Class.compute
raise CosmoSevereError(
classy.CosmoSevereError:

Error in Class: Class did not read input parameter(s): gravity_model, parameters_smg, alpha_K, alpha_B

I suppose the problem is in how I generate the wrapper, but I can not manage to solve it.

Thanks for the time and the patience.

Best regards,
MS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions