Repository: PennLINC/CuBIDS

Issue:
Clarify difference between cluster numbers and actual values in variant names
Variant acquisition fields now have values in them since #432 was merged, which is great, but it made me realize that it might not be clear that some of the values are cluster numbers and others are actual values. For example, we might see `acq-VARIANTEchoTime1FlipAngle75`, where the EchoTime variant is from _cluster_ 1 and the FlipAngle is actually 75. I'd love to add a little prefix to the cluster numbers to make it clear that they're not the actual values. Basically,

`acq-VARIANTEchoTime1FlipAngle75` --> `acq-VARIANTEchoTimeC1FlipAngle75`

Discussion:

Patch:
diff --git a/cubids/utils.py b/cubids/utils.py
index ee9bb77..c0f1ab5 100644
--- a/cubids/utils.py
+++ b/cubids/utils.py
@@ -951,7 +951,7 @@ def assign_variants(summary, rename_cols):
                         cluster_val = 0
 
                     if cluster_val != dom_entity_set[f"Cluster_{col}"]:
-                        acq_str += f"{col}{int(cluster_val)}"
+                        acq_str += f"{col}C{int(cluster_val)}"
 
                 elif summary.loc[row, col] != dom_entity_set[col]:
                     if col == "HasFieldmap":


Test patch:
diff --git a/cubids/tests/test_variants.py b/cubids/tests/test_variants.py
index e8b8aea..c7f2b64 100644
--- a/cubids/tests/test_variants.py
+++ b/cubids/tests/test_variants.py
@@ -30,11 +30,13 @@ def base_df():
     pandas.DataFrame
         A DataFrame with basic structure needed for assign_variants testing
     """
-    return pd.DataFrame({
-        "ParamGroup": ["1", "2", "2"],
-        "EntitySet": ["task-test", "task-test", "task-test"],
-        "RenameEntitySet": ["", "", ""]
-    })
+    return pd.DataFrame(
+        {
+            "ParamGroup": ["1", "2", "2"],
+            "EntitySet": ["task-test", "task-test", "task-test"],
+            "RenameEntitySet": ["", "", ""],
+        }
+    )
 
 
 def test_assign_variants_with_cluster_values(base_df):
@@ -47,8 +49,8 @@ def test_assign_variants_with_cluster_values(base_df):
     result = assign_variants(base_df, ["EchoTime"])
 
     # Check that variant names include cluster values
-    assert "acquisition-VARIANTEchoTime2_" in result.loc[1, "RenameEntitySet"]
-    assert "acquisition-VARIANTEchoTime3_" in result.loc[2, "RenameEntitySet"]
+    assert "acquisition-VARIANTEchoTimeC2_" in result.loc[1, "RenameEntitySet"]
+    assert "acquisition-VARIANTEchoTimeC3_" in result.loc[2, "RenameEntitySet"]
 
 
 def test_assign_variants_mixed_parameters(base_df):
@@ -62,8 +64,8 @@ def test_assign_variants_mixed_parameters(base_df):
     result = assign_variants(base_df, ["EchoTime", "FlipAngle"])
 
     # Check variant names include both cluster values and actual values
-    assert "acquisition-VARIANTEchoTime2FlipAngle75_" in result.loc[1, "RenameEntitySet"]
-    assert "acquisition-VARIANTEchoTime3FlipAngle60_" in result.loc[2, "RenameEntitySet"]
+    assert "acquisition-VARIANTEchoTimeC2FlipAngle75_" in result.loc[1, "RenameEntitySet"]
+    assert "acquisition-VARIANTEchoTimeC3FlipAngle60_" in result.loc[2, "RenameEntitySet"]
 
 
 def test_assign_variants_special_parameters(base_df):
@@ -78,4 +80,4 @@ def test_assign_variants_special_parameters(base_df):
     # Check special parameter handling
     assert "acquisition-VARIANTOther_" in result.loc[0, "RenameEntitySet"]
     assert "acquisition-VARIANTNoFmapIsUsed_" in result.loc[1, "RenameEntitySet"]
-    assert "acquisition-VARIANTNoFmap_" in result.loc[2, "RenameEntitySet"]
\ No newline at end of file
+    assert "acquisition-VARIANTNoFmap_" in result.loc[2, "RenameEntitySet"]