-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Add support for experimental design aggregation #724
base: master
Are you sure you want to change the base?
Conversation
transformations were previously not applied unless they were defined in the default transformations
We had another think about names for the tool (or pybids subcommand if I can figure our a nice way to add it without becoming too entwined... but we can discuss
Some other ideas that were thrown out though...
|
|
This is to say: Thanks for this! I haven't been able to review it today. I'll have a look tomorrow before the wrap-up. |
Ooh I love this.
Sounds good. Thanks |
Add tests and add support for: Model jsons with transformations Transformation jsons Python in memory representations of the above
Is there a draft of a transformations spec somewhere? I suspect my json parsing is a little off... This is what we will currently support: pybids/bids/variables/tests/test_io.py Line 116 in a9ae623
My biggest concern is that assuming that the first Node of a model json contains the Transformations is likely incorrect. |
Not yet... Feel free to fork https://docs.google.com/document/d/1F_REhtYTWHBgASV-aoZh9GSV7ZhP0Deg4os4EP7MpM8/edit#heading=h.mqkmyp254xh6 into something. I can work on it this afternoon. |
Here, I dumped just the transformations into a separate document: https://docs.google.com/document/d/1uxN6vPWbC7ciAx2XWtT5Y-lBrdckZKpPdNUNpwRxHoU/edit?usp=sharing |
Note that not all of the transformations in that document are currently implemented in PyBIDS—feel free to remove them from the doc (or, alternatively, to implement them in PyBIDS). |
Thanks, I'll have a look through. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been sitting on these comments too long. I just haven't finished looking through. Overall what I've seen so far makes sense.
setup.cfg
Outdated
@@ -65,6 +65,7 @@ dev = | |||
[options.entry_points] | |||
console_scripts = | |||
pybids=bids.cli:cli | |||
statsmodels-design-synthesizer=bids.statsmodels_design_synthesizer:main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All CLIs should be moved under bids.cli
. This could be bids.cli.statsmodels_design_synthesizer:main
or become a subcommand of pybids
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i've moved this to cli now. I think it should be a subcommand. I don't know my way around click well enough to add this quickly.
Moving the cli test from test_morphing_time will require duplicating some of the data setup code, moving said code to a fixture in conftest.py, or mocking the call to morphing_time (tricky because it needs to be mocked on the other side of a system call, run.py could possibly help but might be too complicated).
bids/tests/data/ds005/models/ds-005_type-convolution_model.json
Outdated
Show resolved
Hide resolved
"GroupBy": [ | ||
"subject", | ||
"contrast" | ||
] | ||
}, | ||
{ | ||
"Source": "participant", | ||
"Destination": "by-group", | ||
"GroupBy": [ | ||
"sex" | ||
] | ||
}, | ||
{ | ||
"Source": "participant", | ||
"Destination": "group-diff", | ||
"GroupBy": [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GroupBy should now be in the nodes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Shotgunosine could you look at this one.
bids/tests/data/ds005/models/ds-005_type-convolution_model.json
Outdated
Show resolved
Hide resolved
bids/tests/data/ds005/models/ds-005_type-convolution_model.json
Outdated
Show resolved
Hide resolved
Correct management of intercept in model file containing convolution.. Make t-test "Test" not type. Co-authored-by: Chris Markiewicz <markiewicz@stanford.edu>
Ideally morphing-time should be a subcommand. Moving morphing-time cli test to test_cli requires a little thinking.
no worries. This is more downstream of the spec and flow stuff then I realized. Thanks for taking a look. |
@effigies, @tyarkoni
Overall this looks like a nice way to support downstream users of the stats-model spec. @Shotgunosine and myself have implemented a simple command line tool that, for a given bids run (I likely mean something more precise like combination of factor levels at the first-level modeling), writes out the appropriate transformed variables (dense and sparse) of the design matrix to tsv files as well as the fully assembled design matrix (currently using the pybids HRF for convolution). In summary, this a CLI that wraps the transformations logic of pybids; pybids will continue to directly access said logic using python to reduce file IO.
Our external prototype (which extracted the time series transformation logic of pybids) revealed some dependence on bids variables/variable collections that makes that option impossible for now (it would result in cyclic import dependencies). If it is reasonable to pull the above classes along with the transformations modules, a hypothetical standalone package could be called bids-timeseries or something like that and provide a way of doing transformations with the various experimental time-series without the bids entities/metadata collection logic of pybids. Such encapsulation could conceivably be valuable. This would be a longer term goal and external contributors would likely be needed to drop the dependencies of such a package though (numpy and pandas currently making the required time-series operations a lot easier than using the python standard library... resampling time series, convolutions etc would be unpleasant to write from scratch). @afni-rickr thoughts/burning desire to contribute said lower level implementation welcome.
Myself and @Shotgunosine are going to make a final push on this today. Any feedback would be much appreciated. Here's the current TODO list.
Feedback would be most valuable here:
Some other implementation details that we can handle: