class_docstr: PAR/REC header
class_docstr_tok: ["PAR\/REC","header"]
docstr: Get bvals and bvecs from data
  
  Returns
  -------
  b_vals : None or array
      Array of b values, shape (n_directions,), or None if not a
      diffusion acquisition.
  b_vectors : None or array
      Array of b vectors, shape (n_directions, 3), or None if not a
      diffusion acquisition.
docstr_tok: ["Get","bvals","and","bvecs","from","data","Returns","--","--","--","-","b_vals",":","None","or","array","Array","of","b","values",",","shape","(","n_directions",",",")",",","or","None","if","not","a","diffusion","acquisition",".","b_vectors",":","None","or","array","Array","of","b","vectors",",","shape","(","n_directions",",","3",")",",","or","None","if","not","a","diffusion","acquisition","."]
code: def get_bvals_bvecs(self):
      """Get bvals and bvecs from data
  
      Returns
      -------
      b_vals : None or array
          Array of b values, shape (n_directions,), or None if not a
          diffusion acquisition.
      b_vectors : None or array
          Array of b vectors, shape (n_directions, 3), or None if not a
          diffusion acquisition.
      """
      if self.general_info["diffusion"] == 0:
          return None, None
      reorder = self.get_sorted_slice_indices()
      if len(self.get_data_shape()) == 3:
          # Any original diffusion scans will have >=2 volumes. However, a
          # single dynamic is possible for a post-processed diffusion volume
          # such as an ADC map. The b-values are unavailable in this case.
          return None, None
      else:
          n_slices, n_vols = self.get_data_shape()[-2:]
      bvals = self.image_defs["diffusion_b_factor"][reorder].reshape(
          (n_slices, n_vols), order="F"
      )
      # All bvals within volume should be the same
      assert not np.any(np.diff(bvals, axis=0))
      bvals = bvals[0]
      if "diffusion" not in self.image_defs.dtype.names:
          return bvals, None
      bvecs = self.image_defs["diffusion"][reorder].reshape(
          (n_slices, n_vols, 3), order="F"
      )
      # All 3 values of bvecs should be same within volume
      assert not np.any(np.diff(bvecs, axis=0))
      bvecs = bvecs[0]
      # rotate bvecs to match stored image orientation
      permute_to_psl = ACQ_TO_PSL[self.get_slice_orientation()]
      bvecs = apply_affine(np.linalg.inv(permute_to_psl), bvecs)
      return bvals, bvecs
  
imports: import re
  import warnings
  from collections import OrderedDict
  from copy import deepcopy
  from io import StringIO
  from locale import getpreferredencoding
  import numpy
  from .affines import apply_affine, dot_reduce, from_matvec
  from .eulerangles import euler2mat
  from .fileslice import fileslice, strided_scalar
  from .nifti1 import unit_codes
  from .openers import ImageOpener
  from .spatialimages import SpatialHeader, SpatialImage
  from .volumeutils import Recoder, array_from_file
label_desc: Use image node_id 9 for calling the PARRECHeader obj's underlying member method code with example usage: obj.get_bvals_bvecs() and returns: bvals,  bvecs, None,  None, None,  None, bvals,  None