cosanlab / nltools

Python toolbox for analyzing imaging data
https://nltools.org
MIT License
120 stars 42 forks source link

align with SRM model doesn't allow different numbers of samples even if num features is the same #410

Open ejolly opened 1 year ago

ejolly commented 1 year ago

Currently we let the srm external module handle this which throws the error, however this works with method='procrustes' because we manually pad matrices before alignment. @ljchang I thought the probabilistic SRM handled this implicitly but maybe the version we're using is out of date?

aligned = align(subs, method="probabilistic_srm")

[195](file:///home/ejolly/miniconda3/envs/torch/lib/python3.9/site-packages/nltools/external/srm.py?line=194)         assert_all_finite(X[subject])
    [196](file:///home/ejolly/miniconda3/envs/torch/lib/python3.9/site-packages/nltools/external/srm.py?line=195)     if X[subject].shape[1] != number_trs:
--> [197](file:///home/ejolly/miniconda3/envs/torch/lib/python3.9/site-packages/nltools/external/srm.py?line=196)         raise ValueError("Different number of samples between subjects" ".")
    [199](file:///home/ejolly/miniconda3/envs/torch/lib/python3.9/site-packages/nltools/external/srm.py?line=198) # Run SRM
    [200](file:///home/ejolly/miniconda3/envs/torch/lib/python3.9/site-packages/nltools/external/srm.py?line=199) self.sigma_s_, self.w_, self.mu_, self.rho2_, self.s_ = self._srm(X)

ValueError: Different number of samples between subjects.