Ejemplo n.º 1
0
    def __init__(self, sensory_unit=None, T=5, dt=.001, **kwargs):
        """
        Pass in a wc unit, set up recordings, get ready to run.
        Args:
            sensory_unit (SensoryWCUnit): it should already have everything you want connected to it
            T (float): T in seconds
            dt (float): integration timestep (seconds)
            **kwargs:
        Derived attributes:
            self.tax (numpy.array): time axis
            self.ttot (int): total number of time steps
            self.t_i (int): the current time step
            self.traces (dict): traces
        """
        Simulation.__init__(self, T=T, dt=dt, **kwargs)
        self.unit = sensory_unit

        trace_sources = {
            "FR": sensory_unit.r,
            "stim": sensory_unit.stim,
            "SFA": sensory_unit.a,
            # "u1_S": wc_unit.S
        }
        for k, v in trace_sources.items():
            self.add_new_trace(source=v, trace_name=k)
Ejemplo n.º 2
0
    def __init__(self, network, T=5, dt=.001, **kwargs):
        """
        Pass in a wc unit, set up recordings, get ready to run.
        Args:
            sensory_units (SensoryWCUnit): it should already have everything you want connected to it
            T (float): T in seconds
            dt (float): integration timestep (seconds)
            **kwargs:
        Derived attributes:
            self.tax (numpy.array): time axis
            self.ttot (int): total number of time steps
            self.t_i (int): the current time step
            self.traces (dict): traces
        """
        Simulation.__init__(self, T=T, dt=dt, **kwargs)
        self.network = network
        self.traces = OrderedDict()

        # just slap a trace on there?
        for unit in self.network.units:
            # we'll just staple the traces to the unit, maybe this is wrong but it should make things easier
            unit.trace_dict = OrderedDict()

            trace_sources = OrderedDict(
                FR=unit.r)  # , stim=unit.stim, SFA=unit.a
            # )
            for k, v in trace_sources.items():
                self.add_new_trace(unit, source=v, trace_name=k)

            current_trace_sources = unit.currents
            for k, v in current_trace_sources.items():
                self.add_new_current_trace(unit, source=v, trace_name=k)
Ejemplo n.º 3
0
    def __init__(self, network, T=5, dt=.001, **kwargs):
        """
        Pass in a wc unit, set up recordings, get ready to run.
        Args:
            sensory_units (SensoryWCUnit): it should already have everything you want connected to it
            T (float): T in seconds
            dt (float): integration timestep (seconds)
            **kwargs:
        Derived attributes:
            self.tax (numpy.array): time axis
            self.ttot (int): total number of time steps
            self.t_i (int): the current time step
            self.traces (dict): traces
        """
        Simulation.__init__(self, T=T, dt=dt, **kwargs)
        self.network = network
        self.traces = OrderedDict()

        for name, unit in self.network.units.items():
            trace_sources = OrderedDict(
                FR=unit.r, stim=unit.stim, SFA=unit.a
            )
            self.traces[unit.name] = OrderedDict()

            for k, v in trace_sources.items():
                self.add_new_trace(unit, source=v, trace_name=k)
Ejemplo n.º 4
0
    def __init__(self,
                 syn_weights=weights,
                 selectivities=s_units,
                 stimulus=stim,
                 **kwargs):
        TonotopicNetwork.__init__(self, selectivities, stimulus, **kwargs)
        Simulation.__init__(self, **kwargs)  # is this black magic?
        """ this guy would take a bunch of selectivities and make some units """
        self.syn_weights = syn_weights

        # now we build us some arrays - we're going to vectorize
        self.R_var_array = np.zeros([len(self.units), self.ttot])
        self.A_var_array = np.zeros([len(self.units), self.ttot])
        self.S_var_array = np.zeros([len(self.units), self.ttot])

        # pull out the vars from the vars arrays
        self.vars = [
            x.split("_")[0] for x in self.__dict__ if x.endswith("_var_array")
        ]

        self.stim_currents = self.build_stimulus_currents()
        # list of units
        units_array = self.units
        self.gstims = np.array(
            [x.currents["stim"].weight for x in units_array])
        self.i_0s = np.array([x.i_0 for x in units_array])
        self.gees = np.array([x.gee for x in units_array])
        self.gSFAs = np.array([x.gSFA for x in units_array])
        self.Gs = np.array([x.G for x in units_array])
        self.taus = np.array([x.tau for x in units_array])
        self.tauAs = np.array([x.tauA for x in units_array])
        self.tauNMDAs = np.array([x.tauNMDA for x in units_array])

        # activation function parameters
        self.kes = np.array([x.ke for x in units_array])
        self.thes = np.array([x.the for x in units_array])
        self.f_e = self.f_activation_builder(self.kes, self.thes)
        self.kSs = np.array([x.kS for x in units_array])
        self.thSs = np.array([x.thS for x in units_array])
        self.f_S = self.f_activation_builder(self.kSs, self.thSs, self.b_00)
        # initialize
        self.point_wise_Isyn = np.outer(self.syn_weights, self.R_var_array)