From 6fdc17158ac739677e173ac8a7f4b44dd32e7776 Mon Sep 17 00:00:00 2001 From: "William F. Broderick" Date: Thu, 10 Oct 2024 18:44:22 -0400 Subject: [PATCH] adds metamer comparison RGC init --- Snakefile | 7 +- foveated_metamers/compose_figures.py | 19 +- ...omparison_cutout_RGC_natural-seed_init.svg | 533 ++++++++++++++++++ 3 files changed, 547 insertions(+), 12 deletions(-) create mode 100644 reports/figures/metamer_comparison_cutout_RGC_natural-seed_init.svg diff --git a/Snakefile b/Snakefile index 9afcaa1..990f859 100644 --- a/Snakefile +++ b/Snakefile @@ -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)", @@ -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, @@ -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"), diff --git a/foveated_metamers/compose_figures.py b/foveated_metamers/compose_figures.py index 85ee7ae..9b49fe4 100644 --- a/foveated_metamers/compose_figures.py +++ b/foveated_metamers/compose_figures.py @@ -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. @@ -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 @@ -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] @@ -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) @@ -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 @@ -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 @@ -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 diff --git a/reports/figures/metamer_comparison_cutout_RGC_natural-seed_init.svg b/reports/figures/metamer_comparison_cutout_RGC_natural-seed_init.svg new file mode 100644 index 0000000..d2c4277 --- /dev/null +++ b/reports/figures/metamer_comparison_cutout_RGC_natural-seed_init.svg @@ -0,0 +1,533 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Performance: 100% + Performance: 100% + Performance: 50% + + + + + + + + + + + + + + + + + +