Skip to content

ndr.format.intan.read_Intan_RHD2000_directory

  READ_INTAN_RHD2000_DIRECTORY - Read samples from an Intan data directory (1 file per channel format)

   [DATA,TOTAL_SAMPLES,TOTAL_TIME,BLOCKINFO] = READ_INTAN_RHD2000_DIRECTORY(DIRECTORYNAME,
      HEADER, CHANNEL_TYPE, CHANNEL_NUMBERS, T0, T1);

   Inputs:
   Reads data from the Intan Technologies .rhd 2000 directory DIRECTORYNAME.
   The file HEADER information can be provided in HEADER.  If HEADER
   is empty, then it will be read from the file. CHANNEL_TYPE is the
   type of channel to be read (use table below). CHANNEL_NUMBERS are the
   the channel numbers for which to return data (randing from 1 to the number
   of channels of that type sampled). CHANNEL_NUMBERS are from 1...N where 
   N is the number of channels ENABLED in the recording. 1 is the first channel 
   enabled, 2 is the 2nd channel enabled, etc. One can examine the header file to 
   see its correspondance with Intan bank and channel indexes (e.g., the first channel may be
   'amp-A-000'). T0 is the time to start reading (the beginning of
   the recording is 0) and T1 is the time to stop reading. If T0 is negative, we will
   start with time 0. If T1 is INF, we will use the end time of the whole file.

   NOTE: It is assumed that the DIRECTORY is a directory/folder with files written in the
   Intan "1 file per channel" format.

   CHANNEL_TYPE values:
   Value:                      | Meaning:
   --------------------------------------------------------------------------
   'time', 'timestamps', or 1  | read timestamps of samples
   'amp', 'amplifier' or 2     | read amplifier channels
   'aux', 'aux_in', or 3       | read auxiliary input channels
   'supply', or 4              | read supply voltages
   'temp', or 5                | read temperature sensor
   'adc', or 6                 | read analog to digital converter signals
   'din', 'digital_in', or 7   | read digital input (a single channel of 16 bit values)
   'dout', 'digital_out', or 8 | read digital output signal (a single channel)

   Outputs:
     DATA - each column contains samples from an individual channel; if more than
        one channel has been requested, DATA will have more than one column.
     TOTAL_SAMPLES - The total number of (amplifier or digital) samples estimated to be
        in the file.
     TOTAL_TIME - An estimate of the total duration of the time series data in the
        recorded file, in seconds.

   Notes: (1) The Intan RHD2000 board has its own clock. Asking this function
   to read at time T0=0 will read the first sample in the file. This time
   might correspond to some other time on the Intan board.  Reading the
   'time' channel will indicate the time of the sample on the board's clock.
   (2) This function performs no filtering. Even if the user had checked
   for the RHD2000 software to use a 60Hz notch or a high-pass filter,
   this function returns the raw data. 

   See also: READ_INTAN_RHD2000_HEADER

   2020-06-11 SDV - wrote it, checked time, amp, aux, supply, din
                    could use more testing with different channel configurations and ADC and DOUT
                    note: dout seems to write to disk even if it is not in the header file but
                    this function will only examine channels that are listed in the header file