Well that was easier than I expected
Coming back to it after a couple of days, an hours reading and figuring out what’s going on in the code, I have something that appears to work, with only a very very minor change:
I’ve taken a verbatim copy of compute_log_likelihood and changed one line
from
if not set(observed_vars).issubset(model.observed_RVs):
to
if not set(observed_vars).issubset(model.observed_RVs + model.potentials):
and then call it like this to operate on the relevant potential in my model ('pot_y_cop')
mdl.idata.add_groups(dict(log_likelihood=compute_log_likelihood_for_potential(
idata=mdl.idata, var_names=['pot_y_cop'], model=mdl.model,
extend_inferencedata=False)))
… Seems to be job done!