Repository: rsagroup/rsatoolbox

Issue:
Concat() should set dissimilarity measure if it is identical
Concat currently does not set the `dissimilarity_measure` attribute

Discussion:

Patch:
diff --git a/src/rsatoolbox/rdm/rdms.py b/src/rsatoolbox/rdm/rdms.py
index 655ad3d7..b64a8f59 100644
--- a/src/rsatoolbox/rdm/rdms.py
+++ b/src/rsatoolbox/rdm/rdms.py
@@ -569,8 +569,14 @@ def concat(*rdms):
         rdm.dissimilarities
         for rdm in rdms_list
         ], axis=0)
+    # Set dissimilarity measure if it's the same for all rdms in list
+    if len(set(r.dissimilarity_measure for r in rdms_list)) == 1:
+        dissimilarity_measure = rdms_list[0].dissimilarity_measure
+    else:
+        dissimilarity_measure = None
     rdm = RDMs(
         dissimilarities=dissimilarities,
+        dissimilarity_measure=dissimilarity_measure,
         rdm_descriptors=rdm_descriptors,
         descriptors=rdms_list[0].descriptors,
         pattern_descriptors=rdms_list[0].pattern_descriptors


Test patch:
diff --git a/tests/test_rdm.py b/tests/test_rdm.py
index b1429970..50c194bf 100644
--- a/tests/test_rdm.py
+++ b/tests/test_rdm.py
@@ -324,6 +324,7 @@ class TestRDM(unittest.TestCase):
         rdms = concat((rdms1, rdms2))
         self.assertEqual(rdms.n_rdm, 16)
         assert len(rdms.rdm_descriptors['session']) == 16
+        self.assertEqual(rdms.dissimilarity_measure, mes)
 
     def test_concat_varargs_multiple_rdms(self):
         from rsatoolbox.rdm import concat