Skip to content

Commit cb6db6a

Browse files
minor fixes including spaces
1 parent 7a401c4 commit cb6db6a

File tree

3 files changed

+40
-2
lines changed

3 files changed

+40
-2
lines changed

mne/tests/test_source_estimate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,8 @@ def attempt_assignment(stc, attr, val):
480480
def test_io_stc(tmp_path):
481481
"""Test IO for STC files."""
482482
stc = _fake_stc()
483-
stc.save(tmp_path / "tmp.stc")
484-
stc2 = read_source_estimate(tmp_path / "tmp.stc")
483+
stc.save(tmp_path/"tmp.stc", overwrite=True)
484+
stc2 = read_source_estimate(tmp_path/"tmp.stc")
485485
assert_array_almost_equal(stc.data, stc2.data)
486486
assert_array_almost_equal(stc.tmin, stc2.tmin)
487487
assert_equal(len(stc.vertices), len(stc2.vertices))

sample.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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}")

test.h5

15.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)