<commit_before>"""Raw Data View: show raw data traces."""

# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
import numpy as np

from galry import (Manager, PlotPaintManager, EventProcessor, PlotInteractionManager, Visual,
    QtGui, QtCore, NavigationEventProcessor, GridVisual, TextVisual, DataNormalizer, 
    process_coordinates, get_next_color, get_color)
from klustaviewa.views.common import KlustaViewaBindings, KlustaView
import kwiklib.utils.logger as log
from qtools import inthread

__all__ = ['TraceView']

# -----------------------------------------------------------------------------
# Data manager
# -----------------------------------------------------------------------------

class TraceManager(Manager):
    info = {}
    
    # initialization
    def set_data(self, trace=None, freq=None, channel_height=None, channel_names=None, ignored_channels=None):

        # default settings
        self.max_size = 1000
        self.duration_initial = 10.
        self.default_channel_height = 0.25
        self.channel_height_limits = (0.01, 20.)
        self.nticks = 10
        
        # these variables will be overwritten after initialization (used to check if init is complete)
        self.slice_ref = (-1, -1) # slice paging
        self.paintinitialized = False # to stop first slice from being loaded until correctly-shaped data drawn
        self.real_data = True # hides grid and painting if we've made up false data of zeros
        
        if trace is None:
            trace = np.zeros((self.duration_initial * 2, 32))
            freq = 1
            self.real_data = False
            
        # load initial variables
        self.trace = trace
        self.ignored_channels = ignored_channels
        self.freq = freq
        self.totalduration = (self.trace.shape[0] - 1) / self.freq
        self.totalsamples, self.nchannels = self.trace.shape
        
        if channel_height is None:
            channel_height = self.default_channel_height<commit_msg>Passing channel_color list into TraceView<commit_after>"""Raw Data View: show raw data traces."""

# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
import numpy as np

from galry import (Manager, PlotPaintManager, EventProcessor, PlotInteractionManager, Visual,
    QtGui, QtCore, NavigationEventProcessor, GridVisual, TextVisual, DataNormalizer, 
    process_coordinates, get_next_color, get_color)
from klustaviewa.views.common import KlustaViewaBindings, KlustaView
import kwiklib.utils.logger as log
from qtools import inthread
from kwiklib.utils.colors import COLORS_COUNT

__all__ = ['TraceView']

# -----------------------------------------------------------------------------
# Data manager
# -----------------------------------------------------------------------------

class TraceManager(Manager):
    info = {}
    
    # initialization
    def set_data(self, trace=None, freq=None, channel_height=None, channel_names=None, ignored_channels=None, channel_colors=None):

        # default settings
        self.max_size = 1000
        self.duration_initial = 10.
        self.default_channel_height = 0.25
        self.channel_height_limits = (0.01, 20.)
        self.nticks = 10
        
        # these variables will be overwritten after initialization (used to check if init is complete)
        self.slice_ref = (-1, -1) # slice paging
        self.paintinitialized = False # to stop first slice from being loaded until correctly-shaped data drawn
        self.real_data = True # hides grid and painting if we've made up false data of zeros
        
        if trace is None:
            # make up some data to keep the GPU happy, warm, and feeling loved
            trace = np.zeros((self.duration_initial * 2, 32))
            freq = 1
            
            # don't worry, we won't tell the GPU that it's not actually rendering any useful data, but we need to keep track
            self.real_data = False
            
        if channel_colors is None:
            channel_colors = np.mod(np.arange(trace.shape[1], dtype=np.int32), COLORS_COUNT) + 1
            
        # load initial variables
        self.trace = trace
        self.channel_colors = channel_colors
        self.ignored_channels = ignored_channels
        self.freq = freq
        self.totalduration = (self.trace.shape[0] - 1) / self.freq
        self.totalsamples, self.nchannels = self.trace.shape
        
        if channel_height is None:
            channel_height = self.default_channel_height
{'fraction_non_alphanumeric': 0.1958086367485182, 'fraction_numerical': 0.01100762066045724, 'mean_word_length': 1.7139574956921309, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5299971', 'n_tokens_mistral': 1196, 'n_tokens_neox': 1140, 'n_words': 353}