code: def _calculate_channels(records, sections, split_interval, channel_funcs, user, c_start=0):
      
  
      week_matrix = []
      if len(records) == 0:
          return week_matrix
  
      if not isinstance(records, list):
          records = [records]
  
      year_week = str(records[0].datetime.isocalendar()[
                      0]) + '-' + str(records[0].datetime.isocalendar()[1])
  
      section_lists, section_id = _weekmatrix_grouping(records, sections, split_interval)
  
      for c, fun in enumerate(channel_funcs):
          for b, section_records in enumerate(section_lists):
              indicator_fun, return_type = fun
  
              # _records is used to avoid recomputing home
              user._records = section_records
              user._cache = {}
              output = list(indicator_fun(user)['allweek']['allday'].values())[0]
  
              if return_type == 'scalar':
                  indicator = sum(d for d in output if d is not None)
              elif return_type == 'summarystats':
                  indicator = sum(d for group in output for d in group if d is not None)
  
              if indicator != 0:
                  week_matrix.append(
                      [year_week, c + c_start, section_id[b][0], section_id[b][1], float(indicator)])
  
      return week_matrix
docs: Used to group a list of records across a week as defined by the supplied
      sections. Outputs a list containing records in each section and a list with
      info to identify those sections.
  
      Parameters
      ----------
      records : list
          The week of records to calculate the channels for.
      sections : list
          The list of sections for grouping. Each section will have an integer
          value stating the minutes away from midnight between Sunday and Monday.
      split_interval : int
          The interval in minutes for which each indicator is computed.
      channel_funcs : list
          Indicator functions that generate the values for the week-matrix.
      user : object
          The user to calculate channels for.
      c_start : num
          Start numbering of channels from this value. Optional parameter. Default
          value of 0. Used when adding channels to the same user using different
          lists of records.