Skip to content
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

[Feature]: Autoload TimeSeries data with offset, conversion and channel_conversion #429

Open
2 tasks done
nmarkowitz opened this issue May 9, 2022 · 0 comments
Open
2 tasks done
Labels
category: enhancement improvements of code or code behavior priority: medium non-critical problem and/or affecting only a small set of NWB users status: todo something needs to be done topic: matnwb-api related to improving the matnwb api

Comments

@nmarkowitz
Copy link

nmarkowitz commented May 9, 2022

What would you like to see added to MatNWB?

Hi,

Instances of TimeSeries and children classes have additional fields added that specify how to properly load data. It would be useful if the load function(s) can automatically apply the operations expected to be performed.

Is your feature request related to a problem?

No response

What solution would you like?

Here's an example of how this could work for backwards compatibility. If any new fields are added in the future or to a child class of TimeSeries then they can just be stacked in the cfg variable and placed in the correct place of the operation on the bottom.

fname = '/Users/sportsnoah14/Documents/Northshore_Hosptial/HBML/PROJECTS/Movies/sub-NS174_ses-implant02_task-DespMeEng_ieeg.nwb';
nwbfile = nwbRead('myfile.nwb');

ts = nwbfile.resolve('/acquisition/test_ts');
p = properties(ts);
data = ts.data.load;

cfg = [];
cfg.channel_conversion = ones(size(data,1), 1);;
cfg.offset = 0;
cfg.data_conversion = 1;
operation_fields = fieldnames(cfg);
for ii = 1:length(operation_fields)
    op = operation_fields{ii};
    if any( strcmp(op, p) )
        if ~isempty( ts.(op) )
            cfg.(op) = ts.(op);
        end
    end
end

data = data*cfg.data_conversion.*cfg.channel_conversion + cfg.offset;

Do you have any interest in helping implement the feature?

Yes, but I would need guidance.

Code of Conduct

@oruebel oruebel added category: enhancement improvements of code or code behavior priority: medium non-critical problem and/or affecting only a small set of NWB users labels May 9, 2022
@ehennestad ehennestad added status: todo something needs to be done topic: matnwb-api related to improving the matnwb api labels Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: enhancement improvements of code or code behavior priority: medium non-critical problem and/or affecting only a small set of NWB users status: todo something needs to be done topic: matnwb-api related to improving the matnwb api
Projects
None yet
Development

No branches or pull requests

3 participants