def BuildSpecification_(self): self.model_specification = pyncs.ModelSpecification() self.model_specification.model_parameters = ( pyncs.string_to_model_parameters_map(self.model_parameters)) self.model_specification.neuron_groups = ( pyncs.string_to_neuron_group_map(self.neuron_groups)) self.model_specification.neuron_aliases = ( pyncs.string_to_neuron_alias_map(self.neuron_aliases)) self.model_specification.synapse_groups = ( pyncs.string_to_synapse_group_map(self.synapse_groups)) self.model_specification.synapse_aliases = ( pyncs.string_to_synapse_alias_map(self.synapse_aliases)) return True
def BuildSpecification_(self): self.model_specification = pyncs.ModelSpecification() self.model_specification.model_parameters = ( pyncs.string_to_model_parameters_map(self.model_parameters) ) self.model_specification.neuron_groups = ( pyncs.string_to_neuron_group_map(self.neuron_groups) ) self.model_specification.neuron_aliases = ( pyncs.string_to_neuron_alias_map(self.neuron_aliases) ) self.model_specification.synapse_groups = ( pyncs.string_to_synapse_group_map(self.synapse_groups) ) self.model_specification.synapse_aliases = ( pyncs.string_to_synapse_alias_map(self.synapse_aliases) ) return True
def init(self, argv): self.model_specification = pyncs.ModelSpecification() self.model_specification.thisown = False #self.model_specification.model_parameters = ( # pyncs.string_to_model_parameters_map(self.model_parameters) # ) neuron_group_map = {} for name, cell_group in self.cell_groups.items(): model_parameters = self.getNeuronParameters(cell_group.parameters) if not model_parameters: print "ModelParameters %s not found" % cell_group.parameters return False neuron_group = pyncs.NeuronGroup(cell_group.count, model_parameters, cell_group.geometry) cell_group.neuron_group = neuron_group neuron_group.thisown = False neuron_group_map[name] = neuron_group self.model_specification.neuron_groups = ( pyncs.string_to_neuron_group_map(neuron_group_map)) for name, alias in self.cell_aliases.items(): if not alias.resolved: if not self.resolveCellAlias_(alias): print "Failed to resolve CellAlias %s" % name return False neuron_groups = [x.neuron_group for x in alias.subgroups] neuron_group_list = pyncs.neuron_group_list(neuron_groups) alias.neuron_alias = pyncs.NeuronAlias(neuron_group_list) neuron_alias_map = { n: a.neuron_alias for n, a in self.cell_aliases.items() } self.model_specification.neuron_aliases = ( pyncs.string_to_neuron_alias_map(neuron_alias_map)) connection_map = {} for name, connection in self.connections.items(): if not connection.presynaptic.resolved: if not self.resolveCellAlias_(connection.presynaptic): print "Invalid presynaptic group in connection %s" % name return False if not connection.postsynaptic.resolved: if not self.resolveCellAlias_(connection.postsynaptic): print "Invalid postsynaptic group in connection %s" % name return False model_parameters = self.getSynapseParameters(connection.parameters) if not model_parameters: print "ModelParameters %s not found" % connection.parameters return False group = pyncs.neuron_group_list presynaptic_neuron_groups = [ x.neuron_group for x in connection.presynaptic.subgroups ] presynaptic = group( [x.neuron_group for x in connection.presynaptic.subgroups]) postsynaptic = group( [x.neuron_group for x in connection.postsynaptic.subgroups]) synapse_group = pyncs.SynapseGroup(presynaptic, postsynaptic, model_parameters, connection.probability) connection.synapse_group = synapse_group synapse_group.thisown = False connection_map[name] = synapse_group self.model_specification.synapse_groups = ( pyncs.string_to_synapse_group_map(connection_map)) for name, alias in self.connection_aliases.items(): if not alias.resolved: if not self.resolveConnectionAlias_(alias): print "Failed to resolve ConnectionAlias %s" % name return False synapse_groups = [x.synapse_group for x in alias.subgroups] synapse_group_list = pyncs.synapse_group_list(synapse_groups) alias.synapse_alias = pyncs.SynapseAlias(synapse_group_list) synapse_alias_map = { n: a.synapse_alias for n, a in self.connection_aliases.items() } self.model_specification.synapse_aliases = ( pyncs.string_to_synapse_alias_map(synapse_alias_map)) self.simulation = pyncs.Simulation(self.model_specification, self.simulaton_parameters) return self.simulation.init(pyncs.string_list(argv))
def init(self, argv): self.model_specification = pyncs.ModelSpecification() self.model_specification.thisown = False #self.model_specification.model_parameters = ( # pyncs.string_to_model_parameters_map(self.model_parameters) # ) neuron_group_map = {} for name, cell_group in self.cell_groups.items(): model_parameters = self.getNeuronParameters(cell_group.parameters) if not model_parameters: print "ModelParameters %s not found" % cell_group.parameters return False neuron_group = pyncs.NeuronGroup(cell_group.count, model_parameters, cell_group.geometry) cell_group.neuron_group = neuron_group neuron_group.thisown = False neuron_group_map[name] = neuron_group self.model_specification.neuron_groups = ( pyncs.string_to_neuron_group_map(neuron_group_map) ) for name, alias in self.cell_aliases.items(): if not alias.resolved: if not self.resolveCellAlias_(alias): print "Failed to resolve CellAlias %s" % name return False neuron_groups = [x.neuron_group for x in alias.subgroups] neuron_group_list = pyncs.neuron_group_list(neuron_groups) alias.neuron_alias = pyncs.NeuronAlias(neuron_group_list) neuron_alias_map = { n : a.neuron_alias for n, a in self.cell_aliases.items() } self.model_specification.neuron_aliases = ( pyncs.string_to_neuron_alias_map(neuron_alias_map) ) connection_map = {} for name, connection in self.connections.items(): if not connection.presynaptic.resolved: if not self.resolveCellAlias_(connection.presynaptic): print "Invalid presynaptic group in connection %s" % name return False if not connection.postsynaptic.resolved: if not self.resolveCellAlias_(connection.postsynaptic): print "Invalid postsynaptic group in connection %s" % name return False model_parameters = self.getSynapseParameters(connection.parameters) if not model_parameters: print "ModelParameters %s not found" % connection.parameters return False group = pyncs.neuron_group_list presynaptic_neuron_groups = [x.neuron_group for x in connection.presynaptic.subgroups] presynaptic = group([x.neuron_group for x in connection.presynaptic.subgroups]) postsynaptic = group([x.neuron_group for x in connection.postsynaptic.subgroups]) synapse_group = pyncs.SynapseGroup(presynaptic, postsynaptic, model_parameters, connection.probability) connection.synapse_group = synapse_group synapse_group.thisown = False connection_map[name] = synapse_group self.model_specification.synapse_groups = ( pyncs.string_to_synapse_group_map(connection_map) ) for name, alias in self.connection_aliases.items(): if not alias.resolved: if not self.resolveConnectionAlias_(alias): print "Failed to resolve ConnectionAlias %s" % name return False synapse_groups = [x.synapse_group for x in alias.subgroups] synapse_group_list = pyncs.synapse_group_list(synapse_groups) alias.synapse_alias = pyncs.SynapseAlias(synapse_group_list) synapse_alias_map = { n : a.synapse_alias for n, a in self.connection_aliases.items() } self.model_specification.synapse_aliases = ( pyncs.string_to_synapse_alias_map(synapse_alias_map) ) self.simulation = pyncs.Simulation(self.model_specification, self.simulaton_parameters) return self.simulation.init(pyncs.string_list(argv))