Skip to content

Commit 99619fc

Browse files
committed
redintroduce size function
1 parent 6022caa commit 99619fc

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

code/python/cni_toolbox/gadgets.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,24 @@ def two_gamma(timepoints):
7272

7373
return hrf
7474

75+
def size(x,length):
76+
'''
77+
Parameters
78+
----------
79+
x : floating point array of unknown dimension
80+
length: integer
81+
82+
Returns
83+
-------
84+
out : integer array with 'length' elements
85+
size in each of 'length' dimensions
86+
'''
87+
88+
out = np.ones(length)
89+
dims = x.ndim
90+
out[:dims] = x.shape
91+
92+
return out.astype(int)
7593

7694
def regress(Y, X, l = 0.):
7795
'''
@@ -136,7 +154,6 @@ def correct_autocorr(X, W):
136154
X_corrected: floating point array (2D)
137155
timecourses corrected for autocorrelation
138156
'''
139-
140157
rows, cols = size(X, 2)
141158
X = np.reshape(X, (rows, cols))
142159
X_corrected = np.zeros((rows, cols))

0 commit comments

Comments
 (0)