code: def write_bval_file(bvals, bval_file):
      
      if bval_file is None:
          return
      logger.info('Saving BVAL file: %s' % bval_file)
      with open(bval_file, 'w') as text_file:
          # join the bvals using a space and write to the file
          text_file.write('%s\n' % ' '.join(map(str, bvals)))
docs: Write an array of bvals to a bval file
  
      :param bvals: array with the values
      :param bval_file: filepath to write to