Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
19060a1
Updates readme with more requirements info
billbrod Dec 13, 2016
03a846d
Adds createMetamers.m
billbrod Dec 13, 2016
436e204
Bugfix: model_df now handles results without key voxel
billbrod Dec 13, 2016
623bbff
stimuli and voxel idx no longer need tmp .txt files
billbrod Dec 13, 2016
0d73b1b
Moves comparison with Kay2013 matlab implementation to own folder
billbrod Dec 13, 2016
9a72ae2
Adds metamer analysis
billbrod Dec 13, 2016
213aa3a
updates Metamers.ipynb
billbrod Dec 13, 2016
ba7cf7e
adds Kay2013_comparison/ and Metamer_images/ to gitignore
billbrod Dec 13, 2016
ede79c3
Updates metamer creation
billbrod Dec 16, 2016
057836e
Fixes angle conversion bug
billbrod Jan 17, 2017
09404cb
Adds vertex indices to model_df, centers and hemispheres to plot_df
billbrod Jan 20, 2017
3947e09
Updates stimuli creation
billbrod Jan 20, 2017
fcf8b5b
Large changes to Metamers.ipynb (WiP)
billbrod Jan 20, 2017
ccb518c
More changes to Metamers.ipynb (WiP)
billbrod Jan 25, 2017
a0039d4
Merge branch 'texture_metamers' of https://github.com/WinawerLab/sco …
billbrod Jan 26, 2017
7f7ad5b
Merge branch 'texture_metamers' of github.com:WinawerLab/sco into tex…
Jan 26, 2017
1c7d257
Updates colorbar so it correctly displays midpoint
billbrod Jan 27, 2017
b6d0a31
Updates SNR_df creation to be much more streamlined
billbrod Jan 27, 2017
0acf88f
Moves some functions out of Metamers.ipynb (still needs docs)
billbrod Jan 27, 2017
7bce536
Adds docstrings, makes more general
billbrod Jan 30, 2017
bcbc842
Merge branch 'texture_metamers' of github.com:WinawerLab/sco into tex…
billbrod Jan 30, 2017
959df2d
Updates how notebook runs and reads data
billbrod Jan 30, 2017
a74e61f
Adds basic cluster submission framework
billbrod Jan 30, 2017
fa20139
Merge branch 'texture_metamers' of github.com:WinawerLab/sco into tex…
billbrod Jan 30, 2017
62bdb42
changes to cluster submission options
billbrod Jan 31, 2017
dd909ab
Adds code to create ImageNet metamers
billbrod Jan 31, 2017
819e9a5
Rearranges util code
billbrod Jan 31, 2017
8c8d3b1
Adds extra_cols param to create_plot_df and create_SNR_df functions
billbrod Jan 31, 2017
12257b4
We only have 20 ImageNet metamers
billbrod Jan 31, 2017
e92d5e3
Makes regex more general and adds note
billbrod Feb 1, 2017
7e15451
Adds more memory for cluster submission
billbrod Feb 1, 2017
8215f8f
Adds sco/plot
billbrod Feb 1, 2017
4e4c70c
Adds create_image_df
billbrod Feb 1, 2017
4917bb1
Updates Metamers notebook to bring in line with last commits
billbrod Feb 1, 2017
1f958d4
Merge branch 'texture_metamers' of https://github.com/WinawerLab/sco …
billbrod Feb 2, 2017
7ab3701
removes cortical_image from util/init
billbrod Feb 2, 2017
78354d4
Fixed bootstrap calculation
billbrod Feb 2, 2017
dbdc463
Adds model_steps, bugfix on create_SNR_df in metamers.main
billbrod Feb 2, 2017
3c305b8
fix typo
billbrod Feb 2, 2017
cda0a09
create_image_df more a little more general
billbrod Feb 3, 2017
1aeb4f5
some notebook changes
billbrod Feb 3, 2017
9e50c64
Replaces image_df with image_struct
billbrod Feb 4, 2017
605ab27
Made some changes to how the code is laid out
billbrod Feb 4, 2017
2f60f52
Fixed typo: corrects how image_type named
billbrod Feb 5, 2017
9731c74
Adds set_minmax boolean flag
billbrod Feb 5, 2017
71fff42
updates docstrings
billbrod Feb 5, 2017
1dec51c
makes colorbar optional for plot_images
billbrod Feb 5, 2017
0dffe17
WiP both notebooks
billbrod Feb 7, 2017
b66fc9c
bugfix: SNR_df correctly melts and saves now
billbrod Feb 7, 2017
97a8f56
Resets model_steps in SCO_KWARGS
billbrod Feb 7, 2017
bade976
change default bootstrap_num to 1000 for metamers.main
billbrod Feb 7, 2017
a443f2c
Merge branch 'texture_metamers' of github.com:WinawerLab/sco into tex…
billbrod Feb 7, 2017
7a230c6
Adds _facet_plot_shape_df
billbrod Feb 7, 2017
aee8964
Adds plot_cortical_iamges_diff
billbrod Feb 7, 2017
451ee83
Updates cluster_submit.py docstring
billbrod Feb 14, 2017
9dceef7
Bugfix: plot_cortical_images_diff function calls should be relative
billbrod Feb 14, 2017
395abaa
Adds pysurfer_plot_predictions to sco.plot
billbrod Feb 14, 2017
ac2bf4b
Cleans up Compare_wih_Kay2013 notebook
billbrod Feb 14, 2017
d70cec9
Makes pysurfer optional
billbrod Feb 14, 2017
0df5437
Cleans up, documents, and explains metamer analysis
billbrod Feb 14, 2017
387b9b3
Final run of Metamers.ipynb with new data
billbrod Feb 16, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,8 @@ scratch.ipynb
stimuli.mat

# svg images
*.svg
*.svg

# the directories containing outputs
Kay2013_comparison/
Metamer_images/
2,330 changes: 1,976 additions & 354 deletions Compare_with_Kay2013.ipynb

Large diffs are not rendered by default.

114 changes: 77 additions & 37 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,68 +3,108 @@ SHELL := /bin/bash
# for all full stimuli, use the following:
STIMULI_IDX_full = $(shell seq 69 224)

# for testing:
# STIMULI_IDX_full := $(shell seq 69 73)

# for all sweep stimuli, use the following (and honestly, this is
# small enough that you don't need to use something else for testing)
STIMULI_IDX_sweep = $(shell seq 0 33)

# for testing:
# STIMULI_IDX_full := $(shell seq 69 73)
VOXEL_IDX = $(shell seq 0 3)

VOXEL_IDX = $(shell seq 0 9)
# these defaults are probably fine
BRODATZ_METAMER_IDX = $(shell seq 1 15)
FREEMAN2013_METAMER_IDX = $(shell seq 1 15)
IMAGENET_METAMER_IDX = $(shell seq 1 20)
NUM_SCALES=4
NUM_ORIENTATIONS=4
SIZE_NEIGHBORHOOD=7
METAMER_SEEDS = $(shell seq 1 5)

# KNK_PATH=/home/billbrod/Documents/Kendrick-socmodel/code/
KNK_PATH=/Users/winawerlab/matlab/git/knkutils/
# these you probably need to change
KNK_PATH=~/matlab/git/knkutils/
SUBJ=test-sub
SUBJ_DIR=/Volumes/server/Freesurfer_subjects
# SUBJ_DIR=/home/billbrod/Documents/SCO-test-data/Freesurfer_subjects
TEXTURE_SYNTH_PATH=~/matlab/git/textureSynth/
PYR_TOOLS_PATH=~/matlab/git/matlabPyrTools-master


# make sure matlab is in your path, which it may not be by default if you're on Mac.

# for our stimuli, we use the pictures from Kay2013, which Kendrick
# provides on his website.
full_stimuli.mat :
wget -q http://kendrickkay.net/socmodel/stimuli.mat -O ./full_stimuli.mat
Kay2013_comparison :
mkdir $@

Kay2013_comparison/full_stimuli.mat : Kay2013_comparison
wget -q http://kendrickkay.net/socmodel/stimuli.mat -O ./Kay2013_comparison/full_stimuli.mat
# we need to do this to get the stimuli.mat into the format we want
matlab -nodesktop -nodisplay -r "load('$@','images'); save('$@','images'); quit"

sweep_stimuli.mat : full_stimuli.mat
python2.7 pRF_check.py $< {}_stimuli.mat
Kay2013_comparison/sweep_stimuli.mat : Kay2013_comparison/full_stimuli.mat
python2.7 pRF_check.py $< Kay2013_comparison/{}_stimuli.mat

Metamer_images :
mkdir $@

# primarily using Freeman 2013 stimuli now, so this might not be relevant.
Metamer_images/Original_Brodatz_seed_images : Metamer_images
wget -q http://multibandtexture.recherche.usherbrooke.ca/images/Original_Brodatz.zip -O ./Original_Brodatz.zip
unzip ./Original_Brodatz.zip -d Metamer_images
mv Metamer_images/Original\ Brodatz Metamer_images/Original_Brodatz_seed_images
rm Original_Brodatz.zip

Metamer_images/Brodatz_metamers : Metamer_images/Original_Brodatz_seed_images/
mkdir $@
matlab -nodesktop -nodisplay -r "createMetamers('$(TEXTURE_SYNTH_PATH)', '$(PYR_TOOLS_PATH)', '$(KNK_PATH)','$</*.gif', '$@', [$(BRODATZ_METAMER_IDX)], $(NUM_SCALES), $(NUM_ORIENTATIONS), $(SIZE_NEIGHBORHOOD), 20, 5); quit;"

Metamer_images/Freeman2013_seed_images : Metamer_images
wget -q https://files.osf.io/v1/resources/9bxut/providers/osfstorage/589e2fa06c613b01f7b350a2/?zip= -O ./Freeman2013.zip
jar xvf ./Freeman2013.zip
mkdir $@
mv tex*im*png $@
rm Freeman2013.zip

Metamer_images/Freeman2013_metamers : Metamer_images/Freeman2013_seed_images/
mkdir $@
matlab -nodesktop -nodisplay -r "createMetamers('$(TEXTURE_SYNTH_PATH)', '$(PYR_TOOLS_PATH)', '$(KNK_PATH)','$</tex-320x320-im*-smp1.png', '$@', [$(FREEMAN2013_METAMER_IDX)], $(NUM_SCALES), $(NUM_ORIENTATIONS), $(SIZE_NEIGHBORHOOD), 20, [$(METAMER_SEEDS)]); quit;"

Metamer_images/ImageNet_seed_images : Metamer_images
wget -q https://files.osf.io/v1/resources/9bxut/providers/osfstorage/589e2f98594d9001fa121288/?zip= -O ./ImageNet.zip
jar xvf ./ImageNet.zip
mkdir $@
mv im*png $@
mv im*JPEG $@
rm ImageNet.zip

Metamer_images/ImageNet_metamers : Metamer_images/ImageNet_seed_images/
mkdir $@
matlab -nodesktop -nodisplay -r "createMetamers('$(TEXTURE_SYNTH_PATH)', '$(PYR_TOOLS_PATH)', '$(KNK_PATH)','$</im*', '$@', [$(IMAGENET_METAMER_IDX)], $(NUM_SCALES), $(NUM_ORIENTATIONS), $(SIZE_NEIGHBORHOOD), 20, [$(METAMER_SEEDS)]); quit;"

# this will also create soc_model_params_%_image_names.mat in the same call
soc_model_params_%.csv : %_stimuli.mat
Kay2013_comparison/soc_model_params_%.csv : Kay2013_comparison/%_stimuli.mat
python2.7 model_comparison_script.py $< $(SUBJ) $@ $(STIMULI_IDX_$*) -v $(VOXEL_IDX) -s $(SUBJ_DIR)

voxel_idx.txt :
# we don't need to increment these voxel indices because this
# refers to actual values in the dataframe / table
echo $(VOXEL_IDX) > $@

%_stim_idx.txt :
echo $(STIMULI_IDX_$*) > $@
# for stimuli indices, we need to increment them by one to
# turn them from python into matlab indices.
python2.7 sco/model_comparison/py_to_matlab.py -p2m $@

MATLAB_soc_model_params_%.csv : soc_model_params_%.csv voxel_idx.txt %_stim_idx.txt
matlab -nodesktop -nodisplay -r "cd $(shell pwd)/sco/model_comparison; compareWithKay2013('$(KNK_PATH)', '$(shell pwd)/$*_stimuli.mat', '$(shell pwd)/$*_stim_idx.txt', '$(shell pwd)/voxel_idx.txt', '$(shell pwd)/$<', '$(shell pwd)/soc_model_params_$*_image_names.mat', '$(shell pwd)/$@'); quit;"
Kay2013_comparison/MATLAB_soc_model_params_%.csv : Kay2013_comparison/soc_model_params_%.csv
# we increment the stimuli index and not the voxel index,
# because the voxel indices refer to a column in the
# dataframe/table, while the stimuli indices will actually be
# used to grab something from an array in matlab
matlab -nodesktop -nodisplay -r "cd $(shell pwd)/sco/model_comparison; compareWithKay2013('$(KNK_PATH)', '$(shell pwd)/Kay2013_comparison/$*_stimuli.mat', [$(STIMULI_IDX_$*)]+1, [$(VOXEL_IDX)], '$(shell pwd)/$<', '$(shell pwd)/Kay2013_comparison/soc_model_params_$*_image_names.mat', '$(shell pwd)/$@'); quit;"

.PHONY : %_images
# this will create several images, with names based on the default options in sco/model_comparison/core.py
%_images : MATLAB_soc_model_params_%.csv %_stimuli.mat soc_model_params_%.csv
python2.7 sco/model_comparison/core.py $* $< soc_model_params_$*_image_names.mat sco/model_comparison/stimuliNames.mat $*_stimuli.mat $(STIMULI_IDX_$*)

.PHONY : cleantmps
cleantmps :
-rm voxel_idx.txt
-rm stim_idx.txt
%_images : Kay2013_comparison/MATLAB_soc_model_params_%.csv Kay2013_comparison/%_stimuli.mat Kay2013_comparison/soc_model_params_%.csv
python2.7 sco/model_comparison/core.py $* $< Kay2013_comparison/soc_model_params_$*_image_names.mat sco/model_comparison/stimuliNames.mat Kay2013_comparison/$*_stimuli.mat $(STIMULI_IDX_$*)
mv SCO_model_comparison*.svg Kay2013_comparison/

.PHONY : %clean
%clean : cleantmps
-rm soc_model_params_$*.csv
-rm soc_model_params_$*_image_names.mat
-rm MATLAB_soc_model_params_$*.csv
-rm soc_model_params_$*_results_dict.pkl
%clean :
-rm Kay2013_comparison/soc_model_params_$*.csv
-rm Kay2013_comparison/soc_model_params_$*_image_names.mat
-rm Kay2013_comparison/MATLAB_soc_model_params_$*.csv
-rm Kay2013_comparison/soc_model_params_$*_results_dict.pkl

# this way these won't be deleted as unnecessary intermediates. These
# take a while to make, so we don't want to do that.
.PRECIOUS : soc_model_params_%.csv MATLAB_soc_model_params_%.csv
.PRECIOUS : Kay2013_comparison/soc_model_params_%.csv Kay2013_comparison/MATLAB_soc_model_params_%.csv Kay2013_comparison/full_stimuli.mat
Loading