def create_stimulus(info, return_env=False): control(info) import numpy as np fx, fy, ft = mc.get_grids(info[height], info[width], info[frame]) env_color = 1 env_orientation = 1 env_radial = 1 env_speed = 1 if (info[color] == True): if (info[ft_0] == True): ft_0_color = np.inf else: ft_0_color = 1 env_color = mc.envelope_color(fx, fy, ft, alpha=info[alpha], ft_0=ft_0_color) if (info[orientation] == True): env_orientation = mc.envelope_orientation(fx, fy, ft, theta=info[theta], B_theta=info[B_theta]) if (info[radial] == True): if (info[ft_0b] == True): ft_0_radial = np.inf else: ft_0_radial = 1 env_radial = mc.envelope_radial(fx, fy, ft, sf_0=info[sf_0], B_sf=info[B_sf], ft_0=ft_0_radial, loggabor=info[loggabor]) if (info[speed] == True): env_speed = mc.envelope_speed(fx, fy, ft, V_X=info[V_X], V_Y=info[V_Y], B_V=info[B_V]) env = env_color * env_orientation * env_radial * env_speed if (info[random_cloud] == True): if (info[seed] == 'None'): seed_t = None else: seed_t = int(info[seed]) env = mc.random_cloud(env, seed=seed_t, impulse=info[impulse], do_amp=info[do_amp]) env = mc.rectif(env, contrast=1.) env = env * 255 if (return_env == True): return (env) stimulus = np.zeros([info[height], info[width], info[frame], 3]).astype(int) if (info[isoluminance] == True): stimulus[:, :, :, 0] = env stimulus[:, :, :, 1] = 255 - env stimulus[:, :, :, 2] = 127 else: for i in range(3): stimulus[:, :, :, i] = env[:, :, :] return(stimulus)
def create_stimulus(info, return_env=False): control(info) import numpy as np fx, fy, ft = mc.get_grids(info[height], info[width], info[frame]) env_color = 1 env_orientation = 1 env_radial = 1 env_speed = 1 if (info[color] == True): if (info[ft_0] == True): ft_0_color = np.inf else: ft_0_color = 1 env_color = mc.envelope_color(fx, fy, ft, alpha=info[alpha], ft_0=ft_0_color) if (info[orientation] == True): env_orientation = mc.envelope_orientation(fx, fy, ft, theta=info[theta], B_theta=info[B_theta]) if (info[radial] == True): if (info[ft_0b] == True): ft_0_radial = np.inf else: ft_0_radial = 1 env_radial = mc.envelope_radial(fx, fy, ft, sf_0=info[sf_0], B_sf=info[B_sf], ft_0=ft_0_radial, loggabor=info[loggabor]) if (info[speed] == True): env_speed = mc.envelope_speed(fx, fy, ft, V_X=info[V_X], V_Y=info[V_Y], B_V=info[B_V]) env = env_color * env_orientation * env_radial * env_speed if (info[random_cloud] == True): if (info[seed] == 'None'): seed_t = None else: seed_t = int(info[seed]) env = mc.random_cloud(env, seed=seed_t, impulse=info[impulse], do_amp=info[do_amp]) env = mc.rectif(env, contrast=1.) env = env * 255 if (return_env == True): return (env) stimulus = np.zeros([info[height], info[width], info[frame], 3]).astype(int) if (info[isoluminance] == True): stimulus[:, :, :, 0] = env stimulus[:, :, :, 1] = 255 - env stimulus[:, :, :, 2] = 127 else: for i in range(3): stimulus[:, :, :, i] = env[:, :, :] return (stimulus)