class_docstr: Encapsulate CmdStan specific logic.
class_docstr_tok: ["Encapsulate","CmdStan","specific","logic","."]
docstr: Convert prior samples to xarray.
docstr_tok: ["Convert","prior","samples","to","xarray","."]
code: def prior_to_xarray(self):
      """Convert prior samples to xarray."""
      # filter prior_predictive
      prior_predictive = self.prior_predictive
  
      columns = self.prior_columns
  
      if prior_predictive is None or (
          isinstance(prior_predictive, str)
          and prior_predictive.lower().endswith(".csv")
      ):
          prior_predictive = []
      elif isinstance(prior_predictive, str):
          prior_predictive = [
              col
              for col in columns
              if prior_predictive == col.split(".")[0]
          ]
      else:
          prior_predictive = [
              col
              for col in columns
              if any(
                  item == col.split(".")[0] for item in prior_predictive
              )
          ]
  
      invalid_cols = prior_predictive
      valid_cols = {
          col: idx
          for col, idx in columns.items()
          if col not in invalid_cols
      }
      data = _unpack_ndarrays(self.prior[0], valid_cols, self.dtypes)
      data_warmup = _unpack_ndarrays(
          self.prior[1], valid_cols, self.dtypes
      )
      return (
          dict_to_dataset(
              data,
              coords=self.coords,
              dims=self.dims,
              attrs=self.attrs_prior,
              index_origin=self.index_origin,
          ),
          dict_to_dataset(
              data_warmup,
              coords=self.coords,
              dims=self.dims,
              attrs=self.attrs_prior,
              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 9 for calling the CmdStanConverter obj's underlying member method code with example usage: obj.prior_to_xarray() and returns: dict_to_dataset,  dict_to_dataset