def _net_description(populations, projections, net_id=0): """ Returns a dictionary containing the requested network data. *Parameters:* * **populations**: if True, the population data will be saved. * **projections**: if True, the projection data will be saved. """ network_desc = {} network_desc['time_step'] = Global.get_current_step(net_id) network_desc['net_id'] = net_id pop_names = [] proj_names = [] if populations: for pop in Global._network[net_id]['populations']: network_desc[pop.name] = pop._data() pop_names.append(pop.name) if projections: for proj in Global._network[net_id]['projections']: if not proj._saveable: continue network_desc[proj.name] = proj._data() proj_names.append(proj.name) network_desc['obj_names'] = { 'populations': pop_names, 'projections': proj_names, } return network_desc
def _net_description(populations, projections, net_id=0): """ Returns a dictionary containing the requested network data. :param populations: if True, the population data will be saved. :param projections: if True, the projection data will be saved. """ network_desc = {} network_desc['time_step'] = Global.get_current_step(net_id) network_desc['net_id'] = net_id pop_names = [] proj_names = [] if populations: for pop in Global._network[net_id]['populations']: network_desc[pop.name] = pop._data() pop_names.append(pop.name) if projections: for proj in Global._network[net_id]['projections']: # Some specific projections are note saveable if not proj._saveable: continue network_desc[proj.name] = proj._data() proj_names.append(proj.name) network_desc['obj_names'] = { 'populations': pop_names, 'projections': proj_names, } return network_desc
def start_creating(self, period=None): """ Starts creating the synapses in the projection if the synapse defines a 'creating' argument. 'structural_plasticity' must be set to True in setup(). *Parameters*: * **period**: how often creating should be evaluated (default: dt, i.e. each step) """ if not period: period = Global.config['dt'] if not self.cyInstance: Global._error('Can not start creating if the network is not compiled.') if Global.config['structural_plasticity']: try: self.cyInstance.start_creating(int(period/Global.config['dt']), Global.get_current_step()) except: Global._error("The synapse does not define a 'creating' argument.") else: Global._error("You must set 'structural_plasticity' to True in setup() to start creating connections.")
def get_current_step(self): "Returns the current simulation step." return Global.get_current_step(self.id)