Fix gen design - #381
Conversation
…l-zero time series is directly generated
…, which shortens stim_function if its length is smaller than the product of total_time and temporal_resolution
…ple there is no reason to use floor. And in practice, due to precision of float number computation, this can sometime result in a smaller count of number of TRs. As long as the user provide the correct total_duration
|
@lcnature, would you like me to go over it now? |
|
@CameronTEllis That would be awesome. One change I made was in fmrisim.py, which especially needs your eyes on it in case I make new bugs. And then I realized that the conditional clause in |
| # Store the weights | ||
| stimfunction[onset_idx:offset_idx, 0] = [weights[onset_counter]] | ||
|
|
||
| # Shorten the data if it's too long |
There was a problem hiding this comment.
Good point, this is unnecessary as you say
| for duration in scan_duration] | ||
| else: | ||
| design = [np.empty([int(np.floor(scan_duration / TR)), n_C])] | ||
| design = [np.empty([int(np.round(scan_duration / TR)), n_C])] |
| scan_duration=[48], TR=2, style='AFNI') | ||
| assert np.all(design7 == 0.0), ( | ||
| 'A negative stimulus onset of AFNI style should result in an all-zero' | ||
| + ' design matrix') |
There was a problem hiding this comment.
Good extra test to have
It was designed that an AFNI style stimulus timing onset file with a negative onset can result in an all-zero design matrix, but this actually raised error. This PR fixes it.