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

Can you give an example of how to use rhrv_batch? #1

Open
marcusjzw opened this issue May 9, 2018 · 1 comment
Open

Can you give an example of how to use rhrv_batch? #1

marcusjzw opened this issue May 9, 2018 · 1 comment

Comments

@marcusjzw
Copy link

It would be much appreciated. Just use the mitdb example just like in the rhrv call.

@avivrosenberg
Copy link
Member

Hi,

Thanks for pointing that out; I need to add something about it to the README (and update it in general, it's not really accurate anymore).

Anyhow, until I do that, here's a script that I used a while back to analyze some data for my research.
If you follow through and read some of the comments in the rhrv_batch function, it should give you a sense of how to use it.

folder = '...' 
output_filename = '...'

%% Analysis configuration

rec_types =     {'NSR1+2', 'NSR1', 'NSR2'};
rec_filenames = {'**/*', 'nsrdb/1*', 'nsr2db/nsr*'};

% rhrv parameters
params = {'defaults',...
    'filtrr.quotient.enable', 'false',...,
    'filtrr.rr_min', 0.4,...
    'filtrr.rr_max', 2.0,...
    'hrv_freq.methods', {'lomb'},...
    'hrv_freq.vlf_band', [0, 0.0033],...
    'hrv_freq.win_func', 'rectwin',...
    'hrv_freq.window_minutes', '',...
    'hrv_freq.osf', 1,...
    'mse.mse_metrics', false,...
    'mse.mse_max_scale', 0,...
    'dfa.n_incr', 4
};

%% Analyze data

[batch_data] = rhrv_batch(folder,...
    'rec_types', rec_types,...
    'rec_filenames', rec_filenames,...
    'ann_ext', 'atr',...
    'rhrv_params', params,...
    'min_nn', 300,...
    'output_filename', [folder filesep output_filename],...
    'writexls', true...
);

%% Save to file
save([folder filesep output_filename], 'batch_data');

Note that here the folder variable contains the path of a folder containing two folders nsrdb and nsr2db. These are two standard databases from PhysioNet.
Also this example is pretty basic, it doesn't show all features of the rhrv_batch function, but you can build on it.

Hope it helps.
Aviv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants