code: def test_masked_array_with_tensor():
      data = np.ones((2, 4, 56))
      mask = np.array(
          [[True, False, False, True], [True, False, True, False]]
      )
  
      bval, bvec = read_bvals_bvecs(*get_fnames("55dir_grad"))
      gtab = grad.gradient_table_from_bvals_bvecs(bval, bvec)
  
      tensor_model = TensorModel(gtab)
      tensor = tensor_model.fit(data, mask=mask)
      npt.assert_equal(tensor.shape, (2, 4))
      npt.assert_equal(tensor.fa.shape, (2, 4))
      npt.assert_equal(tensor.evals.shape, (2, 4, 3))
      npt.assert_equal(tensor.evecs.shape, (2, 4, 3, 3))
  
      tensor = tensor[0]
      npt.assert_equal(tensor.shape, (4,))
      npt.assert_equal(tensor.fa.shape, (4,))
      npt.assert_equal(tensor.evals.shape, (4, 3))
      npt.assert_equal(tensor.evecs.shape, (4, 3, 3))
  
      tensor = tensor[0]
      npt.assert_equal(tensor.shape, tuple())
      npt.assert_equal(tensor.fa.shape, tuple())
      npt.assert_equal(tensor.evals.shape, (3,))
      npt.assert_equal(tensor.evecs.shape, (3, 3))
      npt.assert_equal(type(tensor.model_params), np.ndarray)
  
imports: import warnings
  import numpy
  import numpy.testing
  import scipy.optimize
  import dipy.reconst.dti
  from dipy.io.gradients import read_bvals_bvecs
  from dipy.reconst.dti import ols_resort_msg, axial_diffusivity, color_fa, fractional_anisotropy, from_lower_triangular, geodesic_anisotropy, lower_triangular, mean_diffusivity, radial_diffusivity, TensorModel, trace, linearity, planarity, sphericity, decompose_tensor, _decompose_tensor_nan
  from dipy.io.image import load_nifti_data
  from dipy.data import get_fnames, dsi_voxels, get_sphere
  from dipy.core.subdivide_octahedron import create_unit_sphere
  import dipy.core.gradients
  import dipy.core.sphere
  from dipy.sims.voxel import single_tensor
  from dipy.testing.decorators import set_random_number_generator
label_desc: Use image node_id 11 for calling a global function with example usage: test_masked_array_with_tensor() without return types