Skip to content

Deprecated numpy bool resulting in error for simulator.set_velocity_field() #1

@samihamahin

Description

@samihamahin
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[83], line 17
     13 simulator = PhaseSimulation(
     14     adata=adata_vel,
     15 )
     16 # set the velocity basis to use
---> 17 simulator.set_velocity_field(basis='pca')
     18 # set starting locations for phase points
     19 # using a categorical variable in `adata.obs`
     20 simulator.set_starting_point(
     21     method='metadata', 
     22     groupby='starting_points',
     23     group='forward',
     24 )

File ~/miniconda3/envs/remote_singlecellseq/lib/python3.9/site-packages/velodyn/velocity_dynsys.py:158, in PhaseSimulation.set_velocity_field(self, groupby, group, basis)
    156     bidx = self.adata.obs[groupby] == group
    157 else:
--> 158     bidx = np.ones(self.adata.shape[0]).astype(np.bool)
    160 # get the relevant cells from the grouping
    161 self.vadata = self.adata[bidx, :].copy()

File ~/miniconda3/envs/remote_singlecellseq/lib/python3.9/site-packages/numpy/__init__.py:324, in __getattr__(attr)
    319     warnings.warn(
    320         f"In the future `np.{attr}` will be defined as the "
    321         "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
    323 if attr in __former_attrs__:
--> 324     raise AttributeError(__former_attrs__[attr])
    326 if attr == 'testing':
    327     import numpy.testing as testing

AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

I believe for line 158 of velodyn/velocity_dynsys the np.bool needs to be changed to bool because of Numpy deprecation errors. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions