cytoself icon indicating copy to clipboard operation
cytoself copied to clipboard

failure to run plot_clustermaps()

Open bkang-mit opened this issue 1 year ago • 1 comments

When running below line from colab tutorial (currently running in jupyter notebook) analytics.plot_clustermaps()

I get the following errors. Please let me know how to resolve it.

Thanks!


ValueError Traceback (most recent call last) /tmp/ipykernel_2025/1780327345.py in ----> 1 analytics.plot_clustermaps()

~/anaconda3/envs/cytoself/lib/python3.7/site-packages/cytoself/analysis/analytics.py in plot_clustermaps(self, data, corr_idx_idx, target_vq_layer, datatype, savepath, filename, format, num_cores) 631 fileName="corridx_" + datatype, 632 num_cores=num_cores, --> 633 savepath=savepath, 634 ) 635 corr_idx_idx = self.corr_idx_idx

~/anaconda3/envs/cytoself/lib/python3.7/site-packages/cytoself/analysis/analytics.py in calc_corr_idx_idx(self, data, fileName, num_cores, savepath) 567 for d in data: 568 if len(d) > 0: --> 569 d = np.nan_to_num(selfpearson_multi(d, num_cores=num_cores)) 570 self.corr_idx_idx.append(d) 571 # self.corr_idx_idx = np.stack(self.corr_idx_idx)

~/anaconda3/envs/cytoself/lib/python3.7/site-packages/cytoself/analysis/pearson_correlation.py in selfpearson_multi(data, num_cores, axis) 32 corr = Parallel(n_jobs=num_cores, prefer="threads")( 33 delayed(corr_single)(i1, ar1, data.shape[0], data[i1:]) ---> 34 for i1, ar1 in enumerate(tqdm(data)) 35 ) 36 corr = np.vstack(corr)

~/anaconda3/envs/cytoself/lib/python3.7/site-packages/joblib/parallel.py in call(self, iterable) 1052 1053 with self._backend.retrieval_context(): -> 1054 self.retrieve() 1055 # Make sure that we get a last message telling us we are done 1056 elapsed_time = time.time() - self._start_time

~/anaconda3/envs/cytoself/lib/python3.7/site-packages/joblib/parallel.py in retrieve(self) 931 try: 932 if getattr(self._backend, 'supports_timeout', False): --> 933 self._output.extend(job.get(timeout=self.timeout)) 934 else: 935 self._output.extend(job.get())

~/anaconda3/envs/cytoself/lib/python3.7/multiprocessing/pool.py in get(self, timeout) 655 return self._value 656 else: --> 657 raise self._value 658 659 def _set(self, i, obj):

~/anaconda3/envs/cytoself/lib/python3.7/multiprocessing/pool.py in worker(inqueue, outqueue, initializer, initargs, maxtasks, wrap_exception) 119 job, i, func, args, kwds = task 120 try: --> 121 result = (True, func(*args, **kwds)) 122 except Exception as e: 123 if wrap_exception and func is not _helper_reraises_exception:

~/anaconda3/envs/cytoself/lib/python3.7/site-packages/joblib/_parallel_backends.py in call(self, *args, **kwargs) 593 def call(self, *args, **kwargs): 594 try: --> 595 return self.func(*args, **kwargs) 596 except KeyboardInterrupt as e: 597 # We capture the KeyboardInterrupt and reraise it as

~/anaconda3/envs/cytoself/lib/python3.7/site-packages/joblib/parallel.py in call(self) 261 with parallel_backend(self._backend, n_jobs=self._n_jobs): 262 return [func(*args, **kwargs) --> 263 for func, args, kwargs in self.items] 264 265 def reduce(self):

~/anaconda3/envs/cytoself/lib/python3.7/site-packages/joblib/parallel.py in (.0) 261 with parallel_backend(self._backend, n_jobs=self._n_jobs): 262 return [func(*args, **kwargs) --> 263 for func, args, kwargs in self.items] 264 265 def reduce(self):

~/anaconda3/envs/cytoself/lib/python3.7/site-packages/cytoself/analysis/pearson_correlation.py in corr_single(i1, ar1, dim, data1) 16 corr = np.zeros((1, dim)) 17 for i2, ar2 in enumerate(data1): ---> 18 corr[:, i2 + i1] = pearsonr(ar1, ar2)[0] 19 return corr 20

~/anaconda3/envs/cytoself/lib/python3.7/site-packages/scipy/stats/stats.py in pearsonr(x, y) 4043 # scipy.linalg.norm(xm) does not overflow if xm is, for example, 4044 # [-5e210, 5e210, 3e200, -3e200] -> 4045 normxm = linalg.norm(xm) 4046 normym = linalg.norm(ym) 4047

~/anaconda3/envs/cytoself/lib/python3.7/site-packages/scipy/linalg/misc.py in norm(a, ord, axis, keepdims, check_finite) 143 # Differs from numpy only in non-finite handling and the use of blas. 144 if check_finite: --> 145 a = np.asarray_chkfinite(a) 146 else: 147 a = np.asarray(a)

~/anaconda3/envs/cytoself/lib/python3.7/site-packages/numpy/lib/function_base.py in asarray_chkfinite(a, dtype, order) 487 if a.dtype.char in typecodes['AllFloat'] and not np.isfinite(a).all(): 488 raise ValueError( --> 489 "array must not contain infs or NaNs") 490 return a 491

ValueError: array must not contain infs or NaNs

bkang-mit avatar Jan 23 '23 19:01 bkang-mit