Closed KaetzelLab closed 1 year ago
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[3], line 82 77 data = np.squeeze(data) 79 print(f'data size is {data.shape[0]} times and {data.shape[1]} channels') ---> 82 connectivity_data = calculate_connectivity(data, sfreq, time_halfbandwidth_product, 83 time_window_duration, time_window_step) 85 filename = f'{MouseID}_20s_spectral_connectivity_Day_{day}.mat' 87 print(f'saving file to {filename} to path' ) Cell In[3], line 25, in calculate_connectivity(data, sfreq, time_halfbandwidth_product, time_window_duration, time_window_step) 13 """time_series : array, shape (n_time_samples, n_trials, n_signals) or 14 (n_time_samples, n_signals) 15 """ 17 m = Multitaper(data, sampling_frequency=sfreq, 18 time_halfbandwidth_product=time_halfbandwidth_product, 19 start_time=0, 20 detrend_type = None, 21 time_window_duration = time_window_duration, 22 time_window_step = time_window_step) ---> 25 c = Connectivity.from_multitaper(m) 27 connectivity_data = dict( 28 29 pairwise_spectral_granger_prediction = c.pairwise_spectral_granger_prediction(), 30 31 ) 33 return connectivity_data File ~\Anaconda3\envs\myenv\lib\site-packages\spectral_connectivity\connectivity.py:166, in Connectivity.from_multitaper(cls, multitaper_instance, expectation_type, blocks, dtype) 156 @classmethod 157 def from_multitaper( 158 cls, (...) 162 dtype=xp.complex128, 163 ): 164 """Construct connectivity class using a multitaper instance""" 165 return cls( --> 166 fourier_coefficients=multitaper_instance.fft(), 167 expectation_type=expectation_type, 168 time=multitaper_instance.time, 169 frequencies=multitaper_instance.frequencies, 170 blocks=blocks, 171 dtype=dtype, 172 ) File ~\Anaconda3\envs\myenv\lib\site-packages\spectral_connectivity\transforms.py:249, in Multitaper.fft(self) 239 """Compute the fast Fourier transform using the multitaper method. 240 241 Returns (...) 244 245 """ 246 time_series = _add_axes(self.time_series) 247 time_series = _sliding_window( 248 time_series, --> 249 window_size=self.n_time_samples_per_window, 250 step_size=self.n_time_samples_per_step, 251 axis=0, 252 ) 253 if self.detrend_type is not None: 254 time_series = detrend(time_series, type=self.detrend_type) File ~\Anaconda3\envs\myenv\lib\site-packages\spectral_connectivity\transforms.py:176, in Multitaper.n_time_samples_per_window(self) 173 self._n_time_samples_per_window = self.time_series.shape[0] 174 elif self._time_window_duration is not None: 175 self._n_time_samples_per_window = int( --> 176 xp.round(self.time_window_duration * self.sampling_frequency) 177 ) 178 return self._n_time_samples_per_window AttributeError: module 'cupy' has no attribute 'round'
Sorry, looks like numpy/cupy changed this function. This should be fixed in the latest release which will be available by tomorrow.