square-wave response model (no convolution) by reading stimtimes from a file?

Hello afni gurus,

Is there a straightforward way to build a square-wave response model (no convolution) by reading stimtimes from a file?

I am modeling a number of tasks with a mixed block-event design. Onset and offset of task blocks vary across tasks and subjects. Currently, I am using -stim_times_AM1 blocktimes.txt with ‘dmBLOCK(1)’ to model the sustained signal, and a set of TENT functions to model the transients associated with block onset and offset. But instead of the ramping inherent to the BLOCK() function, I would like to have the sustained model start instantaneously when the transient model returns to baseline, so that all variance at onset/offset is attributed to transient, and so that there’s no ‘gap’ between sustained and transient.

I’ve fooled around with waver (e.g., waver -EXPR “step(t-4)*step(12-t)” -peak 1 | 1dplot -stdin ), but I have not found a way to build a square wave by using waver while reading stimulus times from a file. It would be great if there were a simple way to do this (or a programmatic way to do something similar on the command line); otherwise it’s not the biggest deal.

Thanks for any thoughts y’all have.

Hello,

This post may have gotten lost around Thanksgiving time. Just wondering if you all had any thoughts.

Thanks

One possibility is to create a regressor that specifies the square-wave (e.g., 1s at the time points of square-wave and 0s for the rest) and then feed it to the option -stim_file in 3dDeconvolve.

Hello,

Sorry for being slow to reply.

There might be 2 reasonable ways to do this. But to be sure, if the onset is at time t=0 and the duration is 5s, for example, you are hoping to model a square wave from what, 4-12s?

In any case 3dDeconvolve has an ‘EXPR()’ basis function, though it does not incorporate duration modulation.

To make a simple square wave, consider “timing_tool.py -timing_to_1D”. That gives a lot of control, such as the TR, the fraction of the TR that would lead to a ‘1’ in the output, and varying run lengths. Please see examples 6a, b and c from timing_tool.py -help.

  • rick