how to save list of SourceEstimate

  • MNE version: 1.6.1
  • operating system: Windows 10
    Hello,

I want to save the list of SourceEstimate and is there any solution to save it?
MY CODE:

from mne.minimum_norm import apply_inverse_epochs
stc_1= apply_inverse_epochs(
epochs_downsampled,
inverse_operator,
lambda2,
method=method,
pick_ori=“normal”,nave=evoked.nave)

and i try to save ‘stc_1’

Thanks!!!

Hi and welcome to the forum!

You can use stc_1.save() so save your source estimate.

Best wishes,
Richard

Thanks so much for your reply!!
But when i tried with this,is will shows the problem:

stc_all_show.save(‘test’, overwrite=True)
Traceback (most recent call last):
File “C:\Users\ccc.conda\envs\MNE_mri\lib\site-packages\IPython\core\interactiveshell.py”, line 3577, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File “”, line 1, in
stc_all_show.save(‘test’, overwrite=True)
AttributeError: ‘list’ object has no attribute ‘save’

stc_all_show is :

Thanks!!

Oh, I’m sorry, I didn’t realize it’s about an entire list of source estimates. I don’t think MNE has a built-in function for this yet. Is calculating the STC from an evoked not an option for you?

Best wishes,
Richard

Thanks! Finally, I saved the list with a loop:

stc_all =
for f in range(0,480):
save_name = results_file+‘trial-’+str(f)
stc_all[f].save(save_name, overwrite=True)

My dataset is formed as 35subs*480 trials *1200time points *306channels and i would like to see the difference between first 240 trials and last 240 trials. What i am doing is to calculate the stc of each trials, and morph them to fsaverage, and then do the statistic analysis.

STC from an evoked is really an option. In this way, i can calculate first 240 trials and last 240 trials separately, but i cannot get the trial dimension at the end.

will these two processes have different results?