Skip to content

Commit

Permalink
adds metamer comparison RGC init
Browse files Browse the repository at this point in the history
  • Loading branch information
billbrod committed Oct 10, 2024
1 parent 6638b04 commit 6fdc171
Show file tree
Hide file tree
Showing 3 changed files with 547 additions and 12 deletions.
7 changes: 4 additions & 3 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ wildcard_constraints:
logscale="log|linear",
mcmc_model="partially-pooled|unpooled|partially-pooled-interactions-[.0-9]+|partially-pooled-interactions",
fixation_cross="cross|nocross",
cutout="cutout|nocutout|cutout_V1_natural-seed|cutout_RGC_natural-seed|nocutout_small|cutout_downsample|cutout_V1_natural-seed_init",
cutout="cutout|nocutout|cutout_V1_natural-seed|cutout_RGC_natural-seed|nocutout_small|cutout_downsample|cutout_V1_natural-seed_init|cutout_RGC_natural-seed_init",
compressed="|_compressed",
context="paper|poster",
mcmc_plot_type="performance|params-(linear|log)-(none|lines|ci)",
Expand Down Expand Up @@ -4048,7 +4048,8 @@ rule compose_figures:
'Luminance metamer init with white noise 2']
fig = fov.compose_figures.metamer_comparison(*input, labels,
'nocutout' not in wildcards.fig_name,
True, 'init' in wildcards.fig_name,
True,
'init' in wildcards.fig_name and 'V1' in wildcards.fig_name,
wildcards.context)
else:
fig = fov.compose_figures.metamer_comparison(*input, scaling,
Expand Down Expand Up @@ -5117,7 +5118,7 @@ def figure_paper_input(wildcards):
op.join(config['DATA_DIR'], 'figures', 'paper', 'psychophys_expt2_with_table.svg'),
op.join(config['DATA_DIR'], 'figures', 'paper', "max_dprime_asymp_perf.svg"),
# appendix figures
op.join(config['DATA_DIR'], 'compose_figures', 'paper', 'metamer_comparison_llama_scaling-.23,.23,.23,.23,.23_cutout_RGC_natural-seed_compressed.svg'),
op.join(config['DATA_DIR'], 'compose_figures', 'paper', 'metamer_comparison_llama_scaling-.23,.23,.23,.23,.23_cutout_RGC_natural-seed_init_compressed.svg'),
op.join(config['DATA_DIR'], 'figures', 'paper', 'Dacey1992_mcmc_line-nooffset_linear.svg'),
op.join(config['DATA_DIR'], 'figures', 'paper', "freeman_windows_comparison.svg"),
op.join(config['DATA_DIR'], 'compose_figures', 'paper', "performance_comparison_scaling-extended_partially-pooled_log-ci_sub-00_comp-downsample.svg"),
Expand Down
19 changes: 10 additions & 9 deletions foveated_metamers/compose_figures.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def model_schematic(schematic_fig, contour_fig_large, contour_figs_small,

def metamer_comparison(metamer_fig, labels, cutout_fig=False,
natural_seed_fig=False,
with_initialization=False,
with_offset_images=False,
context='paper'):
"""Add text labeling model metamer scaling values.
Expand All @@ -183,7 +183,7 @@ def metamer_comparison(metamer_fig, labels, cutout_fig=False,
natural_seed_fig : bool, optional
Whether this is the natural-seed version of this fig or not, which
changes how we place the labels.
with_initialization : bool, optional
with_offset_images : bool, optional
Whether this includes insets for the initial images used in metamer synthesis,
which results in a wider image and shifts label placement.
context : {'paper', 'poster'}, optional
Expand All @@ -197,10 +197,11 @@ def metamer_comparison(metamer_fig, labels, cutout_fig=False,
Figure containing composed plots
"""
if with_initialization:
text_params, figure_width = style.plotting_style(context, 'svgutils', 'extra-wide')
if with_offset_images:
width = 'extra-wide'
else:
text_params, figure_width = style.plotting_style(context, 'svgutils', 'full')
width = 'full'
text_params, figure_width = style.plotting_style(context, 'svgutils', width)
figure_width = _convert_to_pix(figure_width)
metamer_fig = SVG(metamer_fig, 'inkscape')
metamer_move = [0, 0]
Expand Down Expand Up @@ -233,7 +234,7 @@ def metamer_comparison(metamer_fig, labels, cutout_fig=False,
txt_move = [[mv[0]-offset, mv[1]] for mv, offset
in zip(txt_move, [10]+[63]*5)]
print(txt_move)
if with_initialization:
if width == 'extra-wide':
txt_move = [[mv[0]+1.5*offset, mv[1]] for mv, offset
in zip(txt_move, [63]*6)]
print(txt_move)
Expand Down Expand Up @@ -381,7 +382,7 @@ def performance_comparison(performance_fig, param_fig, subject_n=None, context='


def performance_comparison_natural(performance_fig, metamer_fig, subject_n=1,
with_initialization=False,
with_offset_images=False,
context='paper'):
"""Combine sub-00_comp-natural performance with example metamers
Expand All @@ -393,7 +394,7 @@ def performance_comparison_natural(performance_fig, metamer_fig, subject_n=1,
has been added).
subject_n : int or None, optional
If not None, add text saying "n=subject_n" on the performance_fig.
with_initialization : bool, optional
with_offset_images : bool, optional
Whether this includes insets for the initial images used in metamer synthesis,
which results in a wider image and shifts label placement.
context : {'paper', 'poster'}, optional
Expand All @@ -407,7 +408,7 @@ def performance_comparison_natural(performance_fig, metamer_fig, subject_n=1,
Figure containing composed plots
"""
if with_initialization:
if with_offset_images:
text_params, figure_width = style.plotting_style(context, 'svgutils', 'extra-wide')
figure_width = _convert_to_pix(figure_width)
figure_height = figure_width+10
Expand Down
Loading

0 comments on commit 6fdc171

Please sign in to comment.