NeurodataWithoutBorders / matnwb

A Matlab interface for reading and writing NWB files
BSD 2-Clause "Simplified" License
49 stars 32 forks source link

zipping timeseries #285

Closed nmarkowitz closed 3 years ago

nmarkowitz commented 3 years ago

Hi,

Using the newest releases of matnwb (official 2.3.0 release any the current state of the master branch) I can't zip any TimeSeries data. If the data is unzipped then it saves just fine. Below is an example of what I tried and the error message it threw.

nwb = NwbFile( ...
    'session_description', 'mouse in open exploration',...
    'identifier', 'Mouse5_Day3', ...
    'session_start_time', datetime(2018, 4, 25, 2, 30, 3), ...
    'general_experimenter', 'My Name', ... % optional
    'general_session_id', 'session_1234', ... % optional
    'general_institution', 'University of My Institution', ... % optional
    'general_related_publications', 'DOI:10.1016/j.neuron.2016.12.011'); % optional

subject = types.core.Subject( ...
    'subject_id', '001', ...
    'age', 'P90D', ...
    'description', 'mouse 5', ...
    'species', 'Mus musculus', ...
    'sex', 'M');

nwb.general_subject = subject;

wrapped_data = types.untyped.DataPipe(...
    'data', rand(12,3000),...
    'hasShuffle',true);

acq = types.core.TimeSeries(...
    'starting_time', 0.0, ... % seconds
    'starting_time_rate', 50,... % Hz
    'data', wrapped_data,...
    'data_unit', 'NA');

nwb.acquisition.set('new_ts', acq);

nwbExport(nwb, 'test_file.nwb');

Error using <a href="matlab:matlab.internal.language.introspective.errorDocCallback('hdf5lib2')" style="font-weight:bold">hdf5lib2</a>
The filename specified was either not found on the MATLAB path or it contains unsupported characters.

Error in <a href="matlab:matlab.internal.language.introspective.errorDocCallback('H5F.open', '/Applications/MATLAB_R2018b.app/toolbox/matlab/imagesci/+H5F/open.m', 60)" style="font-weight:bold">H5F.open</a> (<a href="matlab: opentoline('/Applications/MATLAB_R2018b.app/toolbox/matlab/imagesci/+H5F/open.m',60,0)">line 60</a>)
file_id = H5ML.hdf5lib2('H5Fopen', filename, flags, fapl);

Error in <a href="matlab:matlab.internal.language.introspective.errorDocCallback('types.untyped.DataStub/get_space', '/Users/sportsnoah14/Documents/GitHub/matnwb/+types/+untyped/DataStub.m', 23)" style="font-weight:bold">types.untyped.DataStub/get_space</a> (<a href="matlab: opentoline('/Users/sportsnoah14/Documents/GitHub/matnwb/+types/+untyped/DataStub.m',23,0)">line 23</a>)
            fid = H5F.open(obj.filename);

Error in <a href="matlab:matlab.internal.language.introspective.errorDocCallback('types.untyped.DataStub/subsref', '/Users/sportsnoah14/Documents/GitHub/matnwb/+types/+untyped/DataStub.m', 401)" style="font-weight:bold">types.untyped.DataStub/subsref</a> (<a href="matlab: opentoline('/Users/sportsnoah14/Documents/GitHub/matnwb/+types/+untyped/DataStub.m',401,0)">line 401</a>)
                B = builtin('subsref', obj, S);

Error in <a href="matlab:matlab.internal.language.introspective.errorDocCallback('types.untyped.datapipe.BoundPipe', '/Users/sportsnoah14/Documents/GitHub/matnwb/+types/+untyped/+datapipe/BoundPipe.m', 27)" style="font-weight:bold">types.untyped.datapipe.BoundPipe</a> (<a href="matlab: opentoline('/Users/sportsnoah14/Documents/GitHub/matnwb/+types/+untyped/+datapipe/BoundPipe.m',27,0)">line 27</a>)
            sid = obj.stub.get_space();

Error in <a href="matlab:matlab.internal.language.introspective.errorDocCallback('types.untyped.datapipe.BlueprintPipe/write', '/Users/sportsnoah14/Documents/GitHub/matnwb/+types/+untyped/+datapipe/BlueprintPipe.m', 193)" style="font-weight:bold">types.untyped.datapipe.BlueprintPipe/write</a> (<a href="matlab: opentoline('/Users/sportsnoah14/Documents/GitHub/matnwb/+types/+untyped/+datapipe/BlueprintPipe.m',193,0)">line 193</a>)
            pipe = types.untyped.datapipe.BoundPipe(...

Error in <a href="matlab:matlab.internal.language.introspective.errorDocCallback('types.untyped.DataPipe/export', '/Users/sportsnoah14/Documents/GitHub/matnwb/+types/+untyped/DataPipe.m', 250)" style="font-weight:bold">types.untyped.DataPipe/export</a> (<a href="matlab: opentoline('/Users/sportsnoah14/Documents/GitHub/matnwb/+types/+untyped/DataPipe.m',250,0)">line 250</a>)
            obj.internal = obj.internal.write(fid, fullpath);

Error in <a href="matlab:matlab.internal.language.introspective.errorDocCallback('types.core.TimeSeries/export', '/Users/sportsnoah14/Documents/GitHub/matnwb/+types/+core/TimeSeries.m', 210)" style="font-weight:bold">types.core.TimeSeries/export</a> (<a href="matlab: opentoline('/Users/sportsnoah14/Documents/GitHub/matnwb/+types/+core/TimeSeries.m',210,0)">line 210</a>)
                refs = obj.data.export(fid, [fullpath '/data'], refs);

Error in <a href="matlab:matlab.internal.language.introspective.errorDocCallback('types.untyped.Set/export', '/Users/sportsnoah14/Documents/GitHub/matnwb/+types/+untyped/Set.m', 181)" style="font-weight:bold">types.untyped.Set/export</a> (<a href="matlab: opentoline('/Users/sportsnoah14/Documents/GitHub/matnwb/+types/+untyped/Set.m',181,0)">line 181</a>)
                    refs = v.export(fid, propfp, refs);

Error in <a href="matlab:matlab.internal.language.introspective.errorDocCallback('types.core.NWBFile/export', '/Users/sportsnoah14/Documents/GitHub/matnwb/+types/+core/NWBFile.m', 508)" style="font-weight:bold">types.core.NWBFile/export</a> (<a href="matlab: opentoline('/Users/sportsnoah14/Documents/GitHub/matnwb/+types/+core/NWBFile.m',508,0)">line 508</a>)
            refs = obj.acquisition.export(fid, [fullpath '/acquisition'], refs);

Error in <a href="matlab:matlab.internal.language.introspective.errorDocCallback('NwbFile/export', '/Users/sportsnoah14/Documents/GitHub/matnwb/NwbFile.m', 61)" style="font-weight:bold">NwbFile/export</a> (<a href="matlab: opentoline('/Users/sportsnoah14/Documents/GitHub/matnwb/NwbFile.m',61,0)">line 61</a>)
                refs = export@types.core.NWBFile(obj, output_file_id, '/', {});

Error in <a href="matlab:matlab.internal.language.introspective.errorDocCallback('nwbExport', '/Users/sportsnoah14/Documents/GitHub/matnwb/nwbExport.m', 35)" style="font-weight:bold">nwbExport</a> (<a href="matlab: opentoline('/Users/sportsnoah14/Documents/GitHub/matnwb/nwbExport.m',35,0)">line 35</a>)
    export(nwb(i), filename);

Please let me know if you have any thoughts or suggestions. Thank you in advance.

Noah

lawrence-mbf commented 3 years ago

What is the version of MATLAB that you are using? These error messages look like a serious internal issue.

I've run your example locally on MATLAB 2021a Windows and no such error occurs for me.

nmarkowitz commented 3 years ago

I'm running it on matlab 2018b on mac. I may later be able to access another computer with a different version of matlab (but prior to 2021a) and try it.

nmarkowitz commented 3 years ago

I think I just resolved but I'm still not sure why it's happening. It's not able to write zipped data to my ExFAT formatted external hard drive but it's able to write to a Mac OS Extended Journal Hard Drive. This is probably an issue with matlab so I'll close this