VH-Lab / NDR-matlab

Neuroscience Data Readers - A Matlab conglomerative library for reading neuroscience data files
1 stars 1 forks source link

ndr.reader.intan needs new functions #37

Closed stevevanhooser closed 3 years ago

stevevanhooser commented 3 years ago

In the branch reader improve, there is a new read function that makes reading data from ndr.reader even easier. Most users will probably just call the read version.

It requires two helper functions in each subclass of ndr.reader.base: canbereadtogether and daqchannels2internalchannels. These functions need to be overriden in each subclass (intan_rhd, ced_smr, _spikegadgets_rec). Please see the ndr.reader.base class for the inputs and outputs (https://github.com/VH-Lab/NDR-matlab/blob/reader_improve/%2Bndr/%2Breader/base.m).

The base class version of canbereadtogether does check to make sure that the sample rates are all the same (a requirement of canbereadtogether), so you probably want to call the base class version in your overriden version (check that the base class version passes and then add more requirements depending upon your file type). You can read how to do this here: https://www.mathworks.com/help/matlab/matlab_oop/calling-superclass-methods-on-subclass-objects.html

Thanks! Steve

stevevanhooser commented 3 years ago

Noah asks:

Okay. How can we acquire which relative channel was turned on in the Intan system? Does the file example.rhd have any data that can be used to determine which Intan channel was turned on? I'm a bit confused on how one can get the internal Intan channel if it is relative (if that makes sense).

stevevanhooser commented 3 years ago

Let's look at the example file.

Here are the contents of the header:

h = ndr.format.intan.read_Intan_RHD2000_header('example.rhd') h = struct with fields:

                fileinfo: [1×1 struct]
    frequency_parameters: [1×1 struct]
          spike_triggers: [1×32 struct]
      amplifier_channels: [1×32 struct]
      aux_input_channels: [1×3 struct]
 supply_voltage_channels: [1×1 struct]
      board_adc_channels: [0×0 struct]
   board_dig_in_channels: [1×1 struct]
  board_dig_out_channels: [0×0 struct]
num_temp_sensor_channels: 0

% now let's look at the first amplifier channel

h.amplifier_channels(1) ans = struct with fields:

          native_channel_name: 'A-000'
          custom_channel_name: 'A-000'
                 native_order: 0
                 custom_order: 0
                 board_stream: 0
                 chip_channel: 0
                    port_name: 'Port A'
                  port_prefix: 'A'
                  port_number: 1
electrode_impedance_magnitude: 0
    electrode_impedance_phase: 0

% So the internal channel 1 is A-000; or A-000 is internal channel 1.