Skip to content

I think there is a bug and the NB filtering based on min_electrodes is not being applied #57

@sofiapuvogelvittini

Description

@sofiapuvogelvittini

The min_electrodes should be applied in nb_get_burst_stats_intensities(), however, this function is called inside .nb_extract_features and uses nb_get_burst_stats_intensities with the following parameters: nb_get_burst_stats_intensities(well_data,
f, timespan, bin_time, local_region_min_nae,
sbegin, send, offset2)... so intead of including min_electrodes, it includes local_region_min_nae (which is defined as zero).
If I change this manually, ( nb_get_burst_stats_intensities(well_data,
f, timespan, bin_time, min_electrodes,
sbegin, send, offset2), then the following if statement inside nb_get_burst_stats_intensities() seems to be applied:

if (min_electrodes > 0) {
indicator <- c(0, indicator0, 0) # prepare for finding intervals
diff_indicator <- diff(indicator)
burst_start <- which(diff_indicator == 1)
burst_end <- which(diff_indicator == - 1)
if (length(burst_start) != length(burst_end)) {
stop("Burst region no match")
}

    ## filtered regions based on minimum number of active electrodes
    for (region in 1: length(burst_start)) {
      current_region_nae <-
        length(which(colSums(well_data[
          (burst_start[region]):(burst_end[region] - 1), ]) > 0))
      if (current_region_nae < min_electrodes) {
        indicator0[burst_start[region]:(burst_end[region] - 1)] <- 0
      }
    }
  }

Nonetheless, the output is an error message:
Error in burst_start[region]:(burst_end[region] - 1): NA/NaN argument
Traceback:

  1. .nb_get_burst_stats_intensities(well_data, f, timespan, bin_time,
    . min_electrodes, sbegin, send, offset2)
    Would you please help me to fix it?
    Thanks a lot.
    Best regards,
    Sofia

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions