class_docstr: Encapsulate InferenceData specific logic.
docstr: Convert prior samples (and if possible prior predictive too) to xarray.
docstr_tok: ["Convert","prior","samples","(","and","if","possible","prior","predictive","too",")","to","xarray","."]
code: def priors_to_xarray(self):
      """Convert prior samples (and if possible prior predictive too) to xarray."""
      if self.prior is None:
          return {"prior": None, "prior_predictive": None}
      if self.observations is not None:
          prior_predictive_vars = list(
              set(self.observations).intersection(self.prior)
          )
          prior_vars = [
              key
              for key in self.prior.keys()
              if key not in prior_predictive_vars
          ]
      else:
          prior_vars = list(self.prior.keys())
          prior_predictive_vars = None
  
      priors_dict = {}
      for group, var_names in zip(
          ("prior", "prior_predictive"),
          (prior_vars, prior_predictive_vars),
      ):
          priors_dict[group] = (
              None
              if var_names is None
              else dict_to_dataset(
                  {
                      k: np.expand_dims(self.prior[k], 0)
                      for k in var_names
                  },
                  library=pymc,
                  coords=self.coords,
                  dims=self.dims,
              )
          )
      return priors_dict
  
imports: import logging
  import warnings
  from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Mapping, Optional, Tuple, Union
  import numpy
  from arviz import InferenceData, concat, rcParams
  from arviz.data.base import CoordSpec, DimSpec, dict_to_dataset, requires
  from pytensor.graph.basic import Constant
  from pytensor.tensor.sharedvar import SharedVariable
  import pymc
  from pymc.model import Model, modelcontext
  from pymc.pytensorf import extract_obs_data
  from pymc.util import get_default_varnames
label_desc: Use image node_id 7 for calling the InferenceDataConverter obj's underlying member method code with example usage: obj.priors_to_xarray() and returns: priors_dict, dict