Return a cut version of this |MacroSubsystem|.

        Args:
            cut (Cut): The cut to apply to this |MacroSubsystem|.

        Returns:
            MacroSubsystem: The cut version of this |MacroSubsystem|.
516598
def apply_cut(self, cut):
        
        # TODO: is the MICE cache reusable?
        return MacroSubsystem(
            self.network,
            self.network_state,
            self.micro_node_indices,
            cut=cut,
            time_scale=self.time_scale,
            blackbox=self.blackbox,
            coarse_grain=self.coarse_grain)
23175
def slice_to(self, s):
        '''
        
        '''
        result = ''
        if self.slice_check():
            result = self.current[self.bra:self.ket]
        return result
1114004
def cuts_connections(self, a, b):
        
        n = max(self.indices) + 1
        return self.cut_matrix(n)[np.ix_(a, b)].any()
68934
def get_cutout(self, clearance=0):
        " "
        return cq.Workplane('XY', origin=(0, 0, 0)) \
            .circle((self.diam / 2) + clearance) \
            .extrude(10)
173625
def cut_setting(self, cut):
        '''
        '''
        
        cut_settings = {'full' : 0b00000001,
                        'half' : 0b00000010,
                        'chain': 0b00000100,
                        'special': 0b00001000
                        }
        if cut in cut_settings:
            self.send(chr(27)+'iC'+chr(cut_settings[cut]))
        else:
            raise RuntimeError('Invalid cut type.')
28545
def split(self):
        
        if self.package_request.conflict or (len(self.variant_slice) == 1):
            return None
        else:
            r = self.variant_slice.split()
            if r is None:
                return None
            else:
                slice, next_slice = r
                scope = self._copy(slice)
                next_scope = self._copy(next_slice)
                return (scope, next_scope)
756922
def cut_at(self, cuttype):
        
        data_x, data_y = self.fitsimage.get_last_data_xy()
        image = self.fitsimage.get_image()
        wd, ht = image.get_size()

        coords = []
        if cuttype == 'horizontal':
            coords.append((0, data_y, wd, data_y))
        elif cuttype == 'vertical':
            coords.append((data_x, 0, data_x, ht))

        count = self._get_cut_index()
        tag = "cuts%d" % (count)
        cuts = []
        for (x1, y1, x2, y2) in coords:
            # calculate center of line
            wd = x2 - x1
            dw = wd // 2
            ht = y2 - y1
            dh = ht // 2
            x, y = x1 + dw + 4, y1 + dh + 4

            cut = self._create_cut(x, y, count, x1, y1, x2, y2, color='cyan')
            self._update_tines(cut)
            cuts.append(cut)

        if len(cuts) == 1:
            cut = cuts[0]
        else:
            cut = self._combine_cuts(*cuts)

        cut.set_data(count=count)

        self.canvas.delete_object_by_tag(tag)
        self.canvas.add(cut, tag=tag)
        self.add_cuts_tag(tag)

        self.logger.debug("redoing cut plots")
        return self.replot_all()
992757
def sasets(self) -> 'SASets':
        
        if not self._loaded_macros:
            self._loadmacros()
            self._loaded_macros = True
        return SASets(self)
630404
def options_scope(self):
    
    if self.is_global():
      return self.subsystem_cls.options_scope
    else:
      return self.subsystem_cls.subscope(self.scope)
244775
def repeatForm(self):
        
        liveForm = self.parameter.asLiveForm()
        liveForm.setFragmentParent(self)
        return liveForm
1021800
def slice(self, start=None, stop=None, step=None):
        
        check_type(start, int)
        check_type(stop, int)
        check_type(step, int)

        if step is not None and step < 0:
            raise ValueError('Only positive steps are currently supported')

        return _series_str_result(self, weld_str_slice, start=start, stop=stop, step=step)
964413
def _prepareSubForm(self, liveForm):
        
        liveForm = liveForm.asSubForm(self.name) # XXX Why did this work???
        # if we are compact, tell the liveform so it can tell its parameters
        # also
        if self._parameterIsCompact:
            liveForm.compact()
        return liveForm
1066712
def cycle_cut(self, cycle_len_thresh=12, directed=False, copy=True):
    '''
    '''
    symmetric = not directed
    adj = self.kernelize('binary').matrix('csr', 'dense', copy=True)
    if symmetric:
      adj = adj + adj.T

    removed_edges = []
    while True:
      c = _atomic_cycle(adj, cycle_len_thresh, directed=directed)
      if c is None:
        break
      # remove edges in the cycle
      ii, jj = c.T
      adj[ii,jj] = 0
      if symmetric:
        adj[jj,ii] = 0
      removed_edges.extend(c)

    #XXX: if _atomic_cycle changes, may need to do this on each loop
    if ss.issparse(adj):
      adj.eliminate_zeros()

    # select only the necessary cuts
    ii, jj = _find_cycle_inducers(adj, removed_edges, cycle_len_thresh,
                                  directed=directed)
    # remove the bad edges
    return self.remove_edges(ii, jj, symmetric=symmetric, copy=copy)
596739
def get_slice(self, start=None, end=None):
        
        if start is not None:
            start = min(max(0, start), len(self) - 1)
        else:
            start = 0
        if end is not None:
            end = min(max(0, end), len(self))
            end = max(end, start + 1)
        else:
            end = len(self)
        new_text = TextFile()
        for fragment in self.fragments[start:end]:
            new_text.add_fragment(fragment)
        return new_text
120025
def select_to_constraint(cls, dataset, selection):
        
        import iris

        def get_slicer(start, end):
            def slicer(cell):
                return start <= cell.point < end
            return slicer
        constraint_kwargs = {}
        for dim, constraint in selection.items():
            if isinstance(constraint, slice):
                constraint = (constraint.start, constraint.stop)
            if isinstance(constraint, tuple):
                if constraint == (None, None):
                    continue
                constraint = get_slicer(*constraint)
            dim = dataset.get_dimension(dim, strict=True)
            constraint_kwargs[dim.name] = constraint
        return iris.Constraint(**constraint_kwargs)
286268
def apply_cut(self, cut):
        """"""
        return Transition(self.network, self.before_state, self.after_state,
                          self.cause_indices, self.effect_indices, cut)
509744
def subsystem(s):
    
    node_states(s.state)
    cut(s.cut, s.cut_indices)
    if config.VALIDATE_SUBSYSTEM_STATES:
        state_reachable(s)
    return True