diff --git a/stimuli/papers/domijan2015.py b/stimuli/papers/domijan2015.py index 1d1f292a..7f2f4f3d 100644 --- a/stimuli/papers/domijan2015.py +++ b/stimuli/papers/domijan2015.py @@ -133,58 +133,51 @@ def gen_all(ppd=PPD, skip=False): return stims -def resolve_input(inpt): - if isinstance(inpt, (float, int)): - inpt = (inpt, None) - if inpt is None: - inpt = (None, None) - if len(inpt) > 2: - raise ValueError("argument has too many dimensions") - return inpt +def resolve(shape, visual_size, ppd, original_visual_size): + # Put in canonical form + shape = resolution.validate_shape(shape) + visual_size = resolution.validate_visual_size(visual_size) + ppd = resolution.validate_ppd(ppd) -def get_conversion_1d(original_shape, shape, visual_size, ppd): - if shape is None and (visual_size is None or ppd is None): - raise ValueError("You need to define two out of ppd, shape and visual_size") - if visual_size is None and (shape is None or ppd is None): - raise ValueError("You need to define two out of ppd, shape and visual_size") - - if shape is not None and ppd is not None: - conversion_fac = shape / original_shape * PPD / ppd - - if visual_size is not None and ppd is not None: - conversion_fac = visual_size / original_shape * PPD - - if shape is not None and visual_size is not None and ppd is not None: - ppd_calc = int(np.round(shape / visual_size)) - assert ppd_calc == ppd - conversion_fac = shape / original_shape * PPD / ppd - - if shape is not None and visual_size is not None and ppd is None: - ppd = int(np.round(shape / visual_size)) - conversion_fac = shape / original_shape * PPD / ppd - return conversion_fac / PPD - - -def get_conversion_2d(original_shape, shape, visual_size, ppd): + # Try to resolve height; get resizing_factor from that try: - c1 = get_conversion_1d(original_shape[0], shape[0], visual_size[0], ppd) + _, visual_angle, ppd1 = resolution.resolve_1D( + length=shape.height, visual_angle=visual_size.height, ppd=ppd.vertical + ) + v1 = visual_angle / original_visual_size[0] except Exception: - c1 = None + v1 = None + ppd1 = None + # Try to resolve width; get resizing_factor from that try: - c2 = get_conversion_1d(original_shape[1], shape[1], visual_size[1], ppd) + _, visual_angle, ppd2 = resolution.resolve_1D( + length=shape.width, visual_angle=visual_size.width, ppd=ppd.horizontal + ) + v2 = visual_angle / original_visual_size[1] except Exception: - c2 = c1 - - if c1 is None: - c1 = c2 - if c1 != c2: + v2 = None + ppd2 = None + + # Same resizing factor? + visual_resize = [i for i in (v1, v2) if i is not None] + visual_resize = np.unique(visual_resize) + if len(visual_resize) != 1: + # Different resizing factors -> not allowed raise ValueError( "Requested shape/visual_size is impossible given the stimulus defaults. " "Consider setting either the height or width to None" ) - return c1 + else: + # Same factor, resolve resolution using that + visual_resize = visual_resize[0] + ppd = np.unique([i for i in (ppd1, ppd2) if i is not None]) + shape, visual_size, ppd = resolution.resolve( + shape, np.array(original_visual_size) * visual_resize, ppd + ) + + return shape, visual_size, ppd, visual_resize def dungeon(shape=SHAPES["dungeon"], ppd=PPD, visual_size=VSIZES["dungeon"]): @@ -218,34 +211,35 @@ def dungeon(shape=SHAPES["dungeon"], ppd=PPD, visual_size=VSIZES["dungeon"]): 9, 93. https://doi.org/10.3389/fnhum.2015.00093 """ - shape = resolve_input(shape) - visual_size = resolve_input(visual_size) - c = get_conversion_2d(SHAPES["dungeon"], shape, visual_size, ppd) - shape, visual_size, ppd = resolution.resolve(None, np.array(SHAPES["dungeon"]) * c, ppd) + # Resolve resolution + shape, visual_size, ppd, visual_resize = resolve(shape, visual_size, ppd, VSIZES["dungeon"]) ppd = ppd[0] + # Define parameters for each side params = { "ppd": ppd, "n_cells": 5, "target_radius": 1, - "cell_size": 10.0 * c, + "cell_size": 1.0 * visual_resize, } + # Generate each side stim1 = illusions.dungeon.dungeon_illusion( **params, intensity_background=v1, intensity_grid=v3, intensity_target=v2, ) - stim2 = illusions.dungeon.dungeon_illusion( **params, intensity_background=v3, intensity_grid=v1, intensity_target=v2, ) + stim2["mask"] *= 2 - padding = np.array((9.0, 11.0)) * c + # Pad + padding = np.array((0.9, 1.1)) * visual_resize stim1["img"] = pad_by_visual_size(stim1["img"], padding, ppd, v1) stim1["mask"] = pad_by_visual_size(stim1["mask"], padding, ppd, 0) stim2["img"] = pad_by_visual_size(stim2["img"], padding, ppd, v3) @@ -253,7 +247,7 @@ def dungeon(shape=SHAPES["dungeon"], ppd=PPD, visual_size=VSIZES["dungeon"]): # Stacking img = np.hstack([stim1["img"], stim2["img"]]) - mask = np.hstack([stim1["mask"], stim2["mask"] * 2]) + mask = np.hstack([stim1["mask"], stim2["mask"]]) params.update( original_shape=SHAPES["dungeon"], @@ -298,22 +292,20 @@ def cube(shape=SHAPES["cube"], ppd=PPD, visual_size=VSIZES["cube"]): 9, 93. https://doi.org/10.3389/fnhum.2015.00093 """ - shape = resolve_input(shape) - visual_size = resolve_input(visual_size) - c = get_conversion_2d(SHAPES["cube"], shape, visual_size, ppd) - shape, visual_size, ppd = resolution.resolve(None, np.array(SHAPES["cube"]) * c, ppd) + # Resolve resolution + shape, visual_size, ppd, visual_resize = resolve(shape, visual_size, ppd, VSIZES["cube"]) ppd = ppd[0] params = { "ppd": ppd, "n_cells": 4, "target_length": 2, - "cell_long": 15.0 * c, - "cell_short": 11.0 * c, - "corner_cell_width": 18.0 * c, - "corner_cell_height": 18.0 * c, - "cell_spacing": 5.0 * c, - "occlusion_overlap": np.array((7,) * 4) * c, + "cell_long": 1.5 * visual_resize, + "cell_short": 1.1 * visual_resize, + "corner_cell_width": 1.8 * visual_resize, + "corner_cell_height": 1.8 * visual_resize, + "cell_spacing": 0.5 * visual_resize, + "occlusion_overlap": np.array((0.7,) * 4) * visual_resize, } stim1 = illusions.cube.cube_illusion( @@ -330,15 +322,14 @@ def cube(shape=SHAPES["cube"], ppd=PPD, visual_size=VSIZES["cube"]): ) # Padding - padding = np.array((9.0, 10.0)) * c + padding = np.array((0.9, 1.0)) * visual_resize img1 = pad_by_visual_size(stim1["img"], padding, ppd, v1) mask1 = pad_by_visual_size(stim1["mask"], padding, ppd, 0) img2 = pad_by_visual_size(stim2["img"], padding, ppd, v3) mask2 = pad_by_visual_size(stim2["mask"], padding, ppd, 0) # Increase target index of right stimulus half - mask2 = mask2 + 1 - mask2[mask2 == 1] = 0 + mask2 *= 2 # Stacking img = np.hstack([img1, img2]) @@ -387,17 +378,15 @@ def grating(shape=SHAPES["grating"], ppd=PPD, visual_size=VSIZES["grating"]): 9, 93. https://doi.org/10.3389/fnhum.2015.00093 """ - shape = resolve_input(shape) - visual_size = resolve_input(visual_size) - c = get_conversion_2d(SHAPES["grating"], shape, visual_size, ppd) - shape, visual_size, ppd = resolution.resolve(None, np.array(SHAPES["grating"]) * c, ppd) + # Resolve resolution + shape, visual_size, ppd, visual_resize = resolve(shape, visual_size, ppd, VSIZES["grating"]) ppd = ppd[0] params = { "ppd": ppd, "n_bars": 9, "target_indices": (4,), - "bar_shape": (81 * c, 10 * c), + "bar_shape": (8.1 * visual_resize, 1.0 * visual_resize), } stim1 = illusions.grating.grating_illusion( @@ -412,15 +401,14 @@ def grating(shape=SHAPES["grating"], ppd=PPD, visual_size=VSIZES["grating"]): ) # Padding - padding = np.array(((9.0, 10.0), (9.0, 11.0))) * c + padding = np.array(((0.9, 1.0), (0.9, 1.1))) * visual_resize img1 = pad_by_visual_size(stim1["img"], padding, ppd, v1) mask1 = pad_by_visual_size(stim1["mask"], padding, ppd, 0) img2 = pad_by_visual_size(stim2["img"], padding, ppd, v3) mask2 = pad_by_visual_size(stim2["mask"], padding, ppd, 0) # Increase target index of right stimulus half - mask2 = mask2 + 1 - mask2[mask2 == 1] = 0 + mask2 *= 2 # Stacking img = np.hstack([img1, img2]) @@ -469,16 +457,14 @@ def rings(shape=SHAPES["rings"], ppd=PPD, visual_size=VSIZES["rings"]): 9, 93. https://doi.org/10.3389/fnhum.2015.00093 """ - shape = resolve_input(shape) - visual_size = resolve_input(visual_size) - c = get_conversion_2d(SHAPES["rings"], shape, visual_size, ppd) - shape, visual_size, ppd = resolution.resolve(None, np.array(SHAPES["rings"]) * c, ppd) + # Resolve resolution + shape, visual_size, ppd, visual_resize = resolve(shape, visual_size, ppd, VSIZES["rings"]) ppd = ppd[0] params = { "ppd": ppd, "n_rings": 8, - "ring_width": 5.0 * c, + "ring_width": 0.5 * visual_resize, } stim1 = illusions.rings.ring_stimulus( @@ -552,16 +538,14 @@ def bullseye(shape=SHAPES["bullseye"], ppd=PPD, visual_size=VSIZES["bullseye"]): 9, 93. https://doi.org/10.3389/fnhum.2015.00093 """ - shape = resolve_input(shape) - visual_size = resolve_input(visual_size) - c = get_conversion_2d(SHAPES["bullseye"], shape, visual_size, ppd) - shape, visual_size, ppd = resolution.resolve(None, np.array(SHAPES["bullseye"]) * c, ppd) + # Resolve resolution + shape, visual_size, ppd, visual_resize = resolve(shape, visual_size, ppd, VSIZES["bullseye"]) ppd = ppd[0] params = { "ppd": ppd, "n_rings": 8, - "ring_width": 5.0 * c, + "ring_width": 0.5 * visual_resize, } stim1 = illusions.bullseye.bullseye_stimulus( @@ -635,19 +619,17 @@ def simultaneous_brightness_contrast( 9, 93. https://doi.org/10.3389/fnhum.2015.00093 """ - shape = resolve_input(shape) - visual_size = resolve_input(visual_size) - c = get_conversion_2d(SHAPES["simultaneous_brightness_contrast"], shape, visual_size, ppd) - shape, visual_size, ppd = resolution.resolve( - None, np.array(SHAPES["simultaneous_brightness_contrast"]) * c, ppd + # Resolve resolution + shape, visual_size, ppd, visual_resize = resolve( + shape, visual_size, ppd, VSIZES["simultaneous_brightness_contrast"] ) ppd = ppd[0] params = { "visual_size": visual_size[0], "ppd": ppd, - "target_size": (21 * c, 21 * c), - "target_pos": (39 * c, 39 * c), + "target_size": (2.1 * visual_resize, 2.1 * visual_resize), + "target_pos": (3.9 * visual_resize, 3.9 * visual_resize), } stim1 = illusions.sbc.simultaneous_contrast_generalized( @@ -662,12 +644,11 @@ def simultaneous_brightness_contrast( ) # Increase target index of right stimulus half - mask2 = stim2["mask"] + 1 - mask2[mask2 == 1] = 0 + stim2["mask"] *= 2 # Stacking img = np.hstack([stim1["img"], stim2["img"]]) - mask = np.hstack([stim1["mask"], mask2]) + mask = np.hstack([stim1["mask"], stim2["mask"]]) params.update( original_shape=SHAPES["simultaneous_brightness_contrast"], @@ -714,10 +695,8 @@ def white(shape=SHAPES["white"], ppd=PPD, visual_size=VSIZES["white"], pad=PAD): 9, 93. https://doi.org/10.3389/fnhum.2015.00093 """ - shape = resolve_input(shape) - visual_size = resolve_input(visual_size) - c = get_conversion_2d(SHAPES["white"], shape, visual_size, ppd) - shape, visual_size, ppd = resolution.resolve(None, np.array(SHAPES["white"]) * c, ppd) + # Resolve resolution + shape, visual_size, ppd, visual_resize = resolve(shape, visual_size, ppd, VSIZES["white"]) ppd = ppd[0] params = { @@ -725,7 +704,7 @@ def white(shape=SHAPES["white"], ppd=PPD, visual_size=VSIZES["white"], pad=PAD): "ppd": ppd, "grating_frequency": 4.0 / visual_size[1], "target_indices": (2, 5), - "target_size": 21 * c, + "target_size": 2.1 * visual_resize, "period": "full", } @@ -736,7 +715,7 @@ def white(shape=SHAPES["white"], ppd=PPD, visual_size=VSIZES["white"], pad=PAD): ) if pad: - padding = np.array((9.0, 11.0)) * c + padding = np.array((0.9, 1.1)) * visual_resize stim["img"] = pad_by_visual_size(stim["img"], padding, ppd, pad_value=v2) stim["mask"] = pad_by_visual_size(stim["mask"], padding, ppd, pad_value=0) params["padding"] = padding @@ -789,17 +768,15 @@ def benary(shape=SHAPES["benary"], ppd=PPD, visual_size=VSIZES["benary"]): 9, 93. https://doi.org/10.3389/fnhum.2015.00093 """ - shape = resolve_input(shape) - visual_size = resolve_input(visual_size) - c = get_conversion_2d(SHAPES["benary"], shape, visual_size, ppd) - shape, visual_size, ppd = resolution.resolve(None, np.array(SHAPES["benary"]) * c, ppd) + # Resolve resolution + shape, visual_size, ppd, visual_resize = resolve(shape, visual_size, ppd, VSIZES["benary"]) ppd = ppd[0] params = { - "visual_size": 81 * c, + "visual_size": 8.1 * visual_resize, "ppd": ppd, - "cross_thickness": 21 * c, - "target_size": 11 * c, + "cross_thickness": 2.1 * visual_resize, + "target_size": 1.1 * visual_resize, } stim = illusions.benary_cross.benarys_cross_rectangles( @@ -810,7 +787,7 @@ def benary(shape=SHAPES["benary"], ppd=PPD, visual_size=VSIZES["benary"]): ) # Padding - padding = np.array((9, 10.0)) * c + padding = np.array((0.9, 1.0)) * visual_resize stim["img"] = pad_by_visual_size(stim["img"], padding, ppd, pad_value=1.0) stim["mask"] = pad_by_visual_size(stim["mask"], padding, ppd, pad_value=0) @@ -858,18 +835,16 @@ def todorovic(shape=SHAPES["todorovic"], ppd=PPD, visual_size=VSIZES["todorovic" """ # Note: Compared to original, targets are moved by one pixel - shape = resolve_input(shape) - visual_size = resolve_input(visual_size) - c = get_conversion_2d(SHAPES["todorovic"], shape, visual_size, ppd) - shape, visual_size, ppd = resolution.resolve(None, np.array(SHAPES["todorovic"]) * c, ppd) + # Resolve resolution + shape, visual_size, ppd, visual_resize = resolve(shape, visual_size, ppd, VSIZES["todorovic"]) ppd = ppd[0] params = { "visual_size": visual_size[0], "ppd": ppd, - "target_size": 41 * c, - "covers_size": 31 * c, - "covers_offset": 20 * c, + "target_size": 4.1000000000000005 * visual_resize, + "covers_size": 3.1 * visual_resize, + "covers_offset": 2.0 * visual_resize, } stim1 = illusions.todorovic.todorovic_rectangle( @@ -886,12 +861,11 @@ def todorovic(shape=SHAPES["todorovic"], ppd=PPD, visual_size=VSIZES["todorovic" ) # Increase target index of right stimulus half - mask2 = stim2["mask"] + 1 - mask2[mask2 == 1] = 0 + stim2["mask"] *= 2 # Stacking img = np.hstack([stim1["img"], stim2["img"]]) - mask = np.hstack([stim1["mask"], mask2]) + mask = np.hstack([stim1["mask"], stim2["mask"]]) params.update( original_shape=SHAPES["todorovic"], @@ -943,19 +917,14 @@ def checkerboard_contrast_contrast( 9, 93. https://doi.org/10.3389/fnhum.2015.00093 """ - original_shape_np = np.array(SHAPES["checkerboard_contrast_contrast"]) - - shape = resolve_input(shape) - visual_size = resolve_input(visual_size) - conversion_fac = get_conversion_2d( - SHAPES["checkerboard_contrast_contrast"], shape, visual_size, ppd + # Resolve resolution + shape, visual_size, ppd, visual_resize = resolve( + shape, visual_size, ppd, VSIZES["checkerboard_contrast_contrast"] ) - shape, visual_size, ppd = resolution.resolve(None, original_shape_np * conversion_fac, ppd) - ppd = ppd[0] params = { "ppd": ppd, - "check_visual_size": 10 * conversion_fac, + "check_visual_size": 1.0 * visual_resize, "target_shape": (4, 4), "tau": 0.5, "alpha": 0.5, @@ -963,35 +932,40 @@ def checkerboard_contrast_contrast( "intensity_high": v3, } + # Large checkerboard, embedded target region stim1 = illusions.checkerboards.contrast_contrast( **params, board_shape=(8, 8), ) + # Isolated target region (smaller checkerboard) stim2 = illusions.checkerboards.contrast_contrast( **params, board_shape=(4, 4), ) + # Put smaller checkerboard on background (equally large as large checkerboard) + stim2["img"] = pad_to_shape(stim2["img"], stim1["img"].shape, pad_value=v2) + stim2["mask"] = pad_to_shape(stim2["mask"], stim1["mask"].shape, pad_value=0) + # Increase target index of right stimulus half - img2, mask2 = stim2["img"], stim2["mask"] + 1 - mask2[mask2 == 1] = 0 + stim2["mask"] *= 2 - # Padding - padding = 20.0 * conversion_fac + # Overall padding if pad: - padding1 = np.array((9.0, 11.0)) * conversion_fac - padding = np.array(padding1) + padding - stim1["img"] = pad_by_visual_size(stim1["img"], padding1, ppd=ppd, pad_value=v2) - stim1["mask"] = pad_by_visual_size(stim1["mask"], padding1, ppd=ppd, pad_value=0) - params["padding"] = padding1 - img2 = pad_by_visual_size(img2, padding, ppd=ppd, pad_value=v2) - mask2 = pad_by_visual_size(mask2, padding, ppd=ppd, pad_value=0) + padding = np.array((0.9, 1.1)) * visual_resize + stim1["img"] = pad_by_visual_size(stim1["img"], padding, ppd=ppd, pad_value=v2) + stim1["mask"] = pad_by_visual_size(stim1["mask"], padding, ppd=ppd, pad_value=0) + stim2["img"] = pad_by_visual_size(stim2["img"], padding, ppd=ppd, pad_value=v2) + stim2["mask"] = pad_by_visual_size(stim2["mask"], padding, ppd=ppd, pad_value=0) + params["padding"] = padding # Stacking - img = np.hstack([stim1["img"], img2]) - mask = np.hstack([stim1["mask"], mask2]) + img = np.hstack([stim1["img"], stim2["img"]]) + mask = np.hstack([stim1["mask"], stim2["mask"]]) + # Output + original_shape_np = np.array(SHAPES["checkerboard_contrast_contrast"]) original_shape = original_shape_np + np.array((20, 40)) original_visual_size = resolution.visual_size_from_shape_ppd(original_shape, PPD) params.update( @@ -1046,18 +1020,15 @@ def checkerboard( 9, 93. https://doi.org/10.3389/fnhum.2015.00093 """ - shape = resolve_input(shape) - visual_size = resolve_input(visual_size) - conversion_fac = get_conversion_2d(SHAPES["checkerboard"], shape, visual_size, ppd) - shape, visual_size, ppd = resolution.resolve( - None, np.array(SHAPES["checkerboard"]) * conversion_fac, ppd + # Resolve resolution + shape, visual_size, ppd, visual_resize = resolve( + shape, visual_size, ppd, VSIZES["checkerboard"] ) - ppd = ppd[0] params = { "ppd": ppd, "board_shape": (8, 8), - "check_visual_size": (10 * conversion_fac, 10 * conversion_fac), + "check_visual_size": (1.0 * visual_resize, 1.0 * visual_resize), "targets": [(3, 2), (5, 5)], "extend_targets": False, "intensity_low": 0, @@ -1067,7 +1038,7 @@ def checkerboard( stim = illusions.checkerboards.checkerboard(**params) if pad: - padding = np.array((9.0, 11.0)) * conversion_fac + padding = np.array((0.9, 1.1)) * visual_resize stim["img"] = pad_by_visual_size(stim["img"], padding, ppd=ppd, pad_value=v2) stim["mask"] = pad_by_visual_size(stim["mask"], padding, ppd=ppd, pad_value=0) params["padding"] = padding @@ -1128,18 +1099,15 @@ def checkerboard_extended( 9, 93. https://doi.org/10.3389/fnhum.2015.00093 """ - shape = resolve_input(shape) - visual_size = resolve_input(visual_size) - conversion_fac = get_conversion_2d(SHAPES["checkerboard_extended"], shape, visual_size, ppd) - shape, visual_size, ppd = resolution.resolve( - None, np.array(SHAPES["checkerboard_extended"]) * conversion_fac, ppd + # Resolve resolution + shape, visual_size, ppd, visual_resize = resolve( + shape, visual_size, ppd, VSIZES["checkerboard_extended"] ) - ppd = ppd[0] params = { "ppd": ppd, "board_shape": (8, 8), - "check_visual_size": (10 * conversion_fac, 10 * conversion_fac), + "check_visual_size": (1.0 * visual_resize, 1.0 * visual_resize), "targets": [(3, 2), (5, 5)], "extend_targets": True, "intensity_low": 0, @@ -1149,7 +1117,7 @@ def checkerboard_extended( stim = illusions.checkerboards.checkerboard(**params) if pad: - padding = np.array((9.0, 11.0)) * conversion_fac + padding = np.array((0.9, 1.1)) * visual_resize stim["img"] = pad_by_visual_size(stim["img"], padding, ppd=ppd, pad_value=v2) stim["mask"] = pad_by_visual_size(stim["mask"], padding, ppd=ppd, pad_value=0) params["padding"] = padding @@ -1207,11 +1175,9 @@ def white_yazdanbakhsh( 9, 93. https://doi.org/10.3389/fnhum.2015.00093 """ - shape = resolve_input(shape) - visual_size = resolve_input(visual_size) - c = get_conversion_2d(SHAPES["white_yazdanbakhsh"], shape, visual_size, ppd) - shape, visual_size, ppd = resolution.resolve( - None, np.array(SHAPES["white_yazdanbakhsh"]) * c, ppd + # Resolve resolution + shape, visual_size, ppd, visual_resize = resolve( + shape, visual_size, ppd, VSIZES["white_yazdanbakhsh"] ) ppd = ppd[0] @@ -1235,7 +1201,7 @@ def white_yazdanbakhsh( ) if pad: - padding = np.array((9.0, 11.0)) * c + padding = np.array((0.9, 1.1)) * visual_resize stim["img"] = pad_by_visual_size(stim["img"], padding, ppd=ppd, pad_value=v2) stim["mask"] = pad_by_visual_size(stim["mask"], padding, ppd=ppd, pad_value=0) params["padding"] = padding @@ -1292,10 +1258,10 @@ def white_anderson( 9, 93. https://doi.org/10.3389/fnhum.2015.00093 """ - shape = resolve_input(shape) - visual_size = resolve_input(visual_size) - c = get_conversion_2d(SHAPES["white_anderson"], shape, visual_size, ppd) - shape, visual_size, ppd = resolution.resolve(None, np.array(SHAPES["white_anderson"]) * c, ppd) + # Resolve resolution + shape, visual_size, ppd, visual_resize = resolve( + shape, visual_size, ppd, VSIZES["white_anderson"] + ) ppd = ppd[0] params = { @@ -1319,7 +1285,7 @@ def white_anderson( ) if pad: - padding = np.array((9.0, 11.0)) * c + padding = np.array((0.9, 1.1)) * visual_resize stim["img"] = pad_by_visual_size(stim["img"], padding, ppd=ppd, pad_value=v2) stim["mask"] = pad_by_visual_size(stim["mask"], padding, ppd=ppd, pad_value=0) params["padding"] = padding @@ -1374,10 +1340,8 @@ def white_howe(shape=SHAPES["white_howe"], ppd=PPD, visual_size=VSIZES["white_ho 9, 93. https://doi.org/10.3389/fnhum.2015.00093 """ - shape = resolve_input(shape) - visual_size = resolve_input(visual_size) - c = get_conversion_2d(SHAPES["white_howe"], shape, visual_size, ppd) - shape, visual_size, ppd = resolution.resolve(None, np.array(SHAPES["white_howe"]) * c, ppd) + # Resolve resolution + shape, visual_size, ppd, visual_resize = resolve(shape, visual_size, ppd, VSIZES["white_howe"]) ppd = ppd[0] params = { @@ -1399,7 +1363,7 @@ def white_howe(shape=SHAPES["white_howe"], ppd=PPD, visual_size=VSIZES["white_ho ) if pad: - padding = np.array((9.0, 11.0)) * c + padding = np.array((0.9, 1.1)) * visual_resize stim["img"] = pad_by_visual_size(stim["img"], padding, ppd=ppd, pad_value=v2) stim["mask"] = pad_by_visual_size(stim["mask"], padding, ppd=ppd, pad_value=0) params["padding"] = padding