class_docstr: Container for inference data storage using xarray.
  
  For a detailed introduction to ``InferenceData`` objects and their usage, see
  :ref:`xarray_for_arviz`. This page provides help and documentation
  on ``InferenceData`` methods and their low level implementation.
class_docstr_tok: ["Container","for","inference","data","storage","using","xarray",".","For","a","detailed","introduction","to","``","InferenceData","``","objects","and","their","usage",",","see",":","ref",":","`","xarray_for_arviz","`",".","This","page","provides","help","and","documentation","on","``","InferenceData","``","methods","and","their","low","level","implementation","."]
docstr: Perform an xarray selection on all groups.
  
  Loops groups to perform Dataset.isel(key=item)
  for every kwarg if key is a dimension of the dataset.
  One example could be performing a burn in cut on the InferenceData object
  or discarding a chain. The selection is performed on all relevant groups (like
  posterior, prior, sample stats) while non relevant groups like observed data are
  omitted. See :meth:`xarray:xarray.Dataset.isel`
  
  Parameters
  ----------
  groups : str or list of str, optional
      Groups where the selection is to be applied. Can either be group names
      or metagroup names.
  filter_groups : {None, "like", "regex"}, optional
      If `None` (default), interpret groups as the real group or metagroup names.
      If "like", interpret groups as substrings of the real group or metagroup names.
      If "regex", interpret groups as regular expressions on the real group or
      metagroup names. A la `pandas.filter`.
  inplace : bool, optional
      If ``True``, modify the InferenceData object inplace,
      otherwise, return the modified copy.
  kwargs : dict, optional
      It must be accepted by :meth:`xarray:xarray.Dataset.isel`.
  
  Returns
  -------
  InferenceData
      A new InferenceData object by default.
      When `inplace==True` perform selection in-place and return `None`
  
  Examples
  --------
  Use ``isel`` to discard one chain of the InferenceData object. We first check the
  dimensions of the original object:
  
  .. jupyter-execute::
  
      import arviz as az
      idata = az.load_arviz_data("centered_eight")
      idata
  
  In order to remove the third chain:
  
  .. jupyter-execute::
  
      idata_subset = idata.isel(chain=[0, 1, 3], groups="posterior_groups")
      idata_subset
  
  You can expand the groups and coords in each group to see how now only the chains 0, 1 and
  3 are present.
  
  See Also
  --------
  xarray.Dataset.isel :
      Returns a new dataset with each array indexed along the specified dimension(s).
  sel :
      Returns a new dataset with each array indexed by tick labels along the specified
      dimension(s).
docstr_tok: ["Perform","an","xarray","selection","on","all","groups",".","Loops","groups","to","perform","Dataset.isel","(","key=item",")","for","every","kwarg","if","key","is","a","dimension","of","the","dataset",".","One","example","could","be","performing","a","burn","in","cut","on","the","InferenceData","object","or","discarding","a","chain",".","The","selection","is","performed","on","all","relevant","groups","(","like","posterior",",","prior",",","sample","stats",")","while","non","relevant","groups","like","observed","data","are","omitted",".","See",":","meth",":","`","xarray",":","xarray.Dataset.isel","`","Parameters","--","--","--","--","--","groups",":","str","or","list","of","str",",","optional","Groups","where","the","selection","is","to","be","applied",".","Can","either","be","group","names","or","metagroup","names",".","filter_groups",":","{","None",",","``","like","''",",","``","regex","''","}",",","optional","If","`","None","`","(","default",")",",","interpret","groups","as","the","real","group","or","metagroup","names",".","If","``","like","''",",","interpret","groups","as","substrings","of","the","real","group","or","metagroup","names",".","If","``","regex","''",",","interpret","groups","as","regular","expressions","on","the","real","group","or","metagroup","names",".","A","la","`","pandas.filter","`",".","inplace",":","bool",",","optional","If","``","True","``",",","modify","the","InferenceData","object","inplace",",","otherwise",",","return","the","modified","copy",".","kwargs",":","dict",",","optional","It","must","be","accepted","by",":","meth",":","`","xarray",":","xarray.Dataset.isel","`",".","Returns","--","--","--","-","InferenceData","A","new","InferenceData","object","by","default",".","When","`","inplace==True","`","perform","selection","in-place","and","return","`","None","`","Examples","--","--","--","--","Use","``","isel","``","to","discard","one","chain","of","the","InferenceData","object",".","We","first","check","the","dimensions","of","the","original","object",":","..","jupyter-execute",":",":","import","arviz","as","az","idata","=","az.load_arviz_data","(","``","centered_eight","''",")","idata","In","order","to","remove","the","third","chain",":","..","jupyter-execute",":",":","idata_subset","=","idata.isel","(","chain=","[","0",",","1",",","3","]",",","groups=","''","posterior_groups","''",")","idata_subset","You","can","expand","the","groups","and","coords","in","each","group","to","see","how","now","only","the","chains","0",",","1","and","3","are","present",".","See","Also","--","--","--","--","xarray.Dataset.isel",":","Returns","a","new","dataset","with","each","array","indexed","along","the","specified","dimension","(","s",")",".","sel",":","Returns","a","new","dataset","with","each","array","indexed","by","tick","labels","along","the","specified","dimension","(","s",")","."]
code: def isel(
      self: InferenceDataT,
      groups: Optional[Union[str, List[str]]] = None,
      filter_groups: Optional["Literal['like', 'regex']"] = None,
      inplace: bool = False,
      **kwargs: Any,
  ) -> Optional[InferenceDataT]:
      """Perform an xarray selection on all groups.
  
      Loops groups to perform Dataset.isel(key=item)
      for every kwarg if key is a dimension of the dataset.
      One example could be performing a burn in cut on the InferenceData object
      or discarding a chain. The selection is performed on all relevant groups (like
      posterior, prior, sample stats) while non relevant groups like observed data are
      omitted. See :meth:`xarray:xarray.Dataset.isel`
  
      Parameters
      ----------
      groups : str or list of str, optional
          Groups where the selection is to be applied. Can either be group names
          or metagroup names.
      filter_groups : {None, "like", "regex"}, optional
          If `None` (default), interpret groups as the real group or metagroup names.
          If "like", interpret groups as substrings of the real group or metagroup names.
          If "regex", interpret groups as regular expressions on the real group or
          metagroup names. A la `pandas.filter`.
      inplace : bool, optional
          If ``True``, modify the InferenceData object inplace,
          otherwise, return the modified copy.
      kwargs : dict, optional
          It must be accepted by :meth:`xarray:xarray.Dataset.isel`.
  
      Returns
      -------
      InferenceData
          A new InferenceData object by default.
          When `inplace==True` perform selection in-place and return `None`
  
      Examples
      --------
      Use ``isel`` to discard one chain of the InferenceData object. We first check the
      dimensions of the original object:
  
      .. jupyter-execute::
  
          import arviz as az
          idata = az.load_arviz_data("centered_eight")
          idata
  
      In order to remove the third chain:
  
      .. jupyter-execute::
  
          idata_subset = idata.isel(chain=[0, 1, 3], groups="posterior_groups")
          idata_subset
  
      You can expand the groups and coords in each group to see how now only the chains 0, 1 and
      3 are present.
  
      See Also
      --------
      xarray.Dataset.isel :
          Returns a new dataset with each array indexed along the specified dimension(s).
      sel :
          Returns a new dataset with each array indexed by tick labels along the specified
          dimension(s).
      """
      group_names = self._group_names(groups, filter_groups)
  
      out = self if inplace else deepcopy(self)
      for group in group_names:
          dataset = getattr(self, group)
          valid_keys = set(kwargs.keys()).intersection(dataset.dims)
          dataset = dataset.isel(
              **{key: kwargs[key] for key in valid_keys}
          )
          setattr(out, group, dataset)
      if inplace:
          return None
      else:
          return out
  
imports: import os
  import re
  import sys
  import uuid
  import warnings
  from collections import OrderedDict, defaultdict
  from collections.abc import MutableMapping, Sequence
  from copy import copy
  from copy import deepcopy
  from datetime import datetime
  from html import escape
  from typing import TYPE_CHECKING, Any, Iterable, Iterator, List, Mapping, Optional, Tuple, TypeVar, Union, overload
  import numpy
  import xarray
  from packaging import version
  from ..rcparams import rcParams
  from ..utils import HtmlTemplate, _subset_list, _var_names, either_dict_or_kwargs
  from .base import _extend_xr_method, _make_json_serializable, dict_to_dataset
label_desc: Use image node_id 27 for calling the InferenceData obj's underlying member method code with example usage: obj.isel(groups, filter_groups, inplace) and returns: None, out