1+ import numpy as np
2+ from mne .source_estimate import SourceEstimate
3+
4+ # Create dummy data for the SourceEstimate
5+ n_vertices_lh = 10 # Number of vertices in the left hemisphere
6+ n_vertices_rh = 12 # Number of vertices in the right hemisphere
7+ n_times = 5 # Number of time points
8+
9+ # Random data for the left and right hemispheres
10+ data = np .random .rand (n_vertices_lh + n_vertices_rh , n_times )
11+
12+ # Vertices for the left and right hemispheres
13+ vertices = [np .arange (n_vertices_lh ), np .arange (n_vertices_rh )]
14+
15+ # Time parameters
16+ tmin = 0.0 # Start time in seconds
17+ tstep = 0.1 # Time step in seconds
18+
19+ # Subject name
20+ subject = "sample_subject"
21+
22+ # Create a SourceEstimate object
23+ stc = SourceEstimate (data , vertices , tmin , tstep , subject = subject )
24+
25+ # Save the SourceEstimate in different formats
26+ output_dir = "./output_files" # Directory to save the files
27+ import os
28+ os .makedirs (output_dir , exist_ok = True )
29+
30+ stc .save ("test.h5" ,overwrite = True )
31+ stc .save ("test-lh.stc" ,overwrite = True )
32+ # # Save as .stc file
33+ # stc.save(f"{output_dir}/dummy", ftype="stc", overwrite=True)
34+
35+ # # Save as .h5 file
36+ # stc.save(f"{output_dir}/dummy.h5", ftype="h5", overwrite=True)
37+
38+ # print(f"Dummy files saved in {output_dir}")
0 commit comments