Skip to content

Commit 27dc742

Browse files
committed
paper examples and bugfix in simulate
1 parent 521e902 commit 27dc742

File tree

5 files changed

+232
-6
lines changed

5 files changed

+232
-6
lines changed

demos/demo_fmri_spm.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@
433433
],
434434
"metadata": {
435435
"kernelspec": {
436-
"display_name": "env",
436+
"display_name": "base",
437437
"language": "python",
438438
"name": "python3"
439439
},
@@ -447,7 +447,7 @@
447447
"name": "python",
448448
"nbconvert_exporter": "python",
449449
"pygments_lexer": "ipython3",
450-
"version": "3.11.2"
450+
"version": "3.11.5"
451451
},
452452
"orig_nbformat": 4
453453
},

demos/paper_examples/sim_crossval.ipynb

+94
Large diffs are not rendered by default.

demos/paper_examples/sim_crossval.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def crossval_sim(n_part=2,n_cond=4,n_sim=10,n_channel=200,sigma='iid'):
1515
Low numbers of partitions to emphasize increase in variance.
1616
"""
1717

18-
cond_vec,part_vec = rsa.simulation.make_design(n_cond,n_part)
18+
cond_vec,part_vec = pcm.sim.make_design(n_cond,n_part)
1919
true_dist = np.array([2,1,0,3,2,1])
2020
dist_type = np.array([1,2,3,4,5,6])
2121
D = sd.squareform(true_dist)

demos/paper_examples/sim_mahalanobis.ipynb

+132
Large diffs are not rendered by default.

src/rsatoolbox/simulation/sim.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def make_dataset(model, theta, cond_vec, n_channel=30, n_sim=1,
109109
if noise_cov_trial is None:
110110
noise_chol_trial = None
111111
else:
112-
if noise_cov_trial.shape != (n_channel, n_channel):
112+
if noise_cov_trial.shape != (n_obs, n_obs):
113113
raise ValueError("noise covariance for trials needs to be \
114114
n_obs x n_obs array")
115115
noise_chol_trial = np.linalg.cholesky(noise_cov_trial)
@@ -126,9 +126,9 @@ def make_dataset(model, theta, cond_vec, n_channel=30, n_sim=1,
126126
des = {"signal": signal, "noise": noise,
127127
"model": model.name, "theta": theta}
128128
dataset_list = []
129-
for _ in range(0, n_sim):
129+
for n in range(0, n_sim):
130130
# If necessary - make a new signal
131-
if not use_same_signal:
131+
if n==0 or not use_same_signal:
132132
true_U = make_signal(G, n_channel, use_exact_signal,
133133
signal_chol_channel)
134134
# Make noise with normal distribution

0 commit comments

Comments
 (0)