saeyslab / napari-sparrow

Other
17 stars 0 forks source link

Find oud why overwriting is so slow #112

Closed lopollar closed 1 year ago

lopollar commented 1 year ago

In the whole process, this code is the slowest:

i='nucleus_boundaries' sdata.add_shapes( name=i, shapes=spatialdata.models.ShapesModel.parse( sdata[i][np.isin(sdata[i].index.values, sdata.table.obs.index.values)] ), overwrite=True, ) And I can't think of why, does anyone have an idea?

lopollar commented 1 year ago

It is because of np.isin on strings, if you add astype(int) for both, everything goes waaaay faster, like 100 times or so