Skip to content

Commit

Permalink
show a verbose error when not finding pineappl fktables
Browse files Browse the repository at this point in the history
  • Loading branch information
scarlehoff committed Nov 13, 2023
1 parent 7e74f26 commit 7f06c4b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion validphys2/src/validphys/pineparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
The FKTables for pineappl have ``pineappl.lz4`` and can be utilized
directly with the ``pineappl`` cli as well as read with ``pineappl.fk_table``
"""
import logging

import numpy as np
import pandas as pd

from validphys.commondataparser import EXT, TheoryMeta
from validphys.coredata import FKTableData

log = logging.getLogger(__name__)


class GridFileNotFound(FileNotFoundError):
"""PineAPPL file for FK table not found."""
Expand Down Expand Up @@ -195,7 +199,15 @@ def pineappl_reader(fkspec):
"""
from pineappl.fk_table import FkTable

pines = [FkTable.read(i) for i in fkspec.fkpath]
pines = []
for fk_path in fkspec.fkpath:
try:
pines.append(FkTable.read(fk_path))
except BaseException as e:
# Catch absolutely any error coming from pineappl, give some info and immediately raise
log.error(f"Fatal error reading {fk_path}")
raise e

cfactors = fkspec.load_cfactors()

# Extract metadata from the first grid
Expand Down

0 comments on commit 7f06c4b

Please sign in to comment.