Jfortin1 / neuroCombat

Harmonization of multi-site imaging data with ComBat (Python)
MIT License
124 stars 37 forks source link

invalid value encountered in divide #27

Open AmericaBG opened 1 year ago

AmericaBG commented 1 year ago

Hi @Jfortin1! Happy to greet you! First of all, thank you very much for your contributions in the field of harmonization!

I'm trying to use neuroHarmonize that run over combat, but I have an error that I've seen that you have solved before: image I've tried to modify the combat.py code but I can't get the whole implementation to work. Could you indicate me which lines of code should I modify please? The problem is in line 190 in harmonizationLearn.py image

Thank you very much in advance!!

weifanliao commented 1 year ago

Hello, I also encountered the same problem. Have you solved it? image This is my final output image Thank you very much in advance!!

bolzeniusj commented 6 months ago

I just encountered this and figured out what was causing it for me. My batch col had 3 levels in it - I coincidentally had only n=1 for the 3rd label, so temporarily set it to 2 instead of 3 and the program worked successfully. Will need to dig into why that is exactly and how to work around it in the future but for now I'll just go down to 2 levels.