Upper_tri() function from the rsatoolbox.util.searchlight tutorial

Hello everyone,

I am trying to do searchlight RSA using rsatoolbox with the tutorial.
I want to calculate the correlations between a conceptual RDM and a neural RDM generated in each searchlight sphere
Here is my script that I followed the tutorial, expect that

  1. I got the searchlight centers within a ROI (first line below) to reduce the computation
  2. I could not use the upper_tri(RDM) function defined in the tutorial because the error: RDM has no attribute to shape, so I manually defined it as below:
mask = mask_img.get_fdata() > 0
# mask_img is a binary mask of ROI with the same shape as the images
# in the tutorial, this line is mask = ~np.isnan(tmp_img.get_fdata()), 
# in which the nan is 0 in my case, so I use > 0 to filter the centers

centers, neighbors = get_volume_searchlight(mask, radius=4, threshold=0.5)
neural_rdms = get_searchlight_RDMs(data_2d, centers, neighbors, image_value, method='correlation')
# arguments were coded following the tutorial

# a conceptual RDM imported as .csv file and converted as a RDM
concept_rdm_array = pd.read_csv(os.path.join(save_dir, 'conceptualRDMs', 'ED', f'phoneme.csv'), index_col=0).values

### manually define the upper triangular vector of the RDM
concept_rdm_vector = concept_rdm_array[np.triu_indices_from(concept_rdm_array, k=1)]
concept_rdm_array = np.array([concept_rdm_vector])
concept_rdm = RDMs(dissimilarities=concept_rdm_array, descriptors={'conditions': conditions})
model = ModelFixed('Conceptual Model', concept_rdm)

# here I want to calculate the correlation between the conceptual RDM and the neural RDM generated in each searchlight sphere
eval_results = evaluate_models_searchlight(neural_rdms, model, eval_fixed, method='spearman')

I can successfulyl run the codes without errors, but I would like to check:

  1. Am I doing right to calculate the correlations between a conceptual RDM and a neural RDM generated in each searchlight sphere with evaluate_models_searchligh?
  2. Is my code okay to define the upper triangular vector of the conceptual RDM to calculate the correlation with the neural RDMs?
  3. I could not access the ModelFixed from the tutorial, so I could not check it in their case. Anyone knows how to access it?
# Load animal model
an_labels = np.load('118_images_files/118_animate_labels.npy')
an_RDM = np.load('118_images_files/118_animate_RDM.npy')
an_model = ModelFixed('Animate RDM', upper_tri(an_RDM))

Thank you!