class_docstr: Use dti_recon to generate tensors and other maps
class_docstr_tok: ["Use","dti_recon","to","generate","tensors","and","other","maps"]
code: def _create_gradient_matrix(self, bvecs_file, bvals_file):
      _gradient_matrix_file = "gradient_matrix.txt"
      with open(bvals_file) as fbvals:
          bvals = [
              val for val in re.split(r"\s+", fbvals.readline().strip())
          ]
      with open(bvecs_file) as fbvecs:
          bvecs_x = fbvecs.readline().split()
          bvecs_y = fbvecs.readline().split()
          bvecs_z = fbvecs.readline().split()
  
      with open(_gradient_matrix_file, "w") as gradient_matrix_f:
          for i in range(len(bvals)):
              gradient_matrix_f.write(
                  f"{bvecs_x[i]}, {bvecs_y[i]}, {bvecs_z[i]}, {bvals[i]}\n"
              )
      return _gradient_matrix_file
  
imports: import os
  import re
  from ...utils.filemanip import fname_presuffix, split_filename, copyfile
  from ..base import TraitedSpec, File, traits, CommandLine, CommandLineInputSpec, isdefined
label_desc: Use image node_id 1 for calling the DTIRecon obj's underlying member method code with example usage: obj._create_gradient_matrix(bvecs_file, bvals_file) and returns: _gradient_matrix_file