rename single contrast column to intercept
@@ -587,6 +587,13 @@ class BIDSStatsModelsNodeOutput:
var_names = list(self.node.model['x'])
+ # If a single incoming contrast, set to intercept
+ if ('contrast' in df.columns and df['contrast'].nunique() == 1):
+ unique_in_contrast = df['contrast'].unique()[0]
+ df.rename({unique_in_contrast:'intercept'})
+ else:
+ unique_in_contrast = None
+
# Handle the special 1 construct.
# Add column of 1's to the design matrix called "intercept"
if 1 in var_names:
@@ -594,12 +601,6 @@ class BIDSStatsModelsNodeOutput:
if 'intercept' not in df.columns:
df.insert(0, 'intercept', 1)
- # If a single incoming contrast
- if ('contrast' in df.columns and df['contrast'].nunique() == 1):
- unique_in_contrast = df['contrast'].unique()[0]
- else:
- unique_in_contrast = None
-
var_names = expand_wildcards(var_names, df.columns)
# Verify all X names are actually present
