I got this error running sp.tb.add_regionprop_features(). When I change line 142 in _regionprops.py to return float("NaN"), the problem goes away.
{
"name": "AttributeError",
"message": "module 'numpy' has no attribute 'float'.
np.float was a deprecated alias for the builtin float. To avoid this error in existing code, use float by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.float64 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",
"stack": "---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[41], line 4
1 sdata = sp.tb.allocate_intensity(
2 sdata, img_layer=\"combined_immune_min_max_filtered\", labels_layer=\"segmentation_immune_whole_cell\", channels=1, chunks=4000)
----> 4 sdata = sp.tb.add_regionprop_features(
5 sdata, labels_layer=\"segmentation_immune_whole_cell\", append_labels_layer_name=False)
7 #TODO: Fix regionprops error
File ~\Documents\
apari-sparrow\src\sparrow\table\_regionprops.py:73, in add_regionprop_features(sdata, labels_layer, append_labels_layer_name)
70 # pull masks in in memory. skimage.measure.regionprops does not work with lazy objects.
71 masks = se.data.compute()
---> 73 cell_props = _calculate_regionprop_features(masks)
75 if append_labels_layer_name:
76 newcolumns = [f\"{col}{labels_layer}\" for col in cell_props.columns]
File ~\Documents\
apari-sparrow\src\sparrow\table\_regionprops.py:126, in _calculate_regionprop_features(masks)
124 results = []
125 for prop in props:
--> 126 results.append(_func(prop))
127 cell_props[_func.name] = results
129 cell_props = cell_props.set_index(\"label\")
File c:\Users\julienm\miniconda3\envs\
apari-sparrow\lib\site-packages\
umpy\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 'float'.
np.float was a deprecated alias for the builtin float. To avoid this error in existing code, use float by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.float64 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 got this error running
sp.tb.add_regionprop_features()
. When I change line 142 in _regionprops.py toreturn float("NaN")
, the problem goes away.{ "name": "AttributeError", "message": "module 'numpy' has no attribute 'float'.
np.float
was a deprecated alias for the builtinfloat
. To avoid this error in existing code, usefloat
by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, usenp.float64
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", "stack": "--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[41], line 4 1 sdata = sp.tb.allocate_intensity( 2 sdata, img_layer=\"combined_immune_min_max_filtered\", labels_layer=\"segmentation_immune_whole_cell\", channels=1, chunks=4000) ----> 4 sdata = sp.tb.add_regionprop_features( 5 sdata, labels_layer=\"segmentation_immune_whole_cell\", append_labels_layer_name=False) 7 #TODO: Fix regionprops errorFile ~\Documents\ apari-sparrow\src\sparrow\table\_regionprops.py:73, in add_regionprop_features(sdata, labels_layer, append_labels_layer_name) 70 # pull masks in in memory. skimage.measure.regionprops does not work with lazy objects. 71 masks = se.data.compute() ---> 73 cell_props = _calculate_regionprop_features(masks) 75 if append_labels_layer_name: 76 newcolumns = [f\"{col}{labels_layer}\" for col in cell_props.columns]
File ~\Documents\ apari-sparrow\src\sparrow\table\_regionprops.py:126, in _calculate_regionprop_features(masks) 124 results = [] 125 for prop in props: --> 126 results.append(_func(prop)) 127 cell_props[_func.name] = results 129 cell_props = cell_props.set_index(\"label\")
File ~\Documents\ apari-sparrow\src\sparrow\table\_regionprops.py:142, in _major_minor_axis_ratio(prop) 140 def _major_minor_axis_ratio(prop: RegionProperties) -> float: 141 if prop.minor_axis_length == 0: --> 142 return np.float(\"NaN\") 143 else: 144 return prop.major_axis_length / prop.minor_axis_length
File c:\Users\julienm\miniconda3\envs\ apari-sparrow\lib\site-packages\ umpy\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 testingAttributeError: module 'numpy' has no attribute 'float'.
np.float
was a deprecated alias for the builtinfloat
. To avoid this error in existing code, usefloat
by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, usenp.float64
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" }