def __init__(self):

        ## Simulation parameters ##

        # Simulation time
        self.simtime = 1000.0

        # Number of trials
        self.trials = 2

        # Folder to save spike times
        self.spike_folder = 'areaResponseCurves'

        # Stimulus type
        self.stim = '_disk_'

        # Start time of plots
        self.start_time = 200.0

        # disk parameters
        #        self.disk_diameters = [0.0,0.05,0.15,0.2,0.3,0.4,0.5,0.6,0.7,0.8,1.0] # degrees
        self.disk_diameters = [0.15, 0.5]  # degrees

        # Pulse parameters
        self.pulse_duration = 500.0  # ms
        self.pulse_tstart = 500.0  # ms (first 300 ms are used to fill the input and
        # output buffers of linear filters)
        self.bkg_illuminance = 250.0  # td
        self.pulse_contrast = 0.8
        self.pulse_amplitude = self.pulse_contrast * self.bkg_illuminance  # td

        # Cell to analyze
        self.selected_cell = 0
        # Cell to analyze is the center cell in every 2D grid
        self.isCenterCell = True

        # PSTH bin size
        self.bin_size = 10.0  # ms

        # Layers to track (labels for figures)
        self.labels = [
            'H1_Horizontal_cells', 'H2_Horizontal_cells',
            'Midget_bipolar_cells_L_ON', 'Midget_bipolar_cells_L_OFF',
            'Midget_bipolar_cells_M_ON', 'Midget_bipolar_cells_M_OFF',
            'Diffuse_bipolar_cells_S_ON', 'S_cone_bipolar_cells_S_ON',
            'AII_amacrine_cells', 'Midget_ganglion_cells_L_ON',
            'Midget_ganglion_cells_L_OFF', 'Midget_ganglion_cells_M_ON',
            'Midget_ganglion_cells_M_OFF',
            'Small_bistratified_ganglion_cells_S_ON'
        ]

        # Spiking layers
        self.sp_labels = [
            'Midget_ganglion_cells_L_ON', 'Midget_ganglion_cells_L_OFF',
            'Midget_ganglion_cells_M_ON', 'Midget_ganglion_cells_M_OFF',
            'Small_bistratified_ganglion_cells_S_ON'
        ]

        # Parameters of the topographical plot
        self.top_labels = [
            'Midget_ganglion_cells_L_ON', 'Midget_ganglion_cells_L_OFF'
        ]

        # Area-response labels
        self.area_labels = [
            'Midget_ganglion_cells_L_ON', 'Midget_ganglion_cells_L_OFF',
            'Midget_ganglion_cells_M_ON', 'Midget_ganglion_cells_M_OFF'
        ]

        ## Graphical parameters ##

        self.plot_intracellular = False
        self.plot_PSTH = False
        self.plot_topographical = False

        # Individual intracellular traces
        self.intracellular_rows = 6
        self.intracellular_cols = 4
        self.intracellular_video_step = 1.0  # ms
        self.intracellular_starting_row = 2
        self.intracellular_starting_col = 2

        # PSTHs
        self.PSTH_rows = 3
        self.PSTH_cols = 2
        self.PSTH_starting_row = 0
        self.PSTH_starting_col = 1

        # Topographical plot
        self.topographical_rows = 2
        self.topographical_cols = 4
        self.topographical_time_intervals = [0.0, 250.0, 500.0, 750.0, 1000.0]
        self.topographical_V_mins = [0.0, 0.0]
        self.topographical_V_maxs = [150.0, 150.0]
        self.topographical_isSpikes = True  # (False = membrane potential, True = spikes)

        # Area-response curve
        self.area_rows = 2
        self.area_cols = 2

        ## End of parameters ##

        # Initialize PSTH
        self.PSTHs = np.zeros(
            (len(self.sp_labels), int(self.simtime / self.bin_size)))

        # IDs from NEST
        self.layers_to_record = []  # For membrane potentials
        self.s_layers_to_record = []  # For spikes

        # Data recorders used in NEST simulation
        self.potentials = []
        self.spikes = []

        # Simulation object
        self.newSimulation = run_network.runNetwork(self.simtime)

        # Area-response curve
        self.area_amp = np.zeros(
            (len(self.area_labels), len(self.disk_diameters)))
        self.area_ph = np.zeros(
            (len(self.area_labels), len(self.disk_diameters)))
        self.area_recorded_models = []
        self.area_PSTH_index = []

        # Input arrays
        self.L_cone_input = np.zeros(
            (self.newSimulation.Params['N'] * self.newSimulation.Params['N'],
             int(self.newSimulation.Params['simtime'] /
                 self.newSimulation.Params['resolution'])))
        self.M_cone_input = np.zeros(
            (self.newSimulation.Params['N'] * self.newSimulation.Params['N'],
             int(self.newSimulation.Params['simtime'] /
                 self.newSimulation.Params['resolution'])))
        self.S_cone_input = np.zeros(
            (self.newSimulation.Params['N'] * self.newSimulation.Params['N'],
             int(self.newSimulation.Params['simtime'] /
                 self.newSimulation.Params['resolution'])))
        # Video of the input stimulus
        self.show_video = False
        self.inputIm = np.zeros(
            (self.newSimulation.Params['N'], self.newSimulation.Params['N'],
             int(self.newSimulation.Params['simtime'] /
                 self.newSimulation.Params['resolution'])))

        # Retinal mosaic (default: uniform distribution)
        self.mosaic = np.ones(((3, self.newSimulation.Params['N'],
                                self.newSimulation.Params['N'])))

        # Topographical plot
        self.top_layers_to_record = []
        self.top_PSTHs = np.zeros(
            (int(self.newSimulation.Params['N'] *
                 self.newSimulation.Params['N']), len(self.sp_labels),
             int(self.simtime / self.bin_size)))
        self.top_PSTH_index = []

        if (self.plot_topographical and self.topographical_isSpikes):
            self.usetop_PSTHs = True  # True = update PSTHS for topographical plot (slower)
        else:
            self.usetop_PSTHs = False
Esempio n. 2
0
    def __init__(self):

        ## Simulation parameters ##

        # Simulation time
        self.simtime = 1000.0

        # Number of trials
        self.trials = 4

        # Folder to save spike times
        self.spike_folder = 'flashing_spot'

        # ID of the stimulus type
        self.stim = '_disk_'

        # Start time of plots
        self.start_time = 200.0

        # Select disk/annulus (0 = disk, 1 = annulus)
        self.shape = 0
        # spot type (0 = white spot, 1 = black spot)
        self.spot_type = 0
        # disk/annulus parameters
        #        self.inner_radius = 0.09 # degrees (L-M pathway)
        #        self.inner_radius = 0.15 # degrees (S pathway)
        self.inner_radius = 0.5  # degrees (full-field flash)
        self.outer_radius = 0.5  # degrees

        # Pulse parameters
        self.pulse_duration = 250.0  # ms
        self.pulse_tstart = 500.0  # ms (first 300 ms are used to fill the input and
        # output buffers of linear filters)
        self.bkg_illuminance = 250.0  # td (value per cone type)
        self.pulse_contrast = 0.8
        self.pulse_amplitude = self.pulse_contrast * self.bkg_illuminance  # td

        # Cell to analyze
        self.selected_cell = 0
        # Cell to analyze is the center cell in every 2D grid
        self.isCenterCell = True

        # PSTH bin size
        self.bin_size = 10.0  # ms

        # Layers to track (labels for figures)
        self.labels = [
            'H1_Horizontal_cells', 'H2_Horizontal_cells',
            'Midget_bipolar_cells_L_ON', 'Midget_bipolar_cells_L_OFF',
            'Midget_bipolar_cells_M_ON', 'Midget_bipolar_cells_M_OFF',
            'Diffuse_bipolar_cells_S_ON', 'S_cone_bipolar_cells_S_ON',
            'AII_amacrine_cells', 'Midget_ganglion_cells_L_ON',
            'Midget_ganglion_cells_L_OFF', 'Midget_ganglion_cells_M_ON',
            'Midget_ganglion_cells_M_OFF'
            #        'Small_bistratified_ganglion_cells_S_ON'
        ]

        # Spiking layers
        self.sp_labels = [
            'Midget_ganglion_cells_L_ON', 'Midget_ganglion_cells_L_OFF',
            'Midget_ganglion_cells_M_ON', 'Midget_ganglion_cells_M_OFF'
            #        'Small_bistratified_ganglion_cells_S_ON'
        ]

        # Parameters of the topographical plot
        self.top_labels = [
            #        'Midget_bipolar_cells_L_ON',
            #        'Midget_bipolar_cells_L_OFF'
            'Midget_ganglion_cells_L_ON',
            'Midget_ganglion_cells_L_OFF'
            #        'Midget_ganglion_cells_M_ON',
            #        'Midget_ganglion_cells_M_OFF'
            #        'Small_bistratified_ganglion_cells_S_ON'
        ]

        ## Graphical parameters ##

        self.plot_intracellular = True
        self.plot_PSTH = True
        self.plot_topographical = True

        # Individual intracellular traces
        self.intracellular_rows = 6
        self.intracellular_cols = 4
        self.intracellular_video_step = 1.0  # ms
        self.intracellular_starting_row = 2
        self.intracellular_starting_col = 2

        # PSTHs
        self.PSTH_rows = 3
        self.PSTH_cols = 2
        self.PSTH_starting_row = 0
        self.PSTH_starting_col = 1

        # Topographical plot
        self.topographical_rows = 2
        self.topographical_cols = 5
        self.topographical_time_intervals = [
            450.0, 500.0, 550.0, 600.0, 750.0, 800.0
        ]
        #        self.topographical_V_mins = [-45.5, -45.5, -45.5, -45.5, -45.5]
        #        self.topographical_V_maxs = [-41.5, -41.5, -41.5, -41.5, -41.5]
        self.topographical_V_mins = [0.0, 0.0, 0.0, 0.0, 0.0]
        self.topographical_V_maxs = [200.0, 200.0, 200.0, 200.0, 200.0]
        self.topographical_isSpikes = True  # (False = membrane potential, True = spikes)

        ## End of parameters ##

        # Initialize PSTH
        self.PSTHs = np.zeros(
            (len(self.sp_labels), int(self.simtime / self.bin_size)))

        # IDs from NEST
        self.layers_to_record = []  # For membrane potentials
        self.s_layers_to_record = []  # For spikes

        # Data recorders used in NEST simulation
        self.potentials = []
        self.spikes = []

        # Simulation object
        self.newSimulation = run_network.runNetwork(self.simtime)

        # Input arrays
        self.L_cone_input = np.zeros(
            (self.newSimulation.Params['N'] * self.newSimulation.Params['N'],
             int(self.newSimulation.Params['simtime'] /
                 self.newSimulation.Params['resolution'])))
        self.M_cone_input = np.zeros(
            (self.newSimulation.Params['N'] * self.newSimulation.Params['N'],
             int(self.newSimulation.Params['simtime'] /
                 self.newSimulation.Params['resolution'])))
        self.S_cone_input = np.zeros(
            (self.newSimulation.Params['N'] * self.newSimulation.Params['N'],
             int(self.newSimulation.Params['simtime'] /
                 self.newSimulation.Params['resolution'])))
        # Video of the input stimulus
        self.show_video = False
        self.inputIm = np.zeros(
            (self.newSimulation.Params['N'], self.newSimulation.Params['N'],
             int(self.newSimulation.Params['simtime'] /
                 self.newSimulation.Params['resolution'])))

        # Retinal mosaic (default: uniform distribution)
        self.mosaic = np.ones(((3, self.newSimulation.Params['N'],
                                self.newSimulation.Params['N'])))

        # Topographical plot
        self.top_layers_to_record = []
        self.top_PSTHs = np.zeros(
            (int(self.newSimulation.Params['N'] *
                 self.newSimulation.Params['N']), len(self.sp_labels),
             int(self.simtime / self.bin_size)))
        self.top_PSTH_index = []

        if (self.plot_topographical and self.topographical_isSpikes):
            self.usetop_PSTHs = True  # True = update PSTHS for topographical plot (slower)
        else:
            self.usetop_PSTHs = False
Esempio n. 3
0
    def __init__(self):

        ## Simulation parameters ##

        # Simulation time
        self.simtime = 1000.0

        # Simulation object
        self.newSimulation = run_network.runNetwork(self.simtime)

        # Number of trials
        self.trials = 2

        # Folder to load/save spike data
        self.spike_folder = 'flashing_square'

        # Stimulus ID
        #        self.stim = '_disk_'
        self.stim = '_square_'

        # Start time of plots
        self.start_time = 200.0

        # Record membrane potentials
        self.record_Vm = False

        # Cell to analyze
        self.selected_cell = []
        # Cell to analyze is the center cell in every 2D grid
        self.isCenterCell = True

        # size of each layer (number of cells)
        N_r = self.newSimulation.Params['N_LGN']
        N_c = self.newSimulation.Params['N_cortex']

        # PSTH bin size
        self.bin_size = 10.0  # ms

        # Layers to track
        self.labels = [
            'Parvo_LGN_relay_cell_L_ON', 'Parvo_LGN_relay_cell_L_OFF',
            'Parvo_LGN_relay_cell_M_ON', 'Parvo_LGN_relay_cell_M_OFF',
            'Parvo_LGN_interneuron_ON', 'Parvo_LGN_interneuron_OFF',
            'Color_Luminance_L_ON_L_OFF_vertical',
            'Color_Luminance_L_ON_L_OFF_horizontal',
            'Color_Luminance_L_OFF_L_ON_vertical',
            'Color_Luminance_L_OFF_L_ON_horizontal',
            'Color_Luminance_M_ON_M_OFF_vertical',
            'Color_Luminance_M_ON_M_OFF_horizontal',
            'Color_Luminance_M_OFF_M_ON_vertical',
            'Color_Luminance_M_OFF_M_ON_horizontal',
            'Luminance_preferring_ON_OFF_vertical',
            'Luminance_preferring_ON_OFF_horizontal',
            'Luminance_preferring_OFF_ON_vertical',
            'Luminance_preferring_OFF_ON_horizontal',
            'Color_preferring_L_ON_M_OFF', 'Color_preferring_M_ON_L_OFF',
            'Color_Luminance_inh_L_ON_L_OFF_vertical',
            'Color_Luminance_inh_L_ON_L_OFF_horizontal',
            'Color_Luminance_inh_L_OFF_L_ON_vertical',
            'Color_Luminance_inh_L_OFF_L_ON_horizontal',
            'Color_Luminance_inh_M_ON_M_OFF_vertical',
            'Color_Luminance_inh_M_ON_M_OFF_horizontal',
            'Color_Luminance_inh_M_OFF_M_ON_vertical',
            'Color_Luminance_inh_M_OFF_M_ON_horizontal',
            'Luminance_preferring_inh_ON_OFF_vertical',
            'Luminance_preferring_inh_ON_OFF_horizontal',
            'Luminance_preferring_inh_OFF_ON_vertical',
            'Luminance_preferring_inh_OFF_ON_horizontal',
            'Color_preferring_inh_L_ON_M_OFF',
            'Color_preferring_inh_M_ON_L_OFF'
        ]

        # Parameters of the topographical plot
        self.top_labels = [
            'Parvo_LGN_relay_cell_L_ON', 'Parvo_LGN_relay_cell_L_OFF',
            'Color_Luminance_L_ON_L_OFF_vertical',
            'Color_Luminance_M_ON_M_OFF_horizontal',
            'Luminance_preferring_ON_OFF_vertical',
            'Color_preferring_L_ON_M_OFF',
            'Color_Luminance_inh_L_ON_L_OFF_vertical',
            'Luminance_preferring_inh_ON_OFF_vertical',
            'Color_preferring_inh_L_ON_M_OFF'
        ]

        # Average activity of the population
        self.pop_labels = [
            'Color_Luminance_L_ON_L_OFF_vertical',
            'Color_Luminance_L_ON_L_OFF_horizontal',
            'Color_Luminance_L_OFF_L_ON_vertical',
            'Color_Luminance_L_OFF_L_ON_horizontal',
            'Color_Luminance_M_ON_M_OFF_vertical',
            'Color_Luminance_M_ON_M_OFF_horizontal',
            'Color_Luminance_M_OFF_M_ON_vertical',
            'Color_Luminance_M_OFF_M_ON_horizontal',
            'Luminance_preferring_ON_OFF_vertical',
            'Luminance_preferring_ON_OFF_horizontal',
            'Luminance_preferring_OFF_ON_vertical',
            'Luminance_preferring_OFF_ON_horizontal',
            'Color_preferring_L_ON_M_OFF', 'Color_preferring_M_ON_L_OFF',
            'Color_Luminance_inh_L_ON_L_OFF_vertical',
            'Color_Luminance_inh_L_ON_L_OFF_horizontal',
            'Color_Luminance_inh_L_OFF_L_ON_vertical',
            'Color_Luminance_inh_L_OFF_L_ON_horizontal',
            'Color_Luminance_inh_M_ON_M_OFF_vertical',
            'Color_Luminance_inh_M_ON_M_OFF_horizontal',
            'Color_Luminance_inh_M_OFF_M_ON_vertical',
            'Color_Luminance_inh_M_OFF_M_ON_horizontal',
            'Luminance_preferring_inh_ON_OFF_vertical',
            'Luminance_preferring_inh_ON_OFF_horizontal',
            'Luminance_preferring_inh_OFF_ON_vertical',
            'Luminance_preferring_inh_OFF_ON_horizontal',
            'Color_preferring_inh_L_ON_M_OFF',
            'Color_preferring_inh_M_ON_L_OFF'
        ]

        ## Graphical parameters ##

        self.plot_intracellular = False
        self.plot_PSTH = False
        self.plot_topographical = True

        # Individual intracellular traces
        self.intracellular_rows = 4
        self.intracellular_cols = 5
        self.intracellular_starting_row = 0
        self.intracellular_starting_col = 0

        # PSTHs
        self.PSTH_rows = 4
        self.PSTH_cols = 3
        self.PSTH_starting_row = 0
        self.PSTH_starting_col = 0

        # Topographical plot
        self.topographical_rows = 9
        self.topographical_cols = 5
        self.topographical_time_intervals = [
            450.0, 500.0, 550.0, 600.0, 750.0, 800.0
        ]
        self.topographical_V_mins = [
            0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
        ]
        self.topographical_V_maxs = [
            150., 150., 50., 50., 50., 50., 100., 100., 100.
        ]
        self.pop_V_mins = [0.0]
        self.pop_V_maxs = [10.0]
        self.topographical_isSpikes = True  # (False = membrane potential, True = spikes)

        ## End of parameters ##

        # Initialize PSTH
        self.PSTHs = np.zeros(
            (len(self.labels), int(self.simtime / self.bin_size)))

        # IDs from NEST
        self.layers_to_record = []

        # Data recorders used in NEST simulation
        self.potentials = []
        self.spikes = []

        # Retina references
        self.retina_labels = [
            'Midget_ganglion_cells_L_ON', 'Midget_ganglion_cells_L_OFF',
            'Midget_ganglion_cells_M_ON', 'Midget_ganglion_cells_M_OFF'
        ]
        #                'Small_bistratified_ganglion_cells_S_ON']

        # Topographical plot
        self.top_layers_to_record = []
        self.top_PSTHs = np.zeros(
            (int(self.newSimulation.Params['N_cortex'] *
                 self.newSimulation.Params['N_cortex']), len(self.labels),
             int(self.simtime / self.bin_size)))
        self.top_PSTH_index = []

        if (self.plot_topographical and self.topographical_isSpikes):
            self.usetop_PSTHs = True  # True = update PSTHS for topographical plot (slower)
        else:
            self.usetop_PSTHs = False

        # Population average
        self.pop_layers_to_record = []
        self.pop_PSTH_index = []
    def __init__(self):

        ## Simulation parameters ##

        # Simulation time
        self.simtime = 600.0

        # Number of trials
        self.trials = 2

        # Folder to save spike times
        self.spike_folder = 'Receptive_field'

        # Stimulus type
        self.stim = '_disk_'

        # Square mask where stimuli are displayed (side = 2*mask_side+1)
        self.mask_side = 4

        # Type of stimulus:
        # 0 = red, 1 = green, 2 = black/white
        self.stimulus_type = 2

        # Intervals to average
        self.RF_intervals = [[320.0, 340.0], [340.0, 360.0], [360.0, 380.0],
                             [380.0, 400.0], [400.0, 420.0]]

        # Start time of plots
        self.start_time = 200.0

        # disk parameters
        self.radius = 0.09  # degrees

        # Pulse parameters
        self.pulse_duration = 40.0  # ms
        self.pulse_tstart = 300.0  # ms (first 300 ms are used to fill the input and
        # output buffers of linear filters)
        self.bkg_illuminance = 250.0  # td
        self.pulse_contrast = 0.8
        self.pulse_amplitude = self.pulse_contrast * self.bkg_illuminance  # td

        # Cell to analyze
        self.selected_cell = 210

        # PSTH bin size
        self.bin_size = 10.0  # ms

        # Layers to track (labels for figures)
        self.labels = [
            'Midget_ganglion_cells_L_ON', 'Midget_ganglion_cells_L_OFF',
            'Midget_ganglion_cells_M_ON', 'Midget_ganglion_cells_M_OFF'
        ]

        # Spiking layers
        self.sp_labels = [
            'Midget_ganglion_cells_L_ON', 'Midget_ganglion_cells_L_OFF',
            'Midget_ganglion_cells_M_ON', 'Midget_ganglion_cells_M_OFF'
        ]

        # Parameters of the topographical plot
        self.top_labels = [
            'Midget_ganglion_cells_L_ON', 'Midget_ganglion_cells_L_OFF',
            'Midget_ganglion_cells_M_ON', 'Midget_ganglion_cells_M_OFF'
        ]

        ## Graphical parameters ##

        self.plot_intracellular = False
        self.plot_PSTH = False
        self.plot_topographical = False

        # Individual intracellular traces
        self.intracellular_rows = 3
        self.intracellular_cols = 4
        self.intracellular_video_step = 1.0  # ms
        self.intracellular_starting_row = 2
        self.intracellular_starting_col = 2

        # PSTHs
        self.PSTH_rows = 3
        self.PSTH_cols = 2
        self.PSTH_starting_row = 0
        self.PSTH_starting_col = 1

        # Topographical plot
        self.topographical_rows = 2
        self.topographical_cols = 4
        self.topographical_time_intervals = [0.0, 300.0, 350.0, 400.0, 600.0]
        self.topographical_V_mins = [0.0, 0.0]
        self.topographical_V_maxs = [150.0, 150.0]
        self.topographical_isSpikes = True  # (False = membrane potential, True = spikes)

        ## End of parameters ##

        # Initialize PSTH
        self.PSTHs = np.zeros(
            (len(self.sp_labels), int(self.simtime / self.bin_size)))

        # IDs from NEST
        self.layers_to_record = []  # For membrane potentials
        self.s_layers_to_record = []  # For spikes

        # Data recorders used in NEST simulation
        self.potentials = []
        self.spikes = []

        # Simulation object
        self.newSimulation = run_network.runNetwork(self.simtime)

        # Input arrays
        self.L_cone_input = np.zeros(
            (self.newSimulation.Params['N'] * self.newSimulation.Params['N'],
             int(self.newSimulation.Params['simtime'] /
                 self.newSimulation.Params['resolution'])))
        self.M_cone_input = np.zeros(
            (self.newSimulation.Params['N'] * self.newSimulation.Params['N'],
             int(self.newSimulation.Params['simtime'] /
                 self.newSimulation.Params['resolution'])))
        self.S_cone_input = np.zeros(
            (self.newSimulation.Params['N'] * self.newSimulation.Params['N'],
             int(self.newSimulation.Params['simtime'] /
                 self.newSimulation.Params['resolution'])))
        # Video of the input stimulus
        self.show_video = False
        self.inputIm = np.zeros(
            (self.newSimulation.Params['N'], self.newSimulation.Params['N'],
             int(self.newSimulation.Params['simtime'] /
                 self.newSimulation.Params['resolution'])))

        # Retinal mosaic (default: uniform distribution)
        self.mosaic = np.ones(((3, self.newSimulation.Params['N'],
                                self.newSimulation.Params['N'])))

        # Topographical plot
        self.top_layers_to_record = []
        self.top_PSTHs = np.zeros(
            (int(self.newSimulation.Params['N'] *
                 self.newSimulation.Params['N']), len(self.sp_labels),
             int(self.simtime / self.bin_size)))
        self.top_PSTH_index = []

        if (self.plot_topographical and self.topographical_isSpikes):
            self.usetop_PSTHs = True  # True = update PSTHS for topographical plot (slower)
        else:
            self.usetop_PSTHs = False

        # Receptive_field
        self.RF_mask = []

        self.RF_bright = np.zeros(
            (len(self.RF_intervals), len(self.labels),
             self.newSimulation.Params['N'], self.newSimulation.Params['N']))

        self.RF_dark = np.zeros(
            (len(self.RF_intervals), len(self.labels),
             self.newSimulation.Params['N'], self.newSimulation.Params['N']))
    def __init__(self):

        ## Simulation parameters ##

        # Simulation time
        self.simtime = 1000.0

        # Simulation object
        self.newSimulation = run_network.runNetwork(self.simtime)

        # Number of trials
        self.trials = 2

        # Folder to save spike times
        self.spike_folder = 'areaResponseCurves'

        # Start time of plots
        self.start_time = 200.0

        # Pulse parameters
        self.pulse_duration = 500.0  # ms
        self.pulse_tstart = 500.0  # ms (first 300 ms are used to fill the input and
        # output buffers of linear filters)

        # Record membrane potentials
        self.record_Vm = False

        # disk parameters
        #        self.disk_diameters = [0.0,0.05,0.15,0.2,0.3,0.4,0.5,0.6,0.7,0.8,1.0] # degrees
        self.disk_diameters = [0.15, 0.5]  # degrees

        # Cell to analyze
        self.selected_cell = []
        # Cell to analyze is the center cell in every 2D grid
        self.isCenterCell = True

        # size of each layer (number of cells)
        N_r = self.newSimulation.Params['N_LGN']
        N_c = self.newSimulation.Params['N_cortex']

        # PSTH bin size
        self.bin_size = 10.0  # ms

        # Layers to track
        self.labels = [
            'Parvo_LGN_relay_cell_L_ON',
            #        'Parvo_LGN_relay_cell_L_OFF',
            'Parvo_LGN_relay_cell_M_ON',
            #        'Parvo_LGN_relay_cell_M_OFF',

            #        'Parvo_LGN_interneuron_ON',
            #        'Parvo_LGN_interneuron_OFF',
            'Color_Luminance_L_ON_L_OFF_vertical',
            'Color_Luminance_L_ON_L_OFF_horizontal',
            'Color_Luminance_L_OFF_L_ON_vertical',
            #        'Color_Luminance_L_OFF_L_ON_horizontal',
            'Color_Luminance_M_ON_M_OFF_vertical',
            #        'Color_Luminance_M_ON_M_OFF_horizontal',
            'Color_Luminance_M_OFF_M_ON_vertical',
            #        'Color_Luminance_M_OFF_M_ON_horizontal',
            'Luminance_preferring_ON_OFF_vertical',
            'Luminance_preferring_ON_OFF_horizontal',
            'Luminance_preferring_OFF_ON_vertical',
            'Luminance_preferring_OFF_ON_horizontal',
            'Color_preferring_L_ON_M_OFF',
            'Color_preferring_M_ON_L_OFF',
            'Color_Luminance_inh_L_ON_L_OFF_vertical',
            #        'Color_Luminance_inh_L_ON_L_OFF_horizontal',
            #        'Color_Luminance_inh_L_OFF_L_ON_vertical',
            #        'Color_Luminance_inh_L_OFF_L_ON_horizontal',
            #        'Color_Luminance_inh_M_ON_M_OFF_vertical',
            #        'Color_Luminance_inh_M_ON_M_OFF_horizontal',
            #        'Color_Luminance_inh_M_OFF_M_ON_vertical',
            #        'Color_Luminance_inh_M_OFF_M_ON_horizontal',
            'Luminance_preferring_inh_ON_OFF_vertical'
            #        'Luminance_preferring_inh_ON_OFF_horizontal',
            #        'Luminance_preferring_inh_OFF_ON_vertical',
            #        'Luminance_preferring_inh_OFF_ON_horizontal',

            #        'Color_preferring_inh_L_ON_M_OFF',
            #        'Color_preferring_inh_M_ON_L_OFF'
        ]

        # Area-response labels
        self.area_labels = [
            'Parvo_LGN_relay_cell_L_ON',
            #        'Parvo_LGN_relay_cell_L_OFF',
            'Parvo_LGN_relay_cell_M_ON',
            #        'Parvo_LGN_relay_cell_M_OFF',

            #        'Parvo_LGN_interneuron_ON',
            #        'Parvo_LGN_interneuron_OFF',
            'Color_Luminance_L_ON_L_OFF_vertical',
            'Color_Luminance_L_ON_L_OFF_horizontal',
            'Color_Luminance_L_OFF_L_ON_vertical',
            #        'Color_Luminance_L_OFF_L_ON_horizontal',
            'Color_Luminance_M_ON_M_OFF_vertical',
            #        'Color_Luminance_M_ON_M_OFF_horizontal',
            'Color_Luminance_M_OFF_M_ON_vertical',
            #        'Color_Luminance_M_OFF_M_ON_horizontal',
            'Luminance_preferring_ON_OFF_vertical',
            'Luminance_preferring_ON_OFF_horizontal',
            'Luminance_preferring_OFF_ON_vertical',
            'Luminance_preferring_OFF_ON_horizontal',
            'Color_preferring_L_ON_M_OFF',
            'Color_preferring_M_ON_L_OFF',
            'Color_Luminance_inh_L_ON_L_OFF_vertical',
            #        'Color_Luminance_inh_L_ON_L_OFF_horizontal',
            #        'Color_Luminance_inh_L_OFF_L_ON_vertical',
            #        'Color_Luminance_inh_L_OFF_L_ON_horizontal',
            #        'Color_Luminance_inh_M_ON_M_OFF_vertical',
            #        'Color_Luminance_inh_M_ON_M_OFF_horizontal',
            #        'Color_Luminance_inh_M_OFF_M_ON_vertical',
            #        'Color_Luminance_inh_M_OFF_M_ON_horizontal',
            'Luminance_preferring_inh_ON_OFF_vertical'
            #        'Luminance_preferring_inh_ON_OFF_horizontal',
            #        'Luminance_preferring_inh_OFF_ON_vertical',
            #        'Luminance_preferring_inh_OFF_ON_horizontal',

            #        'Color_preferring_inh_L_ON_M_OFF',
            #        'Color_preferring_inh_M_ON_L_OFF'
        ]

        ## Graphical parameters ##

        self.plot_intracellular = False
        self.plot_PSTH = False

        # Individual intracellular traces
        self.intracellular_rows = 4
        self.intracellular_cols = 5
        self.intracellular_starting_row = 0
        self.intracellular_starting_col = 0

        # PSTHs
        self.PSTH_rows = 4
        self.PSTH_cols = 5
        self.PSTH_starting_row = 0
        self.PSTH_starting_col = 0

        # Area-response curve
        self.area_rows = 3
        self.area_cols = 5

        ## End of parameters ##

        # Initialize PSTH
        self.PSTHs = np.zeros(
            (len(self.labels), int(self.simtime / self.bin_size)))

        # IDs from NEST
        self.layers_to_record = []  # For membrane potentials

        # Data recorders used in NEST simulation
        self.potentials = []
        self.spikes = []

        # Retina references
        self.retina_labels = [
            'Midget_ganglion_cells_L_ON', 'Midget_ganglion_cells_L_OFF',
            'Midget_ganglion_cells_M_ON', 'Midget_ganglion_cells_M_OFF',
            'Small_bistratified_ganglion_cells_S_ON'
        ]

        # Area-response curve
        self.area_amp = np.zeros(
            (len(self.area_labels), len(self.disk_diameters)))
        self.area_ph = np.zeros(
            (len(self.area_labels), len(self.disk_diameters)))
        self.area_recorded_models = []
        self.area_PSTH_index = []
    def __init__(self):

        ## Simulation parameters ##

        # Simulation time
        self.simtime = 1000.0

        # Number of trials
        self.trials = 2

        # Folder to save spike times
        self.spike_folder = 'Luminance_Grating'

        # Type of grating:
        # (0 = luminance grating, 1 = chromatic isoluminant grating (L vs M), 2 =
        # chromatic isoluminant grating (LM vs S), 3 = L cone-isolating, 4 =
        # M cone-isolating, 5 = S cone-isolating)
        self.grating_type = 0

        # Grating parameters
        #        self.spatial_frequency = np.array([0.1,0.2,0.3,0.4,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0]) # cpd
        self.spatial_frequency = np.array([1.0, 3.0])  # cpd
        self.temporal_frequency = 2.0  # Hz
        self.bkg_illuminance = 250.0  # td
        # Michelson contrast:
        # Imax = bkg + ampl
        # Imin = bkg - ampl
        # contrast = (Imax - Imin)/(Imax + Imin) = ampl/bkg
        self.contrast = 0.8

        # Random distribution of cones
        self.generate_random_mosaic = False
        self.density_ratio = [0.6, 0.3, 0.1]  # L-M-S cones
        self.load_mosaic = False

        # Start time of plots
        self.start_time = 200.0

        # Cell to analyze
        self.selected_cell = 0
        # Cell to analyze is the center cell in every 2D grid
        self.isCenterCell = True

        # PSTH bin size
        self.bin_size = 10.0  # ms

        # Layers to track (labels for figures)
        self.labels = [
            'H1_Horizontal_cells', 'H2_Horizontal_cells',
            'Midget_bipolar_cells_L_ON', 'Midget_bipolar_cells_L_OFF',
            'Midget_bipolar_cells_M_ON', 'Midget_bipolar_cells_M_OFF',
            'Diffuse_bipolar_cells_S_ON', 'S_cone_bipolar_cells_S_ON',
            'AII_amacrine_cells', 'Midget_ganglion_cells_L_ON',
            'Midget_ganglion_cells_L_OFF', 'Midget_ganglion_cells_M_ON',
            'Midget_ganglion_cells_M_OFF',
            'Small_bistratified_ganglion_cells_S_ON'
        ]

        # Spiking layers
        self.sp_labels = [
            'Midget_ganglion_cells_L_ON', 'Midget_ganglion_cells_L_OFF',
            'Midget_ganglion_cells_M_ON', 'Midget_ganglion_cells_M_OFF',
            'Small_bistratified_ganglion_cells_S_ON'
        ]

        # FFT labels
        self.FFT_labels = [
            'Midget_ganglion_cells_L_ON',
            'Midget_ganglion_cells_L_OFF',
            #        'Midget_ganglion_cells_M_ON'
            #        'Midget_ganglion_cells_M_OFF'
        ]

        ## Graphical parameters ##

        self.plot_intracellular = False
        self.plot_PSTH = False

        # Individual intracellular traces
        self.intracellular_rows = 6
        self.intracellular_cols = 4
        self.intracellular_video_step = 1.0  # ms
        self.intracellular_starting_row = 2
        self.intracellular_starting_col = 2

        # PSTHs
        self.PSTH_rows = 3
        self.PSTH_cols = 2
        self.PSTH_starting_row = 0
        self.PSTH_starting_col = 1

        # FFT plot
        self.FFT_rows = 1
        self.FFT_cols = 2

        ## End of parameters ##

        # Initialize PSTH
        self.PSTHs = np.zeros(
            (len(self.sp_labels), int(self.simtime / self.bin_size)))

        # IDs from NEST
        self.layers_to_record = []  # For membrane potentials
        self.s_layers_to_record = []  # For spikes

        # Data recorders used in NEST simulation
        self.potentials = []
        self.spikes = []

        # Simulation object
        self.newSimulation = run_network.runNetwork(self.simtime)

        # FFT
        self.FFTamp = np.zeros(
            (len(self.FFT_labels), len(self.spatial_frequency)))
        self.FFTph = np.zeros(
            (len(self.FFT_labels), len(self.spatial_frequency)))
        self.FFT_recorded_models = []
        self.FFT_PSTH_index = []

        # Input arrays
        self.L_cone_input = np.zeros(
            (self.newSimulation.Params['N'] * self.newSimulation.Params['N'],
             int(self.newSimulation.Params['simtime'] /
                 self.newSimulation.Params['resolution'])))
        self.M_cone_input = np.zeros(
            (self.newSimulation.Params['N'] * self.newSimulation.Params['N'],
             int(self.newSimulation.Params['simtime'] /
                 self.newSimulation.Params['resolution'])))
        self.S_cone_input = np.zeros(
            (self.newSimulation.Params['N'] * self.newSimulation.Params['N'],
             int(self.newSimulation.Params['simtime'] /
                 self.newSimulation.Params['resolution'])))
        # Video of the input stimulus
        self.show_video = False
        self.inputIm = np.zeros(
            (self.newSimulation.Params['N'], self.newSimulation.Params['N'],
             int(self.newSimulation.Params['simtime'] /
                 self.newSimulation.Params['resolution'])))

        # Retinal mosaic (default: uniform distribution)
        self.mosaic = np.ones(((3, self.newSimulation.Params['N'],
                                self.newSimulation.Params['N'])))
    def __init__(self):

        ## Simulation parameters ##

        # Simulation time
        self.simtime = 600.0

        # Simulation object
        self.newSimulation = run_network.runNetwork(self.simtime)

        # Number of trials
        self.trials = 2

        # Folder to save spike times
        self.spike_folder = 'Receptive_field'

        # Square mask where stimuli are displayed (side = 2*mask_side+1)
        self.mask_side = 4

        # Intervals to average
        self.RF_intervals = [[320.0, 340.0], [340.0, 360.0], [360.0, 380.0],
                             [380.0, 400.0], [400.0, 420.0]]

        # Start time of plots
        self.start_time = 200.0

        # Record membrane potentials
        self.record_Vm = False

        # Cell to analyze
        self.isCenterCell = True
        self.selected_cell = []

        # size of each layer (number of cells)
        N_r = self.newSimulation.Params['N_LGN']
        N_c = self.newSimulation.Params['N_cortex']

        # PSTH bin size
        self.bin_size = 20.0  # ms

        # Layers to track
        self.labels = [
            'Parvo_LGN_relay_cell_L_ON', 'Parvo_LGN_relay_cell_L_OFF',
            'Color_Luminance_L_ON_L_OFF_vertical',
            'Luminance_preferring_ON_OFF_vertical',
            'Color_preferring_L_ON_M_OFF'
        ]

        ## Graphical parameters ##

        self.plot_intracellular = False
        self.plot_PSTH = False

        # Individual intracellular traces
        self.intracellular_rows = 1
        self.intracellular_cols = 5
        self.intracellular_starting_row = 0
        self.intracellular_starting_col = 0

        # PSTHs
        self.PSTH_rows = 1
        self.PSTH_cols = 5
        self.PSTH_starting_row = 0
        self.PSTH_starting_col = 0

        ## End of parameters ##

        # Initialize PSTH
        self.PSTHs = np.zeros(
            (len(self.labels), int(self.simtime / self.bin_size)))

        # IDs from NEST
        self.layers_to_record = []  # For membrane potentials

        # Data recorders used in NEST simulation
        self.potentials = []
        self.spikes = []

        # Retina references
        self.retina_labels = [
            'Midget_ganglion_cells_L_ON', 'Midget_ganglion_cells_L_OFF',
            'Midget_ganglion_cells_M_ON', 'Midget_ganglion_cells_M_OFF'
        ]

        # Receptive_field
        self.RF_mask = []

        self.RF_bright = np.zeros(
            (len(self.RF_intervals), len(self.labels), N_r, N_r))

        self.RF_dark = np.zeros(
            (len(self.RF_intervals), len(self.labels), N_r, N_r))
    def __init__(self):

        ## Simulation parameters ##

        # Simulation time
        self.simtime = 1000.0

        # Simulation object
        self.newSimulation = run_network.runNetwork(self.simtime)

        # Number of trials
        self.trials = 2

        # Folder to save spike times
        self.spike_folder = 'Luminance_Grating'

        # Grating parameters
        #        self.spatial_frequency = np.array([0.1,0.2,0.3,0.4,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0]) # cpd
        self.spatial_frequency = np.array([1.0, 3.0])  # cpd
        self.temporal_frequency = 2.0  # Hz

        # Start time of plots
        self.start_time = 200.0

        # Record membrane potentials
        self.record_Vm = False

        # Cell to analyze
        self.selected_cell = []
        # Cell to analyze is the center cell in every 2D grid
        self.isCenterCell = True

        # size of each layer (number of cells)
        N_r = self.newSimulation.Params['N_LGN']
        N_c = self.newSimulation.Params['N_cortex']

        # PSTH bin size
        self.bin_size = 10.0  # ms

        # Layers to track
        self.labels = [
            'Parvo_LGN_relay_cell_L_ON',
            #        'Parvo_LGN_relay_cell_L_OFF',
            'Parvo_LGN_relay_cell_M_ON',
            #        'Parvo_LGN_relay_cell_M_OFF',

            #        'Parvo_LGN_interneuron_ON',
            #        'Parvo_LGN_interneuron_OFF',
            'Color_Luminance_L_ON_L_OFF_vertical',
            'Color_Luminance_L_ON_L_OFF_horizontal',
            'Color_Luminance_L_OFF_L_ON_vertical',
            #        'Color_Luminance_L_OFF_L_ON_horizontal',
            'Color_Luminance_M_ON_M_OFF_vertical',
            #        'Color_Luminance_M_ON_M_OFF_horizontal',
            'Color_Luminance_M_OFF_M_ON_vertical',
            #        'Color_Luminance_M_OFF_M_ON_horizontal',
            'Luminance_preferring_ON_OFF_vertical',
            'Luminance_preferring_ON_OFF_horizontal',
            'Luminance_preferring_OFF_ON_vertical',
            'Luminance_preferring_OFF_ON_horizontal',
            'Color_preferring_L_ON_M_OFF',
            'Color_preferring_M_ON_L_OFF',
            'Color_Luminance_inh_L_ON_L_OFF_vertical',
            #        'Color_Luminance_inh_L_ON_L_OFF_horizontal',
            #        'Color_Luminance_inh_L_OFF_L_ON_vertical',
            #        'Color_Luminance_inh_L_OFF_L_ON_horizontal',
            #        'Color_Luminance_inh_M_ON_M_OFF_vertical',
            #        'Color_Luminance_inh_M_ON_M_OFF_horizontal',
            #        'Color_Luminance_inh_M_OFF_M_ON_vertical',
            #        'Color_Luminance_inh_M_OFF_M_ON_horizontal',
            'Luminance_preferring_inh_ON_OFF_vertical'
            #        'Luminance_preferring_inh_ON_OFF_horizontal',
            #        'Luminance_preferring_inh_OFF_ON_vertical',
            #        'Luminance_preferring_inh_OFF_ON_horizontal',

            #        'Color_preferring_inh_L_ON_M_OFF',
            #        'Color_preferring_inh_M_ON_L_OFF'
        ]

        # FFT labels
        self.FFT_labels = [
            'Parvo_LGN_relay_cell_L_ON',
            #        'Parvo_LGN_relay_cell_L_OFF',
            'Parvo_LGN_relay_cell_M_ON',
            #        'Parvo_LGN_relay_cell_M_OFF',

            #        'Parvo_LGN_interneuron_ON',
            #        'Parvo_LGN_interneuron_OFF',
            'Color_Luminance_L_ON_L_OFF_vertical',
            'Color_Luminance_L_ON_L_OFF_horizontal',
            'Color_Luminance_L_OFF_L_ON_vertical',
            #        'Color_Luminance_L_OFF_L_ON_horizontal',
            'Color_Luminance_M_ON_M_OFF_vertical',
            #        'Color_Luminance_M_ON_M_OFF_horizontal',
            'Color_Luminance_M_OFF_M_ON_vertical',
            #        'Color_Luminance_M_OFF_M_ON_horizontal',
            'Luminance_preferring_ON_OFF_vertical',
            'Luminance_preferring_ON_OFF_horizontal',
            'Luminance_preferring_OFF_ON_vertical',
            'Luminance_preferring_OFF_ON_horizontal',
            'Color_preferring_L_ON_M_OFF',
            'Color_preferring_M_ON_L_OFF',
            'Color_Luminance_inh_L_ON_L_OFF_vertical',
            #        'Color_Luminance_inh_L_ON_L_OFF_horizontal',
            #        'Color_Luminance_inh_L_OFF_L_ON_vertical',
            #        'Color_Luminance_inh_L_OFF_L_ON_horizontal',
            #        'Color_Luminance_inh_M_ON_M_OFF_vertical',
            #        'Color_Luminance_inh_M_ON_M_OFF_horizontal',
            #        'Color_Luminance_inh_M_OFF_M_ON_vertical',
            #        'Color_Luminance_inh_M_OFF_M_ON_horizontal',
            'Luminance_preferring_inh_ON_OFF_vertical'
            #        'Luminance_preferring_inh_ON_OFF_horizontal',
            #        'Luminance_preferring_inh_OFF_ON_vertical',
            #        'Luminance_preferring_inh_OFF_ON_horizontal',

            #        'Color_preferring_inh_L_ON_M_OFF',
            #        'Color_preferring_inh_M_ON_L_OFF'
        ]

        ## Graphical parameters ##

        self.plot_intracellular = False
        self.plot_PSTH = False

        # Individual intracellular traces
        self.intracellular_rows = 4
        self.intracellular_cols = 5
        self.intracellular_starting_row = 0
        self.intracellular_starting_col = 0

        # PSTHs
        self.PSTH_rows = 4
        self.PSTH_cols = 5
        self.PSTH_starting_row = 0
        self.PSTH_starting_col = 0

        # FFT plot
        self.FFT_rows = 3
        self.FFT_cols = 5

        ## End of parameters ##

        # Initialize PSTH
        self.PSTHs = np.zeros(
            (len(self.labels), int(self.simtime / self.bin_size)))

        # IDs from NEST
        self.layers_to_record = []

        # Data recorders used in NEST simulation
        self.potentials = []
        self.spikes = []

        # Retina references
        self.retina_labels = [
            'Midget_ganglion_cells_L_ON', 'Midget_ganglion_cells_L_OFF',
            'Midget_ganglion_cells_M_ON', 'Midget_ganglion_cells_M_OFF',
            'Small_bistratified_ganglion_cells_S_ON'
        ]

        # FFT
        self.FFTamp = np.zeros(
            (len(self.FFT_labels), len(self.spatial_frequency)))
        self.FFTph = np.zeros(
            (len(self.FFT_labels), len(self.spatial_frequency)))
        self.FFT_recorded_models = []
        self.FFT_PSTH_index = []