catalystneuro / distributed-coding-matnwb

Converting the "Distributed coding" dataset to NWB using MATLAB
BSD 2-Clause "Simplified" License
1 stars 1 forks source link

General functions and iteratively convert session data to NWB #9

Closed vigneswaran-chandrasekaran closed 3 years ago

vigneswaran-chandrasekaran commented 3 years ago

Add General functions for different types of modules and iteratively convert each session data to NWB format

vigneswaran-chandrasekaran commented 3 years ago

Thanks for the review

Now, the general structure of a function looks something similar to,

% Function to convert X data  
function types_core_X = Xconvert(file_prefix, X_dataunit, X_description, X_comments)

    arguments
        file_prefix (1, :) string = ''
        X_dataunit char = 'Unknown'
        X_description char = 'some description goes here'
        X_comments char = 'no comments given'
    end

    fname_X_property1 = strcat(file_prefix, 'X.property1.npy');
    fname_X_property1 = strcat(file_prefix, 'X.property2.npy');

    % read data files
    X_property1 = readNPY(fname_X_property1);
    X_property2 = readNPY(fname_X_property2);

    % create types_core_X object for X
    types_core_X = types.core.types_core_X('X_property1',  X_property1, ...
                                          'X_property2', X_property2, ...
                                          'data_unit', X_dataunit, ...
                                          'description', X_description, ...
                                          'comments', X_comments);
end
bendichter commented 3 years ago

Thanks for the review

Now, the general structure of a function looks something similar to,

% Function to convert X data  
function types_core_X = Xconvert(file_prefix, X_dataunit, X_description, X_comments)

    arguments
        file_prefix (1, :) string = ''
        X_dataunit char = 'Unknown'
        X_description char = 'some description goes here'
        X_comments char = 'no comments given'
    end

    fname_X_property1 = strcat(file_prefix, 'X.property1.npy');
    fname_X_property1 = strcat(file_prefix, 'X.property2.npy');

    % read data files
    X_property1 = readNPY(fname_X_property1);
    X_property2 = readNPY(fname_X_property2);

    % create types_core_X object for X
    types_core_X = types.core.types_core_X('X_property1',  X_property1, ...
                                          'X_property2', X_property2, ...
                                          'data_unit', X_dataunit, ...
                                          'description', X_description, ...
                                          'comments', X_comments);
end

This looks like a great structure!

vigneswaran-chandrasekaran commented 3 years ago

The output NWB file now looks something like this: Drive link. The NWB file can be read using both Matnwb and Pynwb.

I think now the PR is ready for your kind review :)

bendichter commented 3 years ago

@Vigneswaran-Chandrasekaran the file looks very close!

The biggest problem I see with it is that most of the units have 1 firing rate. Is that right?

vigneswaran-chandrasekaran commented 3 years ago

I have pushed the changes to fix the problems and the current version of output NWB file looks like this: Drive link