def __init__(self, parent=None): super(ThreadedTasks, self).__init__(parent) self.selection_task = inthread(SelectionTask)(impatient=True) self.correlograms_task = inprocess(CorrelogramsTask)( impatient=True, use_master_thread=False) # HACK: the similarity matrix view does not appear to update on # some versions of Mac+Qt, but it seems to work with inthread if sys.platform == 'darwin': self.similarity_matrix_task = inthread(SimilarityMatrixTask)( impatient=True) else: self.similarity_matrix_task = inprocess(SimilarityMatrixTask)( impatient=True, use_master_thread=False)
def __init__(self, parent=None): super(ThreadedTasks, self).__init__(parent) self.selection_task = inthread(SelectionTask)( impatient=True) self.correlograms_task = inprocess(CorrelogramsTask)( impatient=True, use_master_thread=False) # HACK: the similarity matrix view does not appear to update on # some versions of Mac+Qt, but it seems to work with inthread if sys.platform == 'darwin': self.similarity_matrix_task = inthread(SimilarityMatrixTask)( impatient=True) else: self.similarity_matrix_task = inprocess(SimilarityMatrixTask)( impatient=True, use_master_thread=False)
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 self.size = 1 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 = pd.Series(generate_colors(trace.shape[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 self.channels = np.arange(self.nchannels) if channel_height is None: channel_height = self.default_channel_height else: self.default_channel_height = channel_height self.channel_height = channel_height if channel_names is None: channel_names = pd.Series(['ch{0:d}'.format(i) for i in xrange(self.nchannels)]) self.channel_names = channel_names x = np.tile(np.linspace(0., self.totalduration, 2), (self.nchannels, 1)) y = np.zeros_like(x)+ np.linspace(-1, 1, self.nchannels).reshape((-1, 1)) self.position, self.shape = process_coordinates(x=x, y=y) # activate the grid if self.real_data == True: self.interaction_manager.get_processor('viewport').update_viewbox() self.interaction_manager.activate_grid() # register the updater threads self.slice_retriever = inthread(SliceRetriever)(impatient=True) self.slice_retriever.sliceLoaded.connect(self.slice_loaded)
def __init__(self, dataholder): self.dataholder = dataholder self.override_color = False # self.cluster_cache = ClusterCache(dataholder, self, impatient=True) # TASKS.add('cluster_cache', ClusterCache, dataholder, self, impatient=True) tasks.TASKS.cluster_cache = inthread(tasks.ClusterCache)(dataholder, self, impatient=True) self.spike_dependent_variables = [ 'spiketimes', 'waveforms', 'clusters', 'features', 'masks', ] self.select_clusters([])
def create_threads(self): # Create the external threads. self.open_task = inthread(OpenTask)() self.open_task.dataOpened.connect(self.open_done) self.open_task.dataSaved.connect(self.save_done) self.open_task.dataOpenFailed.connect(self.open_failed)
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 self.size = 1 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 = pd.Series(generate_colors(trace.shape[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 self.channels = np.arange(self.nchannels) if channel_height is None: channel_height = self.default_channel_height else: self.default_channel_height = channel_height self.channel_height = channel_height if channel_names is None: channel_names = pd.Series( ['ch{0:d}'.format(i) for i in xrange(self.nchannels)]) self.channel_names = channel_names x = np.tile(np.linspace(0., self.totalduration, 2), (self.nchannels, 1)) y = np.zeros_like(x) + np.linspace(-1, 1, self.nchannels).reshape( (-1, 1)) self.position, self.shape = process_coordinates(x=x, y=y) # activate the grid if self.real_data == True: self.interaction_manager.get_processor('viewport').update_viewbox() self.interaction_manager.activate_grid() # register the updater threads self.slice_retriever = inthread(SliceRetriever)(impatient=True) self.slice_retriever.sliceLoaded.connect(self.slice_loaded)