matnwb
matnwb copied to clipboard
[Bug]: convertTrials Tutorial uses Out of Date Syntax
What happened?
When running matnwb(2.6.0), I got an error message. I am wondering that is due to a bug with matnwb. Or Could you please let me know how to fix it? Thank you in advance for your time and help.
Steps to Reproduce
nwb = NwbFile();
nwb.units = types.core.Units('colnames',...
{'spike_times', 'trials', 'waveforms'},...
'description', 'Analysed Spike Events');
Error Message
Error using assert
Value of type `types.core.ElementIdentifiers` cannot be converted to type `types.hdmf_common.ElementIdentifiers`.
Error in types.util.correctType (line 60)
assert(isa(val, type), ...
Error in types.util.checkDtype (line 96)
correctedValue = types.util.correctType(val, type);
Error in types.hdmf_common.DynamicTable/validate_id (line 90)
val = types.util.checkDtype('id', 'types.hdmf_common.ElementIdentifiers', val);
Error in types.hdmf_common.DynamicTable/set.id (line 46)
obj.id = obj.validate_id(val);
Error in types.util.dynamictable.checkConfig (line 58)
DynamicTable.id = types.core.ElementIdentifiers('data', idData);
Error in types.core.Units (line 60)
types.util.dynamictable.checkConfig(obj);
Operating System
Windows
Matlab Version
Matlab R2023a
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
- [X] Have you ensured this bug was not already reported?
I cannot reproduce. Can you please make sure you MatNWB is up-to-date? If you used git clone you might be able to simply call !git pull inside MATLAB while in the matnwb repo
If that doesn't work, you can delete MatNWB and download it again from here.
Hi there,
After deleting Matnwb and downloading it again, the mentioned problem has been resolved. Thank you.
But I got another error message when I tried to run the script "MatNWB\tutorials\convertTrials.m."
code at line 351: trials_epoch = types.core.TimeIntervals(... 'start_time', types.hdmf_common.VectorData('data', data.trialStartTimes,... 'description', 'Start time of epoch, in seconds.'),... 'colnames', [data.trialTypeStr; data.trialPropertiesHash.keyNames .';... {'start_time'; 'stop_time'; 'acquisition'; 'timeseries'}],... 'description', 'trial data and properties', ... 'id', types.hdmf_common.ElementIdentifiers('data', data.trialIds),... 'timeseries', types.hdmf_common.VectorData('description', 'Index into timeseries Data'),... 'timeseries_index', types.hdmf_common.VectorIndex(... 'description', 'Index into Timeseries VectorData',... 'target', types.untyped.ObjectView('/intervals/trials/timeseries')));
Error Message:
Error using assert
Value of type types.hdmf_common.VectorData cannot be converted to type types.core.TimeSeriesReferenceVectorData.
Error in types.util.correctType (line 60) assert(isa(val, type), ...
Error in types.util.checkDtype (line 96) correctedValue = types.util.correctType(val, type);
Error in types.core.TimeIntervals/validate_timeseries (line 82) val = types.util.checkDtype('timeseries', 'types.core.TimeSeriesReferenceVectorData', val);
Error in types.core.TimeIntervals/set.timeseries (line 62) obj.timeseries = obj.validate_timeseries(val);
Error in types.core.TimeIntervals (line 39) obj.timeseries = p.Results.timeseries;
Error in convertTrials4jia (line 407) trials_epoch = types.core.TimeIntervals(...
From: Ben Dichter @.> Sent: Wednesday, July 19, 2023 2:54 PM To: NeurodataWithoutBorders/matnwb @.> Cc: Chen, Jian @.>; Author @.> Subject: Re: [NeurodataWithoutBorders/matnwb] [Bug]: types.core.Units (Issue #515)
CAUTION: This email is not from a BCM Source. Only click links or open attachments you know are safe.
If that doesn't work, you can delete MatNWB and download it again from here.
— Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_NeurodataWithoutBorders_matnwb_issues_515-23issuecomment-2D1642669789&d=DwMCaQ&c=ZQs-KZ8oxEw0p81sqgiaRA&r=9Gl8TqypehHm7acAeymJOA&m=uZYmThSPMyqB_VkqqTDcYyajN0KuMwuSIJAcQ3W7anfCFRXOzNpAL7U-ZjHlUydb&s=-8pEDRIWM8tXwrdrSeKpnsqXGqsMNTsSX2k27Udy5Hw&e=, or unsubscribehttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_ACQUAUTWVEIV5SMNJKNW3CTXRA3NRANCNFSM6AAAAAA2QJULUE&d=DwMCaQ&c=ZQs-KZ8oxEw0p81sqgiaRA&r=9Gl8TqypehHm7acAeymJOA&m=uZYmThSPMyqB_VkqqTDcYyajN0KuMwuSIJAcQ3W7anfCFRXOzNpAL7U-ZjHlUydb&s=6OAtznhWx-qTpNBbwOiH1phuPAAMBjteOE9w4w5SL-U&e=. You are receiving this because you authored the thread.Message ID: @.***>
yeah, this looks like outdated code
So do you have an updated convertTrials.m?
The code was probably added before validation changes to DynamicTable objects like TimeIntervals. There's no stop_time data for instance so the code needs to be reworked to include that.