pybids
pybids copied to clipboard
variables: Add sparse/dense mode for to to_df, and add alternative design matrix API to access sparse variables
https://github.com/bids-standard/pybids/blob/f4bf70cccaf85dc65f2b610f448d141c014562d9/bids/variables/collections.py#L610-L620
to_df casts everything to dense, which is a problem for the HRF property of BSM.
To be able to hand off HRF convolution to another program we need to be able to output sparse variables seperately from dense variables.
We need to add a mode that separate dense/sparse, and a different way of accessing the design matrix (aside from .X).
@jmumford also requests this in order to look at the unconvolved regressors for model inspection
This is actually more complex than it looks, because BIDSStatsModelsNodeOutput would need to keep in parallel both dense and sparse parts of the DM, so all logic downstream (i.e. handling intercept, expanding wild cards, etc), would have to be refactor to handle keeping the DM split.