arboretum/layers/tracks/tracks.py
def _set_view_slice(self):
        """Sets the view given the indices to slice with."""

        if not ALLOW_ND_SLICING: return

        indices = self._slice_indices

        # if none of the dims need slicing, return since this function gets
        # called every time a slider changes
        if all([isinstance(idx, slice) for idx in indices[1:]]):
            return

        # NOTE(arl): to whoever is reading this. The implementation is a bit
        # clunky here - no real need to iterate over the dims, but it works
        # by building a vertex mask (i.e.) those vertices that should be
        # displayed, give the current slicing. This is only applied to the
        # dims>0 since we always want to project time

        n_track_vertices = self._manager.track_vertices.shape[0]
        n_graph_vertices = self._manager.graph_vertices.shape[0]
        self._mask_data = np.array([True] * n_track_vertices)
        self._mask_graph = np.array([True] * n_graph_vertices)

        # this bins the data into integer bins for slicing.
        # NOTE(arl): we could also use a hash bin here
        bin_track_vertices = np.round(self._manager.track_vertices[:,1:]).astype(np.int32)
        bin_graph_vertices = np.round(self._manager.graph_vertices[:,1:]).astype(np.int32)
        for i, idx in enumerate(indices[1:]):
            if isinstance(idx, slice):
                continue

            axis_mask_data = bin_track_vertices[:,i] == idx
            axis_mask_graph = bin_graph_vertices[:,i] == idx
            self._mask_data = np.logical_and(axis_mask_data, self._mask_data)
            self._mask_graph = np.logical_and(axis_mask_graph, self._mask_graph)

        return
Sets the view given the indices to slice with.
Sets the view given the indices to slice with.
Sets the view given the indices to slice with .
def _set_view_slice(self):
        if not ALLOW_ND_SLICING: return
        indices = self._slice_indices
        if all([isinstance(idx, slice) for idx in indices[1:]]):
            return
        n_track_vertices = self._manager.track_vertices.shape[0]
        n_graph_vertices = self._manager.graph_vertices.shape[0]
        self._mask_data = np.array([True] * n_track_vertices)
        self._mask_graph = np.array([True] * n_graph_vertices)
        bin_track_vertices = np.round(self._manager.track_vertices[:,1:]).astype(np.int32)
        bin_graph_vertices = np.round(self._manager.graph_vertices[:,1:]).astype(np.int32)
        for i, idx in enumerate(indices[1:]):
            if isinstance(idx, slice):
                continue
            axis_mask_data = bin_track_vertices[:,i] == idx
            axis_mask_graph = bin_graph_vertices[:,i] == idx
            self._mask_data = np.logical_and(axis_mask_data, self._mask_data)
            self._mask_graph = np.logical_and(axis_mask_graph, self._mask_graph)
        return
def _set_view_slice ( self ) : if not ALLOW_ND_SLICING : return indices = self . _slice_indices if all ( [ isinstance ( idx , slice ) for idx in indices [ 1 : ] ] ) : return n_track_vertices = self . _manager . track_vertices . shape [ 0 ] n_graph_vertices = self . _manager . graph_vertices . shape [ 0 ] self . _mask_data = np . array ( [ True ] * n_track_vertices ) self . _mask_graph = np . array ( [ True ] * n_graph_vertices ) bin_track_vertices = np . round ( self . _manager . track_vertices [ : , 1 : ] ) . astype ( np . int32 ) bin_graph_vertices = np . round ( self . _manager . graph_vertices [ : , 1 : ] ) . astype ( np . int32 ) for i , idx in enumerate ( indices [ 1 : ] ) : if isinstance ( idx , slice ) : continue axis_mask_data = bin_track_vertices [ : , i ] == idx axis_mask_graph = bin_graph_vertices [ : , i ] == idx self . _mask_data = np . logical_and ( axis_mask_data , self . _mask_data ) self . _mask_graph = np . logical_and ( axis_mask_graph , self . _mask_graph ) return
Sets the view given the indices to slice with.
Sets the view given the indices to slice with .
"""Sets the view given the indices to slice with.""" # if none of the dims need slicing, return since this function gets # called every time a slider changes # NOTE(arl): to whoever is reading this. The implementation is a bit # clunky here - no real need to iterate over the dims, but it works # by building a vertex mask (i.e.) those vertices that should be # displayed, give the current slicing. This is only applied to the # dims>0 since we always want to project time # this bins the data into integer bins for slicing. # NOTE(arl): we could also use a hash bin here
self