Skip to content

Commit f037105

Browse files
committed
fixed a bug with positive offsets in design_matrix
1 parent 7490f47 commit f037105

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

brainbox/modeling/design_matrix.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ def __init__(self, trialsdf, vartypes, binwidth=0.02):
5454
# Filter out cells which don't meet the criteria for minimum spiking, while doing trial
5555
# assignment
5656
vartypes['duration'] = 'value'
57-
base_df = trialsdf.copy() # Make sure we don't modify the original dataframe
57+
base_df = trialsdf.copy()
58+
trialsdf = trialsdf.copy() # Make sure we don't modify the original dataframe
5859
trbounds = trialsdf[['trial_start', 'trial_end']] # Get the start/end of trials
5960
# Empty trial duration value to use later
6061
trialsdf['duration'] = np.nan
@@ -428,7 +429,7 @@ def denseconv(X, bases):
428429
A = np.zeros((T + TB - 1, int(np.sum(indices[kCov, :]))))
429430
for i, j in enumerate(np.argwhere(indices[kCov, :]).flat):
430431
A[:, i] = np.convolve(X[:, kCov], bases[:, j])
431-
BX[:, k: sI[kCov]] = A[: T, :]
432+
BX[:, k: sI[kCov]] = A[:T, :]
432433
k = sI[kCov]
433434
return BX
434435

@@ -444,5 +445,5 @@ def convbasis(stim, bases, offset=0):
444445
if offset < 0:
445446
X = X[-offset:, :]
446447
elif offset > 0:
447-
X = X[: -(1 + offset), :]
448+
X = X[:-offset, :]
448449
return X

0 commit comments

Comments
 (0)