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: Add data to the simulation.
  
  Data should be added in the form of a triplet of
  Label (Where) - Waveform(s) (What) - Event(s) (When)
  
  Parameters
  ----------
  label : instance of Label
      The label (as created for example by mne.read_label). If the label
      does not match any sources in the SourceEstimate, a ValueError is
      raised.
  waveform : array, shape (n_times,) or (n_events, n_times) | list
      The waveform(s) describing the activity on the label vertices.
      If list, it must have the same length as events.
  events : array of int, shape (n_events, 3)
      Events associated to the waveform(s) to specify when the activity
      should occur.
docstr_tok: ["Add","data","to","the","simulation",".","Data","should","be","added","in","the","form","of","a","triplet","of","Label","(","Where",")","-","Waveform","(","s",")","(","What",")","-","Event","(","s",")","(","When",")","Parameters","--","--","--","--","--","label",":","instance","of","Label","The","label","(","as","created","for","example","by","mne.read_label",")",".","If","the","label","does","not","match","any","sources","in","the","SourceEstimate",",","a","ValueError","is","raised",".","waveform",":","array",",","shape","(","n_times",",",")","or","(","n_events",",","n_times",")","|","list","The","waveform","(","s",")","describing","the","activity","on","the","label","vertices",".","If","list",",","it","must","have","the","same","length","as","events",".","events",":","array","of","int",",","shape","(","n_events",",","3",")","Events","associated","to","the","waveform","(","s",")","to","specify","when","the","activity","should","occur","."]
code: def add_data(self, label, waveform, events):
      """Add data to the simulation.
  
      Data should be added in the form of a triplet of
      Label (Where) - Waveform(s) (What) - Event(s) (When)
  
      Parameters
      ----------
      label : instance of Label
          The label (as created for example by mne.read_label). If the label
          does not match any sources in the SourceEstimate, a ValueError is
          raised.
      waveform : array, shape (n_times,) or (n_events, n_times) | list
          The waveform(s) describing the activity on the label vertices.
          If list, it must have the same length as events.
      events : array of int, shape (n_events, 3)
          Events associated to the waveform(s) to specify when the activity
          should occur.
      """
      if not isinstance(label, Label):
          raise ValueError(
              "label must be a Label," "not %s" % type(label)
          )
  
      # If it is not a list then make it one
      if not isinstance(waveform, list) and np.ndim(waveform) == 2:
          waveform = list(waveform)
      if not isinstance(waveform, list) and np.ndim(waveform) == 1:
          waveform = [waveform]
      if len(waveform) == 1:
          waveform = waveform * len(events)
      # The length is either equal to the length of events, or 1
      if len(waveform) != len(events):
          raise ValueError(
              "Number of waveforms and events should match or "
              "there should be a single waveform (%d != %d)."
              % (len(waveform), len(events))
          )
      events = _ensure_events(events).astype(np.int64)
      # Update the last sample possible based on events + waveforms
      self._labels.extend([label] * len(events))
      self._waveforms.extend(waveform)
      self._events = np.concatenate([self._events, events])
      assert self._events.dtype == np.int64
      # First sample per waveform is the first column of events
      # Last is computed below
      self._last_samples = np.array(
          [
              self._events[i, 0] + len(w) - 1
              for i, w in enumerate(self._waveforms)
          ]
      )
  
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 5 for calling the SourceSimulator obj's underlying member method code with example usage: obj.add_data(label, waveform, events) without return types