docs: def _create_singleframe_bvals_bvecs(grouped_dicoms, bval_file, bvec_file, nifti, nifti_file):
      """
      Write the bvals from the sorted dicom files to a bval file
      """
  
      # create the empty arrays
      bvals = numpy.zeros([len(grouped_dicoms)], dtype=numpy.int32)
      bvecs = numpy.zeros([len(grouped_dicoms), 3])
  
      # loop over all timepoints and create a list with all bvals and bvecs
      if _is_bval_type_a(grouped_dicoms):
          bval_tag = Tag(0x2001, 0x1003)
          bvec_x_tag = Tag(0x2005, 0x10b0)
          bvec_y_tag = Tag(0x2005, 0x10b1)
          bvec_z_tag = Tag(0x2005, 0x10b2)
          for stack_index in range(0, len(grouped_dicoms)):
              bvals[stack_index] = common.get_fl_value(grouped_dicoms[stack_index][0][bval_tag])
              bvecs[stack_index, :] = [common.get_fl_value(grouped_dicoms[stack_index][0][bvec_x_tag]),
                                       common.get_fl_value(grouped_dicoms[stack_index][0][bvec_y_tag]),
                                       common.get_fl_value(grouped_dicoms[stack_index][0][bvec_z_tag])]
      elif _is_bval_type_b(grouped_dicoms):
          bval_tag = Tag(0x0018, 0x9087)
          bvec_tag = Tag(0x0018, 0x9089)
          for stack_index in range(0, len(grouped_dicoms)):
              bvals[stack_index] = common.get_fd_value(grouped_dicoms[stack_index][0][bval_tag])
              bvecs[stack_index, :] = common.get_fd_array_value(grouped_dicoms[stack_index][0][bvec_tag], 3)
  
      # truncate nifti if needed
      nifti, bvals, bvecs = _fix_diffusion_images(bvals, bvecs, nifti, nifti_file)
  
      # save the found bvecs to the file
      if numpy.count_nonzero(bvals) > 0 or numpy.count_nonzero(bvecs) > 0:
          common.write_bval_file(bvals, bval_file)
          common.write_bvec_file(bvecs, bvec_file)
      else:
          bval_file = None
          bvec_file = None
          bvals = None
          bvecs = None
      return nifti, bvals, bvecs, bval_file, bvec_file