You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Zeiss colibri 2 driver has information fields (property names and vals grabbed using pycromanager):
{'Description': 'Zeiss Colibri adapter',
'Info LED-445nm': '445nm ±24nm, 1000m',
'Info LED-505nm': '505nm ±30nm, 1000m',
'Info LED-555nm': '555nm ±150nm, 850m',
'Intensity LED-445nm': '0',
...etc.}
note: the plus minus symbol.
When acquiring events with the Acquisition, some metadata is saved, but then it is read back for display and the following error is encountered:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb1 in position 412: invalid start byte
Using a debugger I determined that the byte is the plus minus symbol which the json encoder (utf-8') does not know?
Previously this was encountered in data.py but with the updated pycromamager I encountered it in the ndtiff\nd_tiff_v2.py while trying to open a dataset:
File "C:\ProgramData\Anaconda3\envs\Pumps38\lib\site-packages\ndtiff\nd_tiff_v2.py", line 87, in read_metadata
return json.loads(
File "C:\ProgramData\Anaconda3\envs\Pumps38\lib\json_init_.py", line 343, in loads
s = s.decode(detect_encoding(s), 'surrogatepass')
I would expect the surrogatepass parameter to just skip it but I guess it does not.
In both an older version of PM and the current, I was able to fix this by taking inspiration from bridge.py line 165:
# Paste your code heremessage=json.loads(reply[0].decode("iso-8859-1"))
#
and adding the .decode("iso-8859-1") to the read metadata function in ndtiff\nd_tiff_v2.py (or previously in data.py) before it is passed to json.loads(
So I'm not sure when in the chain of encoding-saving-loading-decoding this goes wrong on your system.
I don't think that the solution you propose above will work, because NDTiff is saving as UTF-8, so decoding as ISO won't always give the same thing. This contrasts to the bridge, which encodes in ISO and decodes in ISO. I don't remember why exactly I chose to do this for the bridge, though I do remember it being confusing
Try playing around with these and see if you can figure out where it goes wrong on your system
By the way, here are useful references for UTF and ISO that I was using to interpret those numbers
PS: Thank you so much for the great work on micro and pycro. I wish I switched from zen pro long time ago. I will try to contribute a use case soon.
Bug report
Bug summary
Zeiss colibri 2 driver has information fields (property names and vals grabbed using pycromanager):
{'Description': 'Zeiss Colibri adapter',
'Info LED-445nm': '445nm ±24nm, 1000m',
'Info LED-505nm': '505nm ±30nm, 1000m',
'Info LED-555nm': '555nm ±150nm, 850m',
'Intensity LED-445nm': '0',
...etc.}
note: the plus minus symbol.
When acquiring events with the Acquisition, some metadata is saved, but then it is read back for display and the following error is encountered:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb1 in position 412: invalid start byte
Using a debugger I determined that the byte is the plus minus symbol which the json encoder (utf-8') does not know?
Previously this was encountered in data.py but with the updated pycromamager I encountered it in the ndtiff\nd_tiff_v2.py while trying to open a dataset:
File "C:\ProgramData\Anaconda3\envs\Pumps38\lib\site-packages\ndtiff\nd_tiff_v2.py", line 87, in read_metadata
return json.loads(
File "C:\ProgramData\Anaconda3\envs\Pumps38\lib\json_init_.py", line 343, in loads
s = s.decode(detect_encoding(s), 'surrogatepass')
I would expect the surrogatepass parameter to just skip it but I guess it does not.
In both an older version of PM and the current, I was able to fix this by taking inspiration from bridge.py line 165:
and adding the .decode("iso-8859-1") to the read metadata function in ndtiff\nd_tiff_v2.py (or previously in data.py) before it is passed to json.loads(
I am not sure what the best fix would be. Please let me know if I can be more clear, and I will respond promptly.
Version Info
PS: Thank you so much for the great work on micro and pycro. I wish I switched from zen pro long time ago. I will try to contribute a use case soon.
The text was updated successfully, but these errors were encountered: