mhrv
mhrv copied to clipboard
Can you give an example of how to use rhrv_batch?
It would be much appreciated. Just use the mitdb example just like in the rhrv call.
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