def write_bvec_file(bvecs, bvec_file):
    """
    Write an array of bvecs to a bvec file

    :param bvecs: array with the vectors
    :param bvec_file: filepath to write to
    """
    if bvec_file is None:
        return
    logger.info('Saving BVEC file: %s' % bvec_file)
    with open(bvec_file, 'w') as text_file:
        # Map a dicection to string join them using a space and write to the file
        text_file.write('%s\n' % ' '.join(map(str, bvecs[:, 0])))
        text_file.write('%s\n' % ' '.join(map(str, bvecs[:, 1])))
        text_file.write('%s\n' % ' '.join(map(str, bvecs[:, 2])))
def write_bvec_file ( bvecs , bvec_file ) : if bvec_file is None : return logger . info ( 'Saving BVEC file: %s' % bvec_file ) with open ( bvec_file , 'w' ) as text_file : text_file . write ( '%s\n' % ' ' . join ( map ( str , bvecs [ : , 0 ] ) ) ) text_file . write ( '%s\n' % ' ' . join ( map ( str , bvecs [ : , 1 ] ) ) ) text_file . write ( '%s\n' % ' ' . join ( map ( str , bvecs [ : , 2 ] ) ) )
Write an array of bvecs to a bvec file

    :param bvecs: array with the vectors
    :param bvec_file: filepath to write to