class_docstr: Class for time operations on any MNE object that has a time axis.
class_docstr_tok: ["Class","for","time","operations","on","any","MNE","object","that","has","a","time","axis","."]
docstr: Convert time to indices.
  
  Parameters
  ----------
  times : list-like | float | int
      List of numbers or a number representing points in time.
  use_rounding : bool
      If True, use rounding (instead of truncation) when converting
      times to indices. This can help avoid non-unique indices.
  
  Returns
  -------
  index : ndarray
      Indices corresponding to the times supplied.
docstr_tok: ["Convert","time","to","indices",".","Parameters","--","--","--","--","--","times",":","list-like","|","float","|","int","List","of","numbers","or","a","number","representing","points","in","time",".","use_rounding",":","bool","If","True",",","use","rounding","(","instead","of","truncation",")","when","converting","times","to","indices",".","This","can","help","avoid","non-unique","indices",".","Returns","--","--","--","-","index",":","ndarray","Indices","corresponding","to","the","times","supplied","."]
code: def time_as_index(self, times, use_rounding=False):
      """Convert time to indices.
  
      Parameters
      ----------
      times : list-like | float | int
          List of numbers or a number representing points in time.
      use_rounding : bool
          If True, use rounding (instead of truncation) when converting
          times to indices. This can help avoid non-unique indices.
  
      Returns
      -------
      index : ndarray
          Indices corresponding to the times supplied.
      """
      from ..source_estimate import _BaseSourceEstimate
  
      if isinstance(self, _BaseSourceEstimate):
          sfreq = 1.0 / self.tstep
      else:
          sfreq = self.info["sfreq"]
      index = (np.atleast_1d(times) - self.times[0]) * sfreq
      if use_rounding:
          index = np.round(index)
      return index.astype(int)
  
imports: import json
  import logging
  from collections import OrderedDict
  from copy import deepcopy
  import numpy
  from ._logging import verbose, warn
  from .check import _check_pandas_installed, _check_preload, _validate_type
  from .numerics import _time_mask, object_hash, object_size
label_desc: Use image node_id 1 for calling the TimeMixin obj's underlying member method code with example usage: obj.time_as_index(times, use_rounding) and returns: index