`collect` resolves `explicit_node` lazily
This is probably more appropriate for reportengine, but the issue arises in validphys. Consider the following runcard:
dataspecs:
- pdf: NNPDF31_nnlo_as_0118
theoryid: 200
use_cuts: "internal"
dataset_input: {dataset: NMC}
actions_:
- plot_fancy_dataspecs
This errors complaining that covmat is not an array. Taking a look, it's an explicit_node instance. If we look at why, it's because plot_fancy_dataspecs takes as an argument dataspecs_results which is a collection of results over dataspecs:
https://github.com/NNPDF/nnpdf/blob/73058484af2b857523821e59ae62f0a48406e401/validphys2/src/validphys/results.py#L1225
and since https://github.com/NNPDF/nnpdf/pull/1477 was merged, the covariance_matrix is dispatched as an explicit_node and this is the root of the bug. The explicit_node does not get resolved in time by reportengine and so the results objects in the collection don't have the covariance_matrix resolved by the time we hit this line:
https://github.com/NNPDF/nnpdf/blob/73058484af2b857523821e59ae62f0a48406e401/validphys2/src/validphys/dataplots.py#L476
Although, I've just tried running this runcard using the 4.0.0 tag and the same thing happens. But even back then, the covariance matrix was an explicit_node. Has this always been an issue and I'm just using dataspecs incorrectly?
I am confused. Funnily enough this works
def patata(covariance_matrix):
log.error(covariance_matrix)
return None
x = collect("patata", ("dataspecs",))
dataspecs:
- pdf: NNPDF31_nnlo_as_0118
theoryid: 200
use_cuts: "internal"
dataset_input: {dataset: NMC}
actions_:
- x
Could you come up with a minimal example?
...not to mention that we have
def results(dataset: (DataSetSpec), pdf: PDF, covariance_matrix, sqrt_covmat):
and
sqrt_covmat(covariance_matrix)
and sqrt_covmat being fine inside results.
...If I had to bet, I'd say that it is some weirdness going on in config.py rather than a problem with reportengine, but not obvious to me so far either way.
The runcard I posted in the initial post fails for you too right?
Yes it does, but I couldn't readily understand why.