class_docstr: Class to generate simulated Source Estimates.
  
  Parameters
  ----------
  src : instance of SourceSpaces
      Source space.
  tstep : float
      Time step between successive samples in data. Default is 0.001 s.
  duration : float | None
      Time interval during which the simulation takes place in seconds.
      If None, it is computed using existing events and waveform lengths.
  first_samp : int
      First sample from which the simulation takes place, as an integer.
      Comparable to the :term:`first_samp` property of `~mne.io.Raw` objects.
      Default is 0.
  
  Attributes
  ----------
  duration : float
      The duration of the simulation in seconds.
  n_times : int
      The number of time samples of the simulation.
class_docstr_tok: ["Class","to","generate","simulated","Source","Estimates",".","Parameters","--","--","--","--","--","src",":","instance","of","SourceSpaces","Source","space",".","tstep",":","float","Time","step","between","successive","samples","in","data",".","Default","is","0.001","s.","duration",":","float","|","None","Time","interval","during","which","the","simulation","takes","place","in","seconds",".","If","None",",","it","is","computed","using","existing","events","and","waveform","lengths",".","first_samp",":","int","First","sample","from","which","the","simulation","takes","place",",","as","an","integer",".","Comparable","to","the",":","term",":","`","first_samp","`","property","of","`","~mne.io.Raw","`","objects",".","Default","is","0",".","Attributes","--","--","--","--","--","duration",":","float","The","duration","of","the","simulation","in","seconds",".","n_times",":","int","The","number","of","time","samples","of","the","simulation","."]
docstr: Get the stim channel from the provided data.
  
  Returns the stim channel data according to the simulation parameters
  which should be added through the add_data method. If both start_sample
  and stop_sample are not specified, the entire duration is used.
  
  Parameters
  ----------
  start_sample : int
      First sample in chunk. Default is the value of the ``first_samp``
      attribute.
  stop_sample : int | None
      The final sample of the returned stc. If None, then all samples
      from start_sample onward are returned.
  
  Returns
  -------
  stim_data : ndarray of int, shape (n_samples,)
      The stimulation channel data.
docstr_tok: ["Get","the","stim","channel","from","the","provided","data",".","Returns","the","stim","channel","data","according","to","the","simulation","parameters","which","should","be","added","through","the","add_data","method",".","If","both","start_sample","and","stop_sample","are","not","specified",",","the","entire","duration","is","used",".","Parameters","--","--","--","--","--","start_sample",":","int","First","sample","in","chunk",".","Default","is","the","value","of","the","``","first_samp","``","attribute",".","stop_sample",":","int","|","None","The","final","sample","of","the","returned","stc",".","If","None",",","then","all","samples","from","start_sample","onward","are","returned",".","Returns","--","--","--","-","stim_data",":","ndarray","of","int",",","shape","(","n_samples",",",")","The","stimulation","channel","data","."]
code: def get_stim_channel(self, start_sample=0, stop_sample=None):
      """Get the stim channel from the provided data.
  
      Returns the stim channel data according to the simulation parameters
      which should be added through the add_data method. If both start_sample
      and stop_sample are not specified, the entire duration is used.
  
      Parameters
      ----------
      start_sample : int
          First sample in chunk. Default is the value of the ``first_samp``
          attribute.
      stop_sample : int | None
          The final sample of the returned stc. If None, then all samples
          from start_sample onward are returned.
  
      Returns
      -------
      stim_data : ndarray of int, shape (n_samples,)
          The stimulation channel data.
      """
      if start_sample is None:
          start_sample = self.first_samp
      if stop_sample is None:
          stop_sample = start_sample + self.n_times - 1
      elif stop_sample < start_sample:
          raise ValueError(
              "Argument start_sample must be >= stop_sample."
          )
      n_samples = stop_sample - start_sample + 1
  
      # Initialize the stim data array
      stim_data = np.zeros(n_samples, dtype=np.int64)
  
      # Select only events in the time chunk
      stim_ind = np.where(
          np.logical_and(
              self._events[:, 0] >= start_sample,
              self._events[:, 0] < stop_sample,
          )
      )[0]
  
      if len(stim_ind) > 0:
          relative_ind = self._events[stim_ind, 0] - start_sample
          stim_data[relative_ind] = self._events[stim_ind, 2]
  
      return stim_data
  
file_path: mne-python/mne/simulation/source.py
imports: import numpy
  from ..fixes import rng_uniform
  from ..label import Label
  from ..source_estimate import SourceEstimate, VolSourceEstimate
  from ..source_space._source_space import _ensure_src
  from ..surface import _compute_nearest
  from ..utils import _check_option, _ensure_events, _ensure_int, check_random_state, fill_doc, warn
label_desc: Use image node_id 6 for calling the SourceSimulator obj's underlying member method code with example usage: obj.get_stim_channel(start_sample, stop_sample) and returns: stim_data