dynamo-release: Image data of dtype object cannot be converted to float

Hello dynamo. I met this issue when trying to run the scNT-seq human hematopoiesis. What should I do to change the dtype from object to float? Thank you very much.

`%matplotlib inline

dyn.vf.jacobian(adata_labeling, regulators=[“SPI1”, “GATA1”], effectors=[“SPI1”, “GATA1”]) dyn.pl.response( adata_labeling, np.array([[“SPI1”, “GATA1”], [“GATA1”, “SPI1”], [“SPI1”, “SPI1”], [“GATA1”, “GATA1”]]), ykey=“jacobian”, log=False, drop_zero_cells=True, grid_num=25, figsize=(5, 3), save_show_or_return=“show” )

TypeError Traceback (most recent call last) Input In [88], in <cell line: 4>() 1 get_ipython().run_line_magic(‘matplotlib’, ‘inline’) 3 dyn.vf.jacobian(adata_labeling, regulators=[“SPI1”, “GATA1”], effectors=[“SPI1”, “GATA1”]) ----> 4 dyn.pl.response( 5 adata_labeling, 6 np.array([[“SPI1”, “GATA1”], [“GATA1”, “SPI1”], [“SPI1”, “SPI1”], [“GATA1”, “GATA1”]]), 7 ykey=“jacobian”, 8 log=False, 9 drop_zero_cells=True, 10 grid_num=25, 11 figsize=(5, 3), 12 save_show_or_return=“show” 13 )

File ~\AppData\Roaming\Python\Python39\site-packages\dynamo\plot\heatmaps.py:420, in response(adata, pairs_mat, xkey, ykey, log, drop_zero_cells, delay, grid_num, n_row, n_col, cmap, show_ridge, show_rug, zero_indicator, zero_line_style, zero_line_width, mean_style, fit_curve, fit_mode, curve_style, curve_lw, no_degradation, show_extent, ext_format, stacked_fraction, figsize, save_show_or_return, save_kwargs, return_data) 417 axins = inset_axes(axes[i, j], bbox_transform=axes[i, j].transAxes, **inset_dict) 419 ext_lim = (min(x_val), max(x_val), min(y_val), max(y_val)) –> 420 im = axes[i, j].imshow( 421 values, 422 interpolation=“mitchell”, 423 origin=“lower”, 424 extent=ext_lim if show_extent else None, 425 cmap=cmap, 426 ) 427 cb = fig.colorbar(im, cax=axins) 428 cb.set_alpha(1)

File ~\AppData\Roaming\Python\Python39\site-packages\matplotlib_init_.py:1361, in _preprocess_data…inner(ax, data, *args, **kwargs) 1358 @functools.wraps(func) 1359 def inner(ax, *args, data=None, **kwargs): 1360 if data is None: -> 1361 return func(ax, *map(sanitize_sequence, args), **kwargs) 1363 bound = new_sig.bind(ax, *args, **kwargs) 1364 auto_label = (bound.arguments.get(label_namer) 1365 or bound.kwargs.get(label_namer))

File ~\AppData\Roaming\Python\Python39\site-packages\matplotlib\axes_axes.py:5609, in Axes.imshow(self, X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, filternorm, filterrad, resample, url, **kwargs) 5604 self.set_aspect(aspect) 5605 im = mimage.AxesImage(self, cmap, norm, interpolation, origin, extent, 5606 filternorm=filternorm, filterrad=filterrad, 5607 resample=resample, **kwargs) -> 5609 im.set_data(X) 5610 im.set_alpha(alpha) 5611 if im.get_clip_path() is None: 5612 # image does not already have clipping set, clip to axes patch

File ~\AppData\Roaming\Python\Python39\site-packages\matplotlib\image.py:700, in _ImageBase.set_data(self, A) 696 self._A = cbook.safe_masked_invalid(A, copy=True) 698 if (self._A.dtype != np.uint8 and 699 not np.can_cast(self._A.dtype, float, “same_kind”)): –> 700 raise TypeError("Image data of dtype {} cannot be converted to " 701 “float”.format(self._A.dtype)) 703 if self._A.ndim == 3 and self._A.shape[-1] == 1: 704 # If just one dimension assume scalar and apply colormap 705 self._A = self._A[:, :, 0]

TypeError: Image data of dtype object cannot be converted to float`

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 24

Most upvoted comments

屏幕截图 2022-08-14 125553

Very great result.