def create_boxcar(aryCnd, aryOns, aryDrt, varTr, varNumVol,<EOL>aryExclCnd=None, varTmpOvsmpl=<NUM_LIT>):
if aryExclCnd is not None:<EOL><INDENT>for cond in aryExclCnd:<EOL><INDENT>aryOns = aryOns[aryCnd != cond]<EOL>aryDrt = aryDrt[aryCnd != cond]<EOL>aryCnd = aryCnd[aryCnd != cond]<EOL><DEDENT><DEDENT>resolution = varTr / float(varTmpOvsmpl)<EOL>aryCnd = np.asarray(aryCnd)<EOL>aryOns = np.asarray(aryOns, dtype=np.float)<EOL>unique_conditions = np.sort(np.unique(aryCnd))<EOL>boxcar = []<EOL>for c in unique_conditions:<EOL><INDENT>tmp = np.zeros(int(varNumVol * varTr/resolution))<EOL>onset_c = aryOns[aryCnd == c]<EOL>duration_c = aryDrt[aryCnd == c]<EOL>onset_idx = np.round(onset_c / resolution).astype(np.int)<EOL>duration_idx = np.round(duration_c / resolution).astype(np.int)<EOL>aux = np.arange(int(varNumVol * varTr/resolution))<EOL>for start, dur in zip(onset_idx, duration_idx):<EOL><INDENT>lgc = np.logical_and(aux >= start, aux < start + dur)<EOL>tmp = tmp + lgc<EOL><DEDENT>assert np.all(np.less(tmp, <NUM_LIT:2>))<EOL>boxcar.append(tmp)<EOL><DEDENT>aryBxCrOut = np.array(boxcar).T<EOL>if aryBxCrOut.shape[<NUM_LIT:1>] == <NUM_LIT:1>:<EOL><INDENT>aryBxCrOut = np.squeeze(aryBxCrOut)<EOL><DEDENT>return aryBxCrOut.astype('<STR_LIT>')<EOL>
Creation of condition time courses in temporally upsampled space.

Parameters
----------

aryCnd : np.array
    1D array with condition identifiers (every condition has its own int)
aryOns : np.array, same len as aryCnd
    1D array with condition onset times in seconds.
aryDrt : np.array, same len as aryCnd
    1D array with condition durations of different conditions in seconds.
varTr : float, positive
    Time to repeat (TR) of the (fMRI) experiment.
varNumVol : float, positive
    Number of volumes of the (fMRI) data.
aryExclCnd : array
    1D array containing condition identifiers for conditions to be excluded
varTmpOvsmpl : float, positive
    Factor by which the time courses should be temporally upsampled.

Returns
-------
aryBxCrOut : np.array, float16
    Condition time courses in temporally upsampled space.

References:
-----
[1] https://github.com/fabianp/hrf_estimation