Also a follow-up from #3978 — @mdietze flagged this as a separate issue from the trait_names one #3985
The bigger picture: we need a consistent way to pass priors around the pipeline without each function re-querying BETY. Right now get_trait_data_pft() always calls query.priors. For workflows where priors are already in hand (flat-file inputs, downstream modular calls), that query is wasted work — and it bakes in a BETY dependency on a step that doesn't strictly need it.
What I'm thinking:
Add a prior_distns = NULL parameter. NULL keeps current behavior (query BETY). If the caller passes a data frame in, skip the query and use it directly.
For safety, the input has to be validated — data frame with at least distn, parama, paramb columns, rownames as trait names. Anything else errors clearly.
This doesn't get us to full BETY-independence (we still need BETY for the actual trait observations via query.traits), but it removes one of the BETY hooks from this part of the pipeline. And more importantly, it's the same prior-passing pattern that needs to work across run.meta.analysis.pft and get.parameter.samples in the upcoming Week 2/3 work, so getting it right in one place first makes sense.
Will tackle this after the trait_names issue, both depending on #3978 merging first.
Also a follow-up from #3978 — @mdietze flagged this as a separate issue from the
trait_namesone #3985The bigger picture: we need a consistent way to pass priors around the pipeline without each function re-querying BETY. Right now
get_trait_data_pft()always callsquery.priors. For workflows where priors are already in hand (flat-file inputs, downstream modular calls), that query is wasted work — and it bakes in a BETY dependency on a step that doesn't strictly need it.What I'm thinking:
Add a
prior_distns = NULLparameter. NULL keeps current behavior (query BETY). If the caller passes a data frame in, skip the query and use it directly.For safety, the input has to be validated — data frame with at least
distn,parama,parambcolumns, rownames as trait names. Anything else errors clearly.This doesn't get us to full BETY-independence (we still need BETY for the actual trait observations via
query.traits), but it removes one of the BETY hooks from this part of the pipeline. And more importantly, it's the same prior-passing pattern that needs to work acrossrun.meta.analysis.pftandget.parameter.samplesin the upcoming Week 2/3 work, so getting it right in one place first makes sense.Will tackle this after the
trait_namesissue, both depending on #3978 merging first.