simonsobs / LAT_MFLike

Multifrequency Likelihood for SO Large Aperture Telescope
https://lat-mflike.readthedocs.io
Other
4 stars 12 forks source link

mflike-plik branch: import is broken #78

Open JesusTorrado opened 4 months ago

JesusTorrado commented 4 months ago

Hi,

We are reimplementing the way Cobaya deals with external likelihoods, to gain some new features, such as automatic installation with a simple mention in the input file. I was starting by adding the external likelihoods which are already in https://cobaya.readthedocs.io/en/latest/likelihood_external.html#list-of-external-packages

Among them, there is a reference to a class implemented in the mplike-plik branch. The installation in that case works, but it throws an error at importing, breaking the workflow of the installer:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/jesus/projects/coco/venv/lib/python3.11/site-packages/plikmflike/__init__.py", line 1, in <module>
    from .plikmflike import PlikMFLike
  File "/home/jesus/projects/coco/venv/lib/python3.11/site-packages/plikmflike/plikmflike.py", line 339, in <module>
    ksz = fgc.FactorizedCrossSpectrum(fgf.ConstantSED(), fgp.kSZ_Planck())
                                                         ^^^^^^^^^^^^^^^^
  File "/home/jesus/projects/coco/venv/lib/python3.11/site-packages/plikmflike/fgspectra/power.py", line 105, in __init__
    spec = np.genfromtxt(_get_power_file('ksz_planck'))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jesus/projects/coco/venv/lib/python3.11/site-packages/plikmflike/fgspectra/power.py", line 24, in _get_power_file
    raise ValueError('No template for model '+filename+' found in ' + str(data_path) + ' ls: ' + str(os.listdir(data_path)))
                                                                                                     ^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: './plikmflike/fgspectra/data/'

I reckon it has to do with data files not being included, as specified in the README, but the error should be thrown at instantiation, not at import, don't you think?

In any case, does it make sense to add this likelihood (the one in the mflike-plik branch) to the new list, or will it be superseded soon by a new version?

xgarrido commented 4 months ago

I assign this issue to @HTJense since he is the author of this branch and likelihood.