I put TR and tr_divs as parameters, instead of fixed values in the function, this allows others to specify different levels of TR and level of resolution for different fMRI data.
I removed most of the loading lines in the function, and left convo_response.py as a collection of utility functions that we can use to run the the convo_response_scripy.py to get our results. This way, our function could be used on different dataset, not just our own, making it more reproducible.
I also changed the name of the convo-response to lower dash convo_response, the center dash caused problems for me when I run the code, so I think a lower dash is better to eliminate the confusion.
I added parameters and return value comments in each of the functions to explain what each of the function does.
I removed the get_n_voxel function, this is unnecessary, we can simply run the script.
In the rescale_cond function, it should not be n_voxel, it's not the number of voxels we are using, it's the number of TRs, or the number of volumes we are using. But you have the input right, its data.shape[-1]
Other than things above, the plots and results are verified to be correct, and I leave them as they are now.
A few things to note:
Other than things above, the plots and results are verified to be correct, and I leave them as they are now.