Charestlab / pyGLMdenoise

python implementation of GLMdenoise
6 stars 6 forks source link

bug in calculation of R2s #47

Open JasperVanDenBosch opened 5 years ago

JasperVanDenBosch commented 5 years ago
~/Projects/pyGLMdenoise/glmdenoise/pyGlmdenoise.py in fit(self)
    385         self.results['R2s'] = calccodStack(
    386             whitened_data,
--> 387             modelfits)
    388         """ TO DO
    389         self.results['R2runs'] = [calccod(whitened_data[c_run], modelfits[c_run], 0)

~/Projects/pyGLMdenoise/glmdenoise/utils/optimiseHRF.py in calccodStack(y, yhat)
    198         with np.errstate(divide="ignore", invalid="ignore"):
    199             yrun = np.array(y[run])
--> 200             yhatrun = np.array(yhat[run])
    201             nom.append(np.sum((yrun - yhatrun) ** 2, axis=0))
    202             denom.append(np.sum(yrun ** 2, axis=0))  # Kendricks denominator

~/Projects/pyGLMdenoise/env/lib/python3.6/site-packages/numpy/matrixlib/defmatrix.py in __getitem__(self, index)
    193 
    194         try:
--> 195             out = N.ndarray.__getitem__(self, index)
    196         finally:
    197             self._getitem = False

IndexError: index 8 is out of bounds for axis 0 with size 8
> /home/adf/vandejjf/Projects/pyGLMdenoise/env/lib/python3.6/site-packages/numpy/matrixlib/defmatrix.py(195)__getitem__()
    193 
    194         try:
--> 195             out = N.ndarray.__getitem__(self, index)
    196         finally:
    197             self._getitem = False

ipdb> y   
JasperVanDenBosch commented 5 years ago
AssertionError: 
> /home/adf/vandejjf/Projects/pyGLMdenoise/glmdenoise/pyGlmdenoise.py(385)fit()
    383         stackdesign = np.vstack(whitened_design)
    384         modelfits = mtimesStack(olsmatrix(stackdesign), whitened_data)
--> 385         assert False
    386         self.results['R2s'] = calccodStack(whitened_data, modelfits)
    387         """ TO DO

ipdb> modelfits.shape                                                                                                                                                                                         
(8, 33979)
ipdb> whitened_data.shape                                                                                                                                                                                     
*** AttributeError: 'list' object has no attribute 'shape'
ipdb> len(whitened_data)                                                                                                                                                                                      
12
ipdb> stackdesign.shape                                                                                                                                                                                       
(1452, 8)
ipdb> whitened_design.shape                                                                                                                                                                                   
*** AttributeError: 'list' object has no attribute 'shape'
ipdb> len(whitened_design)                                                                                                                                                                                    
12
ipdb> whitened_design[0].shape                                                                                                                                                                                
(121, 8)
ipdb> 121*2.5                                                                                                                                                                                                 
302.5
ipdb>