Upscale to collection sampling rate prior to resampling
@@ -319,9 +319,11 @@ class BIDSRunVariableCollection(BIDSVariableCollection):
continue
if isinstance(var, SparseRunVariable):
if force_dense and is_numeric_dtype(var.values):
- _variables[name] = var.to_dense(sampling_rate)
- else:
- # None if in_place; no update needed
+ var = var.to_dense(self.sampling_rate)
+ if self.sampling_rate == sampling_rate:
+ _variables[name] = var
+ continue
+
_var = var.resample(sampling_rate,
inplace=in_place,
kind=kind)
