constantinpape / cluster_tools

Distributed segmentation for bio-image-analysis
MIT License
34 stars 14 forks source link

Update copy_volume.py #35

Closed martinschorb closed 2 years ago

martinschorb commented 2 years ago

needs to be converted to str, otherwise if is determined from data, it will fail with:

    dtype = "u" + dtype
TypeError: can only concatenate str (not "numpy.dtype[int8]") to str

see https://github.com/mobie/mobie-utils-python/pull/57

martinschorb commented 2 years ago

would you also want to add a test for extracting the dtype from the raw data and then converting it?

constantinpape commented 2 years ago

would you also want to add a test for extracting the dtype from the raw data and then converting it?

Not quite sure what you mean by this, but I already have a test that checks that int_to_uint works: https://github.com/constantinpape/cluster_tools/blob/master/test/downscaling/test_downscaling.py#L183

martinschorb commented 2 years ago

Yes, other than over at mobie it looks like the scenario that a np.dtype object ends up in this string concatenation doe not happen here. So no need to test for it.

constantinpape commented 2 years ago

Yes, other than over at mobie it looks like the scenario that a np.dtype object ends up in this string concatenation doe not happen here. So no need to test for it.

Whether this is a string or a np dtype depends on the underlying store that is returned by elf.io.open_file. Since open_file is a very thin wrapper it's not possible to unify this.

Anyways, the fix here is very simple and with it support for np dtypes should be ensured, we don't need to add extra tests for this case.

Tests pass so I will merge now, thanks!