Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: data type 'u0' not understood #339

Open
tlambert03 opened this issue Jul 25, 2024 · 0 comments
Open

TypeError: data type 'u0' not understood #339

tlambert03 opened this issue Jul 25, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@tlambert03
Copy link
Member

just got this by running an MDA without having loaded a system config. In should fail more gracefully:

File ~/dev/self/napari-micromanager/.venv/lib/python3.12/site-packages/superqt/utils/_ensure_thread.py:179, in _run_in_thread(func=<function _NapariMDAHandler._on_mda_started>, thread=<PyQt6.QtCore.QThread object>, await_return=False, timeout=1000, args=(<napari_micromanager._mda_handler._NapariMDAHandler object>, MDASequence(metadata={'pymmcore_widgets': {'vers...False, interval=datetime.timedelta(0), loops=10))), kwargs={})
    177 future = Future()  # type: ignore
    178 if thread is QThread.currentThread():
--> 179     result = func(*args, **kwargs)
        func = <function _NapariMDAHandler._on_mda_started at 0x1400980e0>
        args = (<napari_micromanager._mda_handler._NapariMDAHandler object at 0x151cb8e90>, MDASequence(metadata={'pymmcore_widgets': {'version': '0.7.2'}, 'napari_micromanager': {'split_channels': False}}, axis_order=('t', 'p', 'c'), stage_positions=(Position(x=None, y=None, z=None, name=None, sequence=None),), channels=(Channel(config='', group='Channel', exposure=100.0, do_stack=True, z_offset=0.0, acquire_every=1, camera=None),), time_plan=TIntervalLoops(prioritize_duration=False, interval=datetime.timedelta(0), loops=10)))
        kwargs = {}
    180     if not await_return:
    181         future.set_result(result)

File ~/dev/self/napari-micromanager/src/napari_micromanager/_mda_handler.py:103, in _NapariMDAHandler._on_mda_started(self=<napari_micromanager._mda_handler._NapariMDAHandler object>, sequence=MDASequence(metadata={'pymmcore_widgets': {'vers...False, interval=datetime.timedelta(0), loops=10)))
    101 dtype = f"u{self._mmc.getBytesPerPixel()}"
    102 # create the zarr array and add it to the viewer
--> 103 z = zarr.open(
        tmp = <TemporaryDirectory '/var/folders/30/fpzwkh4103s6xj67y2k0q4pr0000gn/T/tmpl4t9gdfy'>
        str(tmp.name) = '/var/folders/30/fpzwkh4103s6xj67y2k0q4pr0000gn/T/tmpl4t9gdfy'
        tmp.name = '/var/folders/30/fpzwkh4103s6xj67y2k0q4pr0000gn/T/tmpl4t9gdfy'
        yx_shape = [0, 0]
        shape = [10, 1, 1]
        shape + yx_shape = [10, 1, 1, 0, 0]
        dtype = 'u0'
        tuple([1] * len(shape) + yx_shape) = (1, 1, 1, 0, 0)
        [1] * len(shape) + yx_shape = [1, 1, 1, 0, 0]
        [1] * len(shape) = [1, 1, 1]
        len(shape) = 3
    104     str(tmp.name),
    105     shape=shape + yx_shape,
    106     dtype=dtype,
    107     chunks=tuple([1] * len(shape) + yx_shape),  # VERY IMPORTANT FOR SPEED!
    108 )
    109 # get filename from MDASequence metadata
    110 fname = _get_file_name_from_metadata(sequence)

File ~/dev/self/napari-micromanager/.venv/lib/python3.12/site-packages/zarr/convenience.py:127, in open(store='/var/folders/30/fpzwkh4103s6xj67y2k0q4pr0000gn/T/tmpl4t9gdfy', mode='a', zarr_version=None, path='', **kwargs={'chunks': (1, 1, 1, 0, 0), 'dtype': 'u0', 'path': '', 'shape': [10, 1, 1, 0, 0]})
    125 elif mode == "a":
    126     if "shape" in kwargs or contains_array(_store, path):
--> 127         return open_array(_store, mode=mode, **kwargs)
        _store = <zarr.storage.DirectoryStore object at 0x308069370>
        kwargs = {'shape': [10, 1, 1, 0, 0], 'dtype': 'u0', 'chunks': (1, 1, 1, 0, 0), 'path': ''}
        mode = 'a'
    128     else:
    129         return open_group(_store, mode=mode, **kwargs)

File ~/dev/self/napari-micromanager/.venv/lib/python3.12/site-packages/zarr/creation.py:618, in open_array(store=<zarr.storage.DirectoryStore object>, mode='a', shape=[10, 1, 1, 0, 0], chunks=(1, 1, 1, 0, 0), dtype='u0', compressor='default', fill_value=0, order='C', synchronizer=None, filters=None, cache_metadata=True, cache_attrs=True, path='', object_codec=None, chunk_store=None, storage_options=None, partial_decompress=False, write_empty_chunks=True, zarr_version=2, dimension_separator=None, meta_array=None, **kwargs={})
    616 # ensure fill_value of correct type
    617 if fill_value is not None:
--> 618     fill_value = np.array(fill_value, dtype=dtype)[()]
        fill_value = 0
        np = <module 'numpy' from '/Users/talley/dev/self/napari-micromanager/.venv/lib/python3.12/site-packages/numpy/__init__.py'>
        dtype = 'u0'
    620 # ensure store is initialized
    622 if mode in ["r", "r+"]:

TypeError: data type 'u0' not understood
@tlambert03 tlambert03 added the bug Something isn't working label Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant