class_docstr: Encapsulate CmdStan specific logic.
class_docstr_tok: ["Encapsulate","CmdStan","specific","logic","."]
docstr: Convert prior_predictive samples to xarray.
docstr_tok: ["Convert","prior_predictive","samples","to","xarray","."]
code: def prior_predictive_to_xarray(self):
      """Convert prior_predictive samples to xarray."""
      prior_predictive = self.prior_predictive
  
      if (
          isinstance(prior_predictive, (tuple, list))
          and prior_predictive[0].endswith(".csv")
      ) or (
          isinstance(prior_predictive, str)
          and prior_predictive.endswith(".csv")
      ):
          if isinstance(prior_predictive, str):
              prior_predictive = [prior_predictive]
          chain_data = []
          chain_data_warmup = []
          columns = None
          attrs = {}
          for path in prior_predictive:
              parsed_output = _read_output(path)
              chain_data.append(parsed_output["sample"])
              chain_data_warmup.append(parsed_output["sample_warmup"])
              if columns is None:
                  columns = parsed_output["sample_columns"]
              for key, value in parsed_output[
                  "configuration_info"
              ].items():
                  if key not in attrs:
                      attrs[key] = []
                  attrs[key].append(value)
          data = _unpack_ndarrays(chain_data, columns, self.dtypes)
          data_warmup = _unpack_ndarrays(
              chain_data_warmup, columns, self.dtypes
          )
      else:
          if isinstance(prior_predictive, str):
              prior_predictive = [prior_predictive]
          columns = {
              col: idx
              for col, idx in self.prior_columns.items()
              if any(
                  item == col.split(".")[0] for item in prior_predictive
              )
          }
          data = _unpack_ndarrays(self.prior[0], columns, self.dtypes)
          data_warmup = _unpack_ndarrays(
              self.prior[1], columns, self.dtypes
          )
          attrs = None
      return (
          dict_to_dataset(
              data,
              coords=self.coords,
              dims=self.dims,
              attrs=attrs,
              index_origin=self.index_origin,
          ),
          dict_to_dataset(
              data_warmup,
              coords=self.coords,
              dims=self.dims,
              attrs=attrs,
              index_origin=self.index_origin,
          ),
      )
  
imports: import logging
  import os
  import re
  from collections import defaultdict
  from glob import glob
  from pathlib import Path
  from typing import Dict, List, Optional, Union
  import numpy
  from ..None import utils
  from ..rcparams import rcParams
  from .base import CoordSpec, DimSpec, dict_to_dataset, infer_stan_dtypes, requires
  from .inference_data import InferenceData
label_desc: Use image node_id 11 for calling the CmdStanConverter obj's underlying member method code with example usage: obj.prior_predictive_to_xarray() and returns: dict_to_dataset,  dict_to_dataset