class_docstr: Epochs from EEGLAB .set file.
  
  Parameters
  ----------
  input_fname : path-like
      Path to the ``.set`` file. If the data is stored in a separate ``.fdt``
      file, it is expected to be in the same folder as the ``.set`` file.
  events : path-like | array, shape (n_events, 3) | None
      Path to events file. If array, it is the events typically returned
      by the read_events function. If some events don't match the events
      of interest as specified by event_id, they will be marked as 'IGNORED'
      in the drop log. If None, it is constructed from the EEGLAB (.set) file
      with each unique event encoded with a different integer.
  event_id : int | list of int | dict | None
      The id of the event to consider. If dict,
      the keys can later be used to access associated events. Example:
      dict(auditory=1, visual=3). If int, a dict will be created with
      the id as string. If a list, all events with the IDs specified
      in the list are used. If None, the event_id is constructed from the
      EEGLAB (.set) file with each descriptions copied from ``eventtype``.
  tmin : float
      Start time before event.
  baseline : None or tuple of length 2 (default (None, 0))
      The time interval to apply baseline correction.
      If None do not apply it. If baseline is (a, b)
      the interval is between "a (s)" and "b (s)".
      If a is None the beginning of the data is used
      and if b is None then b is set to the end of the interval.
      If baseline is equal to (None, None) all the time
      interval is used.
      The baseline (a, b) includes both endpoints, i.e. all
      timepoints t such that a <= t <= b.
  reject : dict | None
      Rejection parameters based on peak-to-peak amplitude.
      Valid keys are 'grad' | 'mag' | 'eeg' | 'eog' | 'ecg'.
      If reject is None then no rejection is done. Example::
  
          reject = dict(grad=4000e-13, # T / m (gradiometers)
                        mag=4e-12, # T (magnetometers)
                        eeg=40e-6, # V (EEG channels)
                        eog=250e-6 # V (EOG channels)
                        )
  flat : dict | None
      Rejection parameters based on flatness of signal.
      Valid keys are 'grad' | 'mag' | 'eeg' | 'eog' | 'ecg', and values
      are floats that set the minimum acceptable peak-to-peak amplitude.
      If flat is None then no rejection is done.
  reject_tmin : scalar | None
      Start of the time window used to reject epochs (with the default None,
      the window will start with tmin).
  reject_tmax : scalar | None
      End of the time window used to reject epochs (with the default None,
      the window will end with tmax).
  eog : list | tuple | 'auto'
      Names or indices of channels that should be designated EOG channels.
      If 'auto', the channel names containing ``EOG`` or ``EYE`` are used.
      Defaults to empty tuple.
  %(uint16_codec)s
  %(montage_units)s
  %(verbose)s
  
  See Also
  --------
  mne.Epochs : Documentation of attributes and methods.
  
  Notes
  -----
  .. versionadded:: 0.11.0
class_docstr_tok: ["Epochs","from","EEGLAB",".set","file",".","Parameters","--","--","--","--","--","input_fname",":","path-like","Path","to","the","``",".set","``","file",".","If","the","data","is","stored","in","a","separate","``",".fdt","``","file",",","it","is","expected","to","be","in","the","same","folder","as","the","``",".set","``","file",".","events",":","path-like","|","array",",","shape","(","n_events",",","3",")","|","None","Path","to","events","file",".","If","array",",","it","is","the","events","typically","returned","by","the","read_events","function",".","If","some","events","do","n't","match","the","events","of","interest","as","specified","by","event_id",",","they","will","be","marked","as","'IGNORED'","in","the","drop","log",".","If","None",",","it","is","constructed","from","the","EEGLAB","(",".set",")","file","with","each","unique","event","encoded","with","a","different","integer",".","event_id",":","int","|","list","of","int","|","dict","|","None","The","id","of","the","event","to","consider",".","If","dict",",","the","keys","can","later","be","used","to","access","associated","events",".","Example",":","dict","(","auditory=1",",","visual=3",")",".","If","int",",","a","dict","will","be","created","with","the","id","as","string",".","If","a","list",",","all","events","with","the","IDs","specified","in","the","list","are","used",".","If","None",",","the","event_id","is","constructed","from","the","EEGLAB","(",".set",")","file","with","each","descriptions","copied","from","``","eventtype","``",".","tmin",":","float","Start","time","before","event",".","baseline",":","None","or","tuple","of","length","2","(","default","(","None",",","0",")",")","The","time","interval","to","apply","baseline","correction",".","If","None","do","not","apply","it",".","If","baseline","is","(","a",",","b",")","the","interval","is","between","``","a","(","s",")","''","and","``","b","(","s",")","''",".","If","a","is","None","the","beginning","of","the","data","is","used","and","if","b","is","None","then","b","is","set","to","the","end","of","the","interval",".","If","baseline","is","equal","to","(","None",",","None",")","all","the","time","interval","is","used",".","The","baseline","(","a",",","b",")","includes","both","endpoints",",","i.e",".","all","timepoints","t","such","that","a","<","=","t","<","=","b.","reject",":","dict","|","None","Rejection","parameters","based","on","peak-to-peak","amplitude",".","Valid","keys","are","'grad","'","|","'mag","'","|","'eeg","'","|","'eog","'","|","'ecg","'",".","If","reject","is","None","then","no","rejection","is","done",".","Example",":",":","reject","=","dict","(","grad=4000e-13",",","#","T","\/","m","(","gradiometers",")","mag=4e-12",",","#","T","(","magnetometers",")","eeg=40e-6",",","#","V","(","EEG","channels",")","eog=250e-6","#","V","(","EOG","channels",")",")","flat",":","dict","|","None","Rejection","parameters","based","on","flatness","of","signal",".","Valid","keys","are","'grad","'","|","'mag","'","|","'eeg","'","|","'eog","'","|","'ecg","'",",","and","values","are","floats","that","set","the","minimum","acceptable","peak-to-peak","amplitude",".","If","flat","is","None","then","no","rejection","is","done",".","reject_tmin",":","scalar","|","None","Start","of","the","time","window","used","to","reject","epochs","(","with","the","default","None",",","the","window","will","start","with","tmin",")",".","reject_tmax",":","scalar","|","None","End","of","the","time","window","used","to","reject","epochs","(","with","the","default","None",",","the","window","will","end","with","tmax",")",".","eog",":","list","|","tuple","|","'auto'","Names","or","indices","of","channels","that","should","be","designated","EOG","channels",".","If","'auto","'",",","the","channel","names","containing","``","EOG","``","or","``","EYE","``","are","used",".","Defaults","to","empty","tuple",".","%","(","uint16_codec",")","s","%","(","montage_units",")","s","%","(","verbose",")","s","See","Also","--","--","--","--","mne.Epochs",":","Documentation","of","attributes","and","methods",".","Notes","--","--","-","..","versionadded",":",":","0.11.0"]
code: def __init__(
      self,
      input_fname,
      events=None,
      event_id=None,
      tmin=0,
      baseline=None,
      reject=None,
      flat=None,
      reject_tmin=None,
      reject_tmax=None,
      eog=(),
      uint16_codec=None,
      montage_units="auto",
      verbose=None,
  ):
      input_fname = str(
          _check_fname(
              fname=input_fname, must_exist=True, overwrite="read"
          )
      )
      eeg = _check_load_mat(input_fname, uint16_codec)
  
      if not (
          (events is None and event_id is None)
          or (events is not None and event_id is not None)
      ):
          raise ValueError(
              "Both `events` and `event_id` must be " "None or not None"
          )
  
      if eeg.trials <= 1:
          raise ValueError(
              "The file does not seem to contain epochs "
              "(trials less than 2). "
              "You should try using read_raw_eeglab function."
          )
  
      if events is None and eeg.trials > 1:
          # first extract the events and construct an event_id dict
          event_name, event_latencies, unique_ev = (
              list(),
              list(),
              list(),
          )
          ev_idx = 0
          warn_multiple_events = False
          epochs = _bunchify(eeg.epoch)
          events = _bunchify(eeg.event)
          for ep in epochs:
              if isinstance(ep.eventtype, (int, float)):
                  ep.eventtype = str(ep.eventtype)
              if not isinstance(ep.eventtype, str):
                  event_type = "/".join(
                      [str(et) for et in ep.eventtype]
                  )
                  event_name.append(event_type)
                  # store latency of only first event
                  event_latencies.append(events[ev_idx].latency)
                  ev_idx += len(ep.eventtype)
                  warn_multiple_events = True
              else:
                  event_type = ep.eventtype
                  event_name.append(ep.eventtype)
                  event_latencies.append(events[ev_idx].latency)
                  ev_idx += 1
  
              if event_type not in unique_ev:
                  unique_ev.append(event_type)
  
              # invent event dict but use id > 0 so you know its a trigger
              event_id = {
                  ev: idx + 1 for idx, ev in enumerate(unique_ev)
              }
  
          # warn about multiple events in epoch if necessary
          if warn_multiple_events:
              warn(
                  "At least one epoch has multiple events. Only the latency"
                  " of the first event will be retained."
              )
  
          # now fill up the event array
          events = np.zeros((eeg.trials, 3), dtype=int)
          for idx in range(0, eeg.trials):
              if idx == 0:
                  prev_stim = 0
              elif (
                  idx > 0
                  and event_latencies[idx] - event_latencies[idx - 1]
                  == 1
              ):
                  prev_stim = event_id[event_name[idx - 1]]
              events[idx, 0] = event_latencies[idx]
              events[idx, 1] = prev_stim
              events[idx, 2] = event_id[event_name[idx]]
      elif isinstance(events, (str, Path, PathLike)):
          events = read_events(events)
  
      logger.info("Extracting parameters from %s..." % input_fname)
      info, eeg_montage, _ = _get_info(
          eeg, eog=eog, montage_units=montage_units
      )
  
      for key, val in event_id.items():
          if val not in events[:, 2]:
              raise ValueError(
                  "No matching events found for %s "
                  "(event id %i)" % (key, val)
              )
  
      if isinstance(eeg.data, str):
          data_fname = _check_eeglab_fname(input_fname, eeg.data)
          with open(data_fname, "rb") as data_fid:
              data = np.fromfile(data_fid, dtype=np.float32)
              data = data.reshape(
                  (eeg.nbchan, eeg.pnts, eeg.trials), order="F"
              )
      else:
          data = eeg.data
  
      if eeg.nbchan == 1 and len(data.shape) == 2:
          data = data[np.newaxis, :]
      data = data.transpose((2, 0, 1)).astype("double")
      data *= CAL
      assert data.shape == (eeg.trials, eeg.nbchan, eeg.pnts)
      tmin, tmax = eeg.xmin, eeg.xmax
  
      super().__init__(
          info,
          data,
          events,
          event_id,
          tmin,
          tmax,
          baseline,
          reject=reject,
          flat=flat,
          reject_tmin=reject_tmin,
          reject_tmax=reject_tmax,
          filename=input_fname,
          verbose=verbose,
      )
  
      # data are preloaded but _bad_dropped is not set so we do it here:
      self._bad_dropped = True
  
      _set_dig_montage_in_init(self, eeg_montage)
  
      logger.info("Ready.")
  
imports: import os.path
  from os import PathLike
  from pathlib import Path
  import numpy
  from mne.utils.check import _check_option
  from ..._fiff._digitization import _ensure_fiducials_head
  from ..._fiff.constants import FIFF
  from ..._fiff.meas_info import create_info
  from ..._fiff.pick import _PICK_TYPES_KEYS
  from ..._fiff.utils import _find_channels, _read_segments_file
  from ...annotations import Annotations, read_annotations
  from ...channels import make_dig_montage
  from ...defaults import DEFAULTS
  from ...epochs import BaseEpochs
  from ...event import read_events
  from ...utils import Bunch, _check_fname, _check_head_radius, fill_doc, logger, verbose, warn
  from ..base import BaseRaw
  from ._eeglab import _readmat
label_desc: Use image node_id 1 to create a new EpochsEEGLAB object from inherited base classes: BaseEpochs with example: obj = EpochsEEGLAB(input_fname, events, event_id, tmin, baseline, reject, flat, reject_tmin, reject_tmax, eog, uint16_codec, montage_units, verbose)