Closed JelleAalbers closed 6 years ago
Thanks @JelleAalbers ! It looks nice from my side. I'll merge it unless there is objections or planned change
Sounds good, thanks! I added a small change earlier today that fixes a similar rare error related to empty dataframes, but if I find more I will make a new PR.
This changes hax.cuts.apply_lichen to skip the lichen evaluation when the dataframe is empty.
Lax's lichens crash when run on empty dataframes. If you do e.g.
lax.lichens.sciencerun1.AllEnergy().process(df.iloc[:0])
, where df is any normal dataframe, you will get an error like this:ValueError: cannot set a frame with no defined index and a scalar
. The problem seems to come from setting new columns on dataframes (in certain ways?) -- which lax, and individual lichens, do in several places.Empty dataframes arise in practical usage in two ways:
make_minitrees = False
and lichen preselections (see #229). If a minitree is missing,make_minitrees = False
causes hax to return an empty dataframe for that run. Since lichen preselections are evaluated run by run, this means lichens get an empty dataframe.It might be possible to fix this on lax' end, however: