def _included_channels(self, index, skip_master=True):
        """ get the minimum channels needed to extract all information from the
        channel group (for example keep onl the structure channel and exclude the
        strucutre fields channels)

        Parameters
        ----------
        index : int
            channel group index

        Returns
        -------
        included_channels : set
            set of excluded channels

        """

        group = self.groups[index]

        included_channels = set(range(len(group.channels)))
        master_index = self.masters_db.get(index, None)
        if master_index is not None and skip_master:
            included_channels.remove(master_index)

        channels = group.channels

        if self.version in MDF2_VERSIONS + MDF3_VERSIONS:
            for dep in group.channel_dependencies:
                if dep is None:
                    continue
                for gp_nr, ch_nr in dep.referenced_channels:
                    if gp_nr == index:
                        included_channels.add(ch_nr)
        else:
            if group.CAN_logging:
                where = (
                    self.whereis("CAN_DataFrame")
                    + self.whereis("CAN_ErrorFrame")
                    + self.whereis("CAN_RemoteFrame")
                )
                for dg_cntr, ch_cntr in where:
                    if dg_cntr == index:
                        break
                else:
                    raise MdfException(
                        f"CAN_DataFrame or CAN_ErrorFrame not found in group {index}"
                    )
                channel = channels[ch_cntr]

                frame_bytes = range(
                    channel.byte_offset, channel.byte_offset + channel.bit_count // 8
                )

                for i, channel in enumerate(channels):
                    if channel.byte_offset in frame_bytes:
                        included_channels.remove(i)

                included_channels.add(ch_cntr)

                if group.CAN_database:
                    dbc_addr = group.dbc_addr
                    message_id = group.message_id
                    can_msg = self._dbc_cache[dbc_addr].frameById(message_id)

                    for i, _ in enumerate(can_msg.signals, 1):
                        included_channels.add(-i)

            for dependencies in group.channel_dependencies:
                if dependencies is None:
                    continue
                if all(not isinstance(dep, ChannelArrayBlock) for dep in dependencies):
                    for _, ch_nr in dependencies:
                        try:
                            included_channels.remove(ch_nr)
                        except KeyError:
                            pass
                else:
                    for dep in dependencies:
                        for gp_nr, ch_nr in dep.referenced_channels:
                            if gp_nr == index:
                                try:
                                    included_channels.remove(ch_nr)
                                except KeyError:
                                    pass

        return included_channels
get the minimum channels needed to extract all information from the
        channel group (for example keep onl the structure channel and exclude the
        strucutre fields channels)

        Parameters
        ----------
        index : int
            channel group index

        Returns
        -------
        included_channels : set
            set of excluded channels