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: Simulate a SourceEstimate from the provided data.
  
  Returns a SourceEstimate object constructed according to the simulation
  parameters which should be added through function add_data. If both
  start_sample and stop_sample are not specified, the entire duration is
  used.
  
  Parameters
  ----------
  start_sample : int | None
      First sample in chunk. If ``None`` the value of the ``first_samp``
      attribute is used. Defaults to ``None``.
  stop_sample : int | None
      The final sample of the returned STC. If ``None``, then all samples
      past ``start_sample`` are returned.
  
  Returns
  -------
  stc : SourceEstimate object
      The generated source time courses.
docstr_tok: ["Simulate","a","SourceEstimate","from","the","provided","data",".","Returns","a","SourceEstimate","object","constructed","according","to","the","simulation","parameters","which","should","be","added","through","function","add_data",".","If","both","start_sample","and","stop_sample","are","not","specified",",","the","entire","duration","is","used",".","Parameters","--","--","--","--","--","start_sample",":","int","|","None","First","sample","in","chunk",".","If","``","None","``","the","value","of","the","``","first_samp","``","attribute","is","used",".","Defaults","to","``","None","``",".","stop_sample",":","int","|","None","The","final","sample","of","the","returned","STC",".","If","``","None","``",",","then","all","samples","past","``","start_sample","``","are","returned",".","Returns","--","--","--","-","stc",":","SourceEstimate","object","The","generated","source","time","courses","."]
code: def get_stc(self, start_sample=None, stop_sample=None):
      """Simulate a SourceEstimate from the provided data.
  
      Returns a SourceEstimate object constructed according to the simulation
      parameters which should be added through function add_data. If both
      start_sample and stop_sample are not specified, the entire duration is
      used.
  
      Parameters
      ----------
      start_sample : int | None
          First sample in chunk. If ``None`` the value of the ``first_samp``
          attribute is used. Defaults to ``None``.
      stop_sample : int | None
          The final sample of the returned STC. If ``None``, then all samples
          past ``start_sample`` are returned.
  
      Returns
      -------
      stc : SourceEstimate object
          The generated source time courses.
      """
      if len(self._labels) == 0:
          raise ValueError(
              "No simulation parameters were found. Please use "
              "function add_data to add simulation parameters."
          )
      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("start_sample must be >= stop_sample.")
      n_samples = stop_sample - start_sample + 1
  
      # Initialize the stc_data array to span all possible samples
      stc_data = np.zeros((len(self._labels), n_samples))
  
      # Select only the events that fall within the span
      ind = np.where(
          np.logical_and(
              self._last_samples >= start_sample,
              self._events[:, 0] <= stop_sample,
          )
      )[0]
  
      # Loop only over the items that are in the time span
      subset_waveforms = [self._waveforms[i] for i in ind]
      for i, (waveform, event) in enumerate(
          zip(subset_waveforms, self._events[ind])
      ):
          # We retrieve the first and last sample of each waveform
          # According to the corresponding event
          wf_start = event[0]
          wf_stop = self._last_samples[ind[i]]
  
          # Recover the indices of the event that should be in the chunk
          waveform_ind = np.isin(
              np.arange(wf_start, wf_stop + 1),
              np.arange(start_sample, stop_sample + 1),
          )
  
          # Recover the indices that correspond to the overlap
          stc_ind = np.isin(
              np.arange(start_sample, stop_sample + 1),
              np.arange(wf_start, wf_stop + 1),
          )
  
          # add the resulting waveform chunk to the corresponding label
          stc_data[ind[i]][stc_ind] += waveform[waveform_ind]
  
      start_sample -= self.first_samp  # STC sample ref is 0
      stc = simulate_stc(
          self._src,
          self._labels,
          stc_data,
          start_sample * self._tstep,
          self._tstep,
          allow_overlap=True,
      )
  
      return stc
  
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 7 for calling the SourceSimulator obj's underlying member method code with example usage: obj.get_stc(start_sample, stop_sample) and returns: stc