-
Notifications
You must be signed in to change notification settings - Fork 32
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
[Bug]: VectorData.data is converted to string: Error using hdf5lib2 The memory type is incompatible with H5T_STRING. #462
Comments
Hi @dervinism what is the type of the 7th and 8th column of metadata? |
Hi Lawrence, metadata is a Matlab table but individual values are double. Other table columns contain either doubles or strings. If I input any other table columns with doubles, they produce the same error. The only thing that works is converting doubles into strings. However, no such issue for other entries excepts for waveform_mean which has the same issue. |
Are you using any extension schemas? Specifically anything that might overload the Units table declaration? I'm not seeing anything special with |
No extensions. |
So when you index into a table using parentheses, you actually get another table containing only that column. When exporting, this is actually presumed to be a compound type and we encode all the types that way. I'm not sure why I understand this might be asking a lot but could you try this script but replacing the table indexing instances |
metadata{:,1} gives a column cell array of doubles. The NWB file is saved fine, but the saved values are random strings. Presumably the numbers are translated into strings. cell2mat(metadata{:,1}) gives a column vector of doubles. It crashes the code with the typical error. |
I am unable to recreate this issue on my end using random double values. Is it possible for you to send a subset of the non-working NWB file? I can send you a link where you can upload it. |
Oh, nevermind. I missed your reference to your cell array of doubles. Blocking vector data in primitive cell arrays is currently not supported through regular construction (it is supported in |
I am not sure I understand your reply. As I said, the error is caused by all data types except strings. I can share the code with the data example that reproduces the error. |
At the current moment and from what I could glean from your comments, what you're trying to do won't work without script modification. There's no support for storing cell arrays of doubles and MatNWB assumes that cell arrays are strings (which should now throw an error as of the tip of master). Is this part of a downstream automation that was read in from another NWB file by chance? Otherwise I'm not sure why you have cell arrays of doubles from indexing into your table. |
I don't have cell arrays. I have a Matlab table. Indexing into a table using curly brackets will give cell arrays. But you can convert them to any type of data. Whatever type is used, either the error is thrown or data is converted to strings and the output no longer makes sense. |
Right, the tip of master should now throw an error when it encounters a cell array of doubles as that is not representable in HDF5 on its own. In the case of MATLAB tables, grouping doubles into vectors of cell arrays is to allow for a variable number of double values per row. Do you happen to know if that is the case here or is it just preventative? |
I don't know the answer to your question. I'll try out the latest matnwb and see if I still get the error. |
I'll follow up tomorrow but my recommendation is to use the `dynamictable = util.table2nwb(metadata, 'description');` function provided as that should get you most of the way there with the proper nwb object structure.
Sep 6, 2022 17:51:31 Martynas Dervinis ***@***.***>:
… I don't know the answer to your question. I'll try out the latest matnwb and see if I still get the error.
—
Reply to this email directly, view it on GitHub[#462 (comment)], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AH7JOPYKE6JJD7YTSU42BF3V464GBANCNFSM6AAAAAAQD534TQ].
You are receiving this because you were assigned.[Tracking image][https://github.com/notifications/beacon/AH7JOP27BZXN5TKJCH33NHDV464GBA5CNFSM6AAAAAAQD534TSWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTSJ2TZGC.gif]
|
I use util.table2nwb to create an electrode table. Overall, I am following matnwb ecephys tutorial. Now I've tested the latest master branch of matnwb and it gives the same error. Except now if I use cell arrays, I get a new type of error that you have recently introduced to prohibit cell arrays. Using all other types of data gives the same old error. So the issue remains not fixed. It is probably best to replicate the error using my code and example data. |
Yes, is there a place where we can see your code? Posting example data should help too. |
I have tested the code on another machine (Windows 11) running Matlab R2022a and the problem goes away. I only experience it on a Windows 10 machine with Matlab R2021a. I've uploaded code and example data on a GIN repository. You would have to install GIN command line tools to download it (not sure if git only would work). To replicate the error, replace line number 194 of convert2nwb |
Hi @dervinism, I got this data working (and on R2017a as well) but the script needs a few changes in how you create and use the |
Sure, describing here will work. Thanks for looking into my code. |
It really all goes back to the cell arrays. VectorData objects cannot be instantiated with cell arrays of numeric types. Their data properties only allow for conversions of:
With the current script, your This (before the addition of the assertion check) would have been mapped to a HDF5 compound data type of variable length strings because a cell array was assumed to imply a string type. This has now been fixed in master and should error. What you want to do is construct your VectorData object with a numeric vector representing your DynamicTable's column. The simplest method would be to replace all table indexes with this: |
On a side note, |
This info is useful but this is not the cause of the error. Even if I follow your instructions I get an error on one machine but not on the other. I even now tried different Matlab versions and they all produce the same error on one machine but not on the other. Very strange! |
I noticed that the error is different than previously reported, but still all else is relevant:
|
The script with your changes works fine for me. Can you delete the output NWB file in your cleanup script prior to running |
Deleting old NWB files did solve the problem in the end. Many thanks for your help! |
Good to see! |
Submit your images today! Winners of the December Image Contest Juror's Choice Winner Lateral Entorhinal Cortex Kristian Moan Kavli Institute for Systems Neuroscience People's Choice Winner Neuronal Network Inside Spider Net-Complex Processes Patterns Norberto Garcia-Cairasco University São Paulo Thank You to everyone who entered! You are part of a growing collection of amazing images celebrating the beauty of the brain. January Contest Now Open Share your view of the brain with us! Enter the Contest About NeuroArt The NeuroArt image contest is a celebration of the beauty of the brain. It's a place to share your view of the brain - whether you use stains or dyes to visualize neurons under a microscope, use fMRI to analyze brain activity, or put a pencil to a piece of paper and draw your perspective. Any image, photo, drawing, or painting of the brain is accepted. How it works NeuroArt is a monthly contest with 2 awards given each month. You can enter up to 3 images each month. Anyone over the age of 18 with an interest in neuroscience can enter. There are two awards given each month: 1. Juror's Choice (chosen by our judging panel of scientists and artists) 2. People's Choice (image with the most number of votes) The Juror's Choice winner becomes eligible to have their image on the cover of the Journal of Neuroscience Research. People's Choice winner gets $250 towards the purchase of MBF Bioscience software or a free 3D printed brass neuron. Read all Rules and Prizes NEW to NeuroArt Here's how to enter: Step 1. Go to the January NeuroArt Contest Step 2. Submit up to 3 images, making sure images meet these requirements: Image must be free of labels such as scale bars, etc. Image must be submitted in JPEG or PNG format. Please note: Each contestant should also have a copy of their JPEG or PNG images available in 810 x 612 points (3375 x 2550 pixels) at a resolution of 300 dpi in TIFF format. The journal cover winner will need to submit their image in this TIFF format to appear on the cover of Journal of Neuroscience Research. Step 3. Share your images with friends. Winners will be announced early February. We request you to include as much information as possible about the image. For example: Microscopy methods used, staining techniques, region(s) of brain, neuron type(s), species and more. Enjoy stunning images submitted by neuroscientists from around the world You are welcome to download this wallpaper collection to visually enhance your desktop. MBF Bioscience is glad to share these extraordinary images to celebrate the beauty of the brain. Enjoy! Free Download NeuroArt on Instagram Follow MBF Bioscience @MBFBioscience on Instagram to see the NeuroArt contest entries. Comment on images You can now ask questions and leave comments on images at neuroart.com. Invite friends and colleagues to enter the contest. The more people who share their unique view of the brain, the better the contest will be. www.neuroart.com MBF Bioscience | 1-802-288-9290 | ***@***.*** MBF Bioscience | 185 Allen Brook Lane, Williston, VT 05495 Unsubscribe ***@***.*** Update Profile | Constant Contact Data Notice Sent by ***@***.*** powered by Try email marketing for free today!
|
Submit your images today! Winner of the February Image Contest Juror's Choice & People's Choice Winner I got the whole world in my head! Marie Karam Collège de France Thank You to everyone who entered! You are part of a growing collection of amazing images celebrating the beauty of the brain. March Contest Now Open Share your view of the brain with us! Enter the Contest About NeuroArt The NeuroArt image contest is a celebration of the beauty of the brain. It's a place to share your view of the brain - whether you use stains or dyes to visualize neurons under a microscope, use fMRI to analyze brain activity, or put a pencil to a piece of paper and draw your perspective. Any image, photo, drawing, or painting of the brain is accepted. How it works NeuroArt is a monthly contest with 2 awards given each month. You can enter up to 3 images each month. Anyone over the age of 18 with an interest in neuroscience can enter. There are two awards given each month: 1. Juror's Choice (chosen by our judging panel of scientists and artists) 2. People's Choice (image with the most number of votes) The Juror's Choice winner becomes eligible to have their image on the cover of the Journal of Neuroscience Research. People's Choice winner gets $250 towards the purchase of MBF Bioscience software or a free 3D printed brass neuron. Read all Rules and Prizes NEW to NeuroArt Here's how to enter: Step 1. Go to the March NeuroArt Contest Step 2. Submit up to 3 images, making sure images meet these requirements: Image must be free of labels such as scale bars, etc. Image must be submitted in JPEG or PNG format. Please note: Each contestant should also have a copy of their JPEG or PNG images available in 810 x 612 points (3375 x 2550 pixels) at a resolution of 300 dpi in TIFF format. The journal cover winner will need to submit their image in this TIFF format to appear on the cover of Journal of Neuroscience Research. Step 3. Share your images with friends. Winners will be announced early April. We request you to include as much information as possible about the image. For example: Microscopy methods used, staining techniques, region(s) of brain, neuron type(s), species and more. Enjoy stunning images submitted by neuroscientists from around the world You are welcome to download this wallpaper collection to visually enhance your desktop. MBF Bioscience is glad to share these extraordinary images to celebrate the beauty of the brain. Enjoy! Free Download NeuroArt on Instagram Follow MBF Bioscience @MBFBioscience on Instagram to see the NeuroArt contest entries. Comment on images You can now ask questions and leave comments on images at neuroart.com. Invite friends and colleagues to enter the contest. The more people who share their unique view of the brain, the better the contest will be. www.neuroart.com MBF Bioscience | 1-802-288-9290 | ***@***.*** MBF Bioscience | 185 Allen Brook Lane, Williston, VT 05495 Unsubscribe ***@***.*** Update Profile | Constant Contact Data Notice Sent by ***@***.*** powered by Try email marketing for free today!
|
What happened?
In some instances VectorData property data is being converted to an array of strings upon saving the NWB file. When the conversion fails, the error is issued:
If I manually convert data into an array of strings, the issue is resolved. However, I don't understand why in some instances I can use an array of numbers and in other instances I have convert them to strings. The documentation states that data property can be any type. This occurs when I try to construct the units table.
Steps to Reproduce
Error Message
Operating System
Windows
Matlab Version
R2021a
Code of Conduct
The text was updated successfully, but these errors were encountered: