Skip to content

ValueError rdm1 and rdm2 have different nan positions #347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Jiesong2358 opened this issue Sep 20, 2023 · 5 comments
Open

ValueError rdm1 and rdm2 have different nan positions #347

Jiesong2358 opened this issue Sep 20, 2023 · 5 comments

Comments

@Jiesong2358
Copy link

Thank you all so much for developing the RSAtoolbox. I am trying to run Searchlight on my own data, but encountering some errors.

When I run the pipeline with the demo data, everything works smoothly. However, when I tried to input the z maps that I got from the first-level GLM analysis on Nilearn. The code showed an error:

Exception has occurred: ValueError rdm1 and rdm2 have different nan positions File "C:\Jie_Documents\Navigation\Script\RSA\RSAtoolbox.py", line 112, in eval_results = evaluate_models_searchlight(SL_RDM, an_model, eval_fixed, method='spearman', n_jobs=3) ValueError: rdm1 and rdm2 have different nan positions

I tried t-maps, z-maps, and beta-maps, all showed this error. I also tried your demo data but with the spmT maps, the same error here. Do you have any ideas on how to deal with it? Do we need to do something before we input the data? I could supply 1-2 subjects of my data for your consideration if you need it.

thank you so much if you could give some suggestions on it!!

@JasperVanDenBosch
Copy link
Contributor

hi jiesong,
I'd be happy to look at your data, one subject should be enough. Can you send the data (link) and code to [email protected]?

@MengxingLiu
Copy link

Did you manage to figure out where went wrong here? I have the same issue. It happens on some subjects data but not others. I did exclude all the zero/nan time series when creating the centers and neighbors.

@kkkkkly
Copy link

kkkkkly commented Nov 7, 2024

hi @JasperVanDenBosch ,
Thank you for developing rsatoolbox! It is very handy and the online manuals are very helpful to newcomers like me.

I was wordering if there is any update on how to fix this issue? I got the same error when performing a between subject rsa serachlight using contrast maps generated from spm12. I looked into the SL_RDM.dissimilarities and found the rdms of the searchlights where the error occured during evaluate_models_searchlight did contain several na values. However I had masked the data so that for each map, all the values within the mask are equal to or above 0 and those outside are nan.

I truly appreciate any guidance or advice you can provide!

@JasperVanDenBosch
Copy link
Contributor

hi @JasperVanDenBosch , Thank you for developing rsatoolbox! It is very handy and the online manuals are very helpful to newcomers like me.

I was wordering if there is any update on how to fix this issue? I got the same error when performing a between subject rsa serachlight using contrast maps generated from spm12. I looked into the SL_RDM.dissimilarities and found the rdms of the searchlights where the error occured during evaluate_models_searchlight did contain several na values. However I had masked the data so that for each map, all the values within the mask are equal to or above 0 and those outside are nan.

I truly appreciate any guidance or advice you can provide!

hi @kkkkkly ,
Glad that rsatoolbox is helpful to you You mention some voxels being equal to 0. Some distance measures don't do well with all-zero patterns. This may be the cause of the NaNs. I'd recommend including these voxels in the mask.
If this is not the cause, you're welcome to send me a data sample and code to look at. Generally speaking we are not actively maintaining the searchlight code, since over the next few months we are planning to revamp this module entirely. Hope this helps..

@kkkkkly
Copy link

kkkkkly commented Nov 8, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants