firecrown icon indicating copy to clipboard operation
firecrown copied to clipboard

Trying to load sacc_file not in hdf5 is raising an AttributeError

Open bruno-moraes opened this issue 1 month ago • 1 comments

Describe the bug I have a sacc file containing synthetic Cells generated from a separate pipeline. It used to open with the load_sacc_data function without any issues. I then upgraded my firecrown version to 1.15.0a0 and now this same call raises an AttributeError.

To Reproduce Steps to reproduce the behavior:

  1. Get the sacc file from: firecrown/tests/legacy_sacc_data.fits

  2. Run:

from firecrown.likelihood.factories import load_sacc_data
load_sacc_data("legacy_sacc_data.fits")
  1. Error:
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[5], line 1
----> 1 load_sacc_data("sacc_Forecasting_Y1_3x2pt_Strawberry.sacc")

File ~/lib/python/firecrown/firecrown/likelihood/factories.py:61, in load_sacc_data(filepath)
     59 hdf5_error = None
     60 try:
---> 61     return sacc.Sacc.load_hdf5(str(file_path))
     62 except OSError as e:
     63     hdf5_error = e

AttributeError: type object 'Sacc' has no attribute 'load_hdf5'

Expected behavior Since this is not in hdf5 format, I would expect the except clause to catch this AttributeError and move to the next try clause that opens the file in fits format.

Observed behavior The try clause doesn't catch this particular error, because it is only catching OSError

Configuration: Please include all relevant information about your configuration:

  • Firecrown version: 1.15.0a0 ( branch: bin_combinations f2b8511)
  • Installation method: developer version
  • conda list | grep firecrown: firecrown 1.12.0a0 pypi_0 pypi
  • OS and Version: macOS M1 Pro Sequoia 15.6 arm64
  • Python 3.13.9

bruno-moraes avatar Nov 06 '25 17:11 bruno-moraes

Issue solved. @vitenti identified that I had updated the firecrown version in developer mode without updating the conda environment. Running conda env update -f environment.yml --prune solved the issue.

It might be a good idea to have a way to tell the user that they have an outdated environment.

bruno-moraes avatar Nov 06 '25 17:11 bruno-moraes