Skip to content

Commit 08dcdfd

Browse files
Refined README and streamlined analysis process
1 parent 63ede62 commit 08dcdfd

File tree

5 files changed

+14
-8
lines changed

5 files changed

+14
-8
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
!/data/data_Braddick_2002_Fig3C.txt
55
/plt/fig/
66
/ana/fig/
7+
/sim/fig/
78

89
# .gitignore default for Python
910
# Byte-compiled / optimized / DLL files

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Remark (2022-07-07): This is a pre-release of the software during the review pro
2121

2222
The software has been developed and tested for Python 3.8 on Linux Mint 20.3.
2323
Detailed requirements on software packages are provided in the file `requirements.txt`.
24-
Any modern desktop computer should be sufficient to run the code.
24+
Any modern desktop computer with 16GB+ of memory should be sufficient to run the code within one or two work days.
2525

2626
## Installation
2727

@@ -115,6 +115,11 @@ Neural network simulations (`class RateNetworkMTInputStrinfAdiabaticDiagonalSigm
115115

116116
The experiments in Figures 3 to 7 are more involved. Here we outline the steps for reproducing them.
117117

118+
Before you start, create a sub-directory `/ana/fig/` for technical figures which are generated during analysis.
119+
120+
121+
**Remark:** When following the instructions, always `cd` into the script's directory, i.e., "Run `/ana/Yang_regress_and_choice.py`" means `cd ana` and then `python Yang_regress_and_choice.py`.
122+
118123

119124
### Figure 3
120125

@@ -125,7 +130,7 @@ Download the experiment trials of (Yang et al., 2021) from their [GitHub reposit
125130
Run the simulation on the trials using the config file `cfg_040_YangETAL_2021.py`. The simulation must be run for each participant separately, with the participant ID (`pid=1..12`) entered in `line 51` of the config file. Store the dataset labels in the dict `DSL` in `/ana/YangETAL_dsl.py` for the subsequent analysis.
126131

127132
#### Fit the choice model on the inferred motion strengths
128-
Run `/ana/Yang_regress_and_choice.py` which fits the choice model and stores the results in `/ana/yang_predicted_choices_by_motion_structure_inference_algorithm_CV.pkl`.
133+
Run `/ana/Yang_regress_and_choice.py` which fits the choice model and stores the results in `/ana/data_yang2021_experiment_1/yang_predicted_choices_by_motion_structure_inference_algorithm_CV.pkl`.
129134

130135
#### Plot the figure
131136
Run `/plt/plot_figure_3.py` to plot Figure 3. The script calculates the confusion matrices and choice log-likelihoods based on the file saved in the previous step. For the comparison in panel 3F, the log-likelihoods under the model of (Yang et al., 2021) are loaded from `./data/data_yang2021_experiment_1/yang_logL_exp1_4paramModel.txt`.
@@ -179,7 +184,7 @@ For this single cylinder condition, use `lines 28 to 30` of the config file (and
179184

180185
#### Analyze the simulation data for perceptual switching times
181186

182-
In the analysis script `/ana/SFM_switching_times.py`, enter the `DSL` of the long simulation in `line 11`. Running the script will extract and store the switching times in `/data/analysis_SFM_<DSL>.pkl`.
187+
In the analysis script `/ana/SFM_switching_times.py`, enter the `DSL` of the long simulation in `line 11`. Running the script will extract and store the switching times in `/data/analysis_SFM_<DSL>.pkl`. Furthermore, the script will detect the threshold value for perceptual switches (printing, e.g., `> Threshold set to ±1.18`). Note down this value.
183188

184189
#### Run the model for the nested cylinder conditions
185190

@@ -192,9 +197,9 @@ The three simulations only differ in the rotational speeds of the outer and inne
192197

193198
#### Plot the figure
194199

195-
In `/plt/plot_figure_6.py`, enter the `DSL` of the short single-cylinder simulation and of the three nested cylinder simulations in `line 15` and `lines 18 - 20`, respectively. Enter the file name of the switching times in `line 16` and run the script to plot Figure 6.
200+
In `/plt/plot_figure_6.py`, enter the `DSL` of the short single-cylinder simulation and of the three nested cylinder simulations in `line 15` and `lines 18 - 20`, respectively. Enter the file name of the switching times in `line 16` and the switching threshold in `line 17`. Run the script to plot Figure 6.
196201

197202

198203
### Figure 7
199204

200-
Run the two simulations `cfg_200_network_polar_plus_global.py` (for panels 7g-j) and `cfg_220_network_ramp_lambda.py` (for panel 7m) and enter the obtained `DSL` in `line 25` and `line 53` of `/plt/plot_figure_7.py`, respectively. Run the script to plot Figure 7.
205+
Run two simulations using the config files `cfg_200_network_polar_plus_global.py` (for panels 7g-j) and `cfg_220_network_ramp_lambda.py` (for panel 7m) and enter the obtained `DSL` in `line 25` and `line 53` of `/plt/plot_figure_7.py`, respectively. Run the script to plot Figure 7.

pkg/classDdim.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ def set_lam(self, lam):
453453
self.lam = lam
454454
self.Lam = np.diag(np.tile(self.lam, self.D))
455455
if hasattr(self, "lam2"): # if present, update the square-cache
456-
self.lam2 = self.lam**2
456+
self.lam2 = lam**2
457457

458458
def infer_strengths(self, *args, **kwargs):
459459
# 1) Call the inf_method --> lam_new

plt/plot_figure_3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# # # PARAMETERS # # #
88
ZOOM = 1.5
9-
SAVE = False
9+
SAVE = True
1010
SHOW = True
1111
PANEL = ("C", "E", "F") # The sketches in A, B, D are always plotted.
1212

sim/cfg_100_direction_repulsion_Braddick.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
D = 2 # number of spatial dimensions
2323
lam_tot = 2.0 # equivalent speed of stim
2424
nAngle = 33 # number of tested opening angles (spaced equally from 0..180 degrees)
25-
reps = 1 # trial repetitions (for each angle)
25+
reps = 20 # trial repetitions (for each angle)
2626

2727

2828
sig_obs = sig_obs * np.ones((2,3))

0 commit comments

Comments
 (0)