jmarkow / hifiber

It's high in fiber, low on fat
0 stars 0 forks source link

Error when rereferencing #2

Open wingillis opened 6 years ago

wingillis commented 6 years ago

This is the error:

Index exceeds matrix dimensions.

Error in hifiber/rereference (line 100)
                sn=sign(w(idx(:)+[0;2]));

Error in weak_filter_phot (line 31)
  phot.rereference();

Error in zero_out_stim (line 11)
  phot = weak_filter_phot(obj, tdt_data, tdt_ts);

This is the code used to produce it:

  lockin_ord = 1; % for filter
  lockin_ftype = 'butter';
  lockin_tau = 0.1;
  % don't bandpass filter the data
  mod_bandpass = false;
  new_fs = 100; % hz

  % create the photometry object
  phot = hifiber(tdt_data{1}(:, [1 4]), tdt_ts{1});
  phot.set_metadata_tdt(kinect.metadata.tdt{1});
  % set the options
  phot.set_option('new_fs', new_fs);
  phot.set_option('demod_filter_type', lockin_ftype);
  phot.set_option('demod_filter_order', lockin_ord);
  phot.set_option('demod_tau', lockin_tau);
  phot.set_option('mod_bandpass', mod_bandpass);
  phot.set_option('rereference_method', 'ica');

  % preprocess the data
  phot.set_modulation_frequency();
  phot.detect_references();
  phot.demodulate();
  phot.downsample();
  phot.get_baseline();
  phot.subtract_baseline();
  phot.get_dff();
  phot.set_reference_channel(1, 3);
  phot.set_reference_channel(4, 3);
  phot.rereference();
jmarkow commented 6 years ago

for now skip referencing if you aren't actively using the reference traces, I'll look into it.