def get_parameters(self): """ :return: """ raise exceptions.SpynnakerException( "This neuron model is currently not supported by the tool chain")
def get_v(self, has_ran, graph_mapper, placements, txrx, machine_time_step, runtime, compatible_output=False): """ Return a 3-column numpy array containing cell ids, time, and Vm for recorded cells. :param bool gather: not used - inserted to match PyNN specs :param bool compatible_output: not used - inserted to match PyNN specs """ logger.info("Getting v for {}".format(self.label)) if not has_ran: raise local_exceptions.SpynnakerException( "The simulation has not yet ran, therefore v cannot be " "retrieved") return self.get_neuron_parameter( region=constants.POPULATION_BASED_REGIONS.POTENTIAL_HISTORY.value, compatible_output=compatible_output, has_ran=has_ran, machine_time_step=machine_time_step, graph_mapper=graph_mapper, placements=placements, txrx=txrx, runtime=runtime)
def get_gsyn(self, has_ran, graph_mapper, placements, txrx, machine_time_step, runtime, compatible_output=False): """ Return a 3-column numpy array containing cell ids and synaptic conductances for recorded cells. :param compatible_output: """ logger.info("Getting gsyn for {}".format(self.label)) if not has_ran: raise local_exceptions.SpynnakerException( "The simulation has not yet ran, therefore gsyn cannot be " "retrieved") return self.get_neuron_parameter( region=constants.POPULATION_BASED_REGIONS.GSYN_HISTORY.value, compatible_output=compatible_output, has_ran=has_ran, machine_time_step=machine_time_step, graph_mapper=graph_mapper, placements=placements, txrx=txrx, runtime=runtime)
def get_gsyn(self, gather=True, compatible_output=False): """ Return a 3-column numpy array containing cell ids and synaptic conductances for recorded cells. """ if self._gsyn is None: if not self._vertex.record_gsyn: raise exceptions.ConfigurationException( "This population has not been set to record gsyn. " "Therefore gsyn cannot be retrieved. Please set this " "vertex to record gsyn before running this command.") if not self._spinnaker.has_ran: raise local_exceptions.SpynnakerException( "The simulation has not yet run, therefore gsyn cannot" " be retrieved. Please execute the simulation before" " running this command") timer = None if conf.config.getboolean("Reports", "outputTimesForSections"): timer = Timer() timer.start_timing() self._gsyn = self._vertex.get_gsyn( has_ran=self._spinnaker.has_ran, txrx=self._spinnaker.transceiver, placements=self._spinnaker.placements, machine_time_step=self._spinnaker.machine_time_step, graph_mapper=self._spinnaker.graph_mapper, compatible_output=compatible_output, runtime=self._spinnaker._runtime) if conf.config.getboolean("Reports", "outputTimesForSections"): timer.take_sample() return self._gsyn
def getSpikes(self, compatible_output=False, gather=True): """ Return a 2-column numpy array containing cell ids and spike times for recorded cells. This is read directly from the memory for the board. """ if self._spikes is None: if not gather: logger.warn("Spynnaker only supports gather = true, will " " execute as if gather was true anyhow") timer = None if not self._vertex.record: raise exceptions.ConfigurationException( "This population has not been set to record spikes. " "Therefore spikes cannot be retrieved. Please set this " "vertex to record spikes before running this command.") if not self._spinnaker.has_ran: raise local_exceptions.SpynnakerException( "The simulation has not yet run, therefore spikes cannot" " be retrieved. Please execute the simulation before" " running this command") if conf.config.getboolean("Reports", "outputTimesForSections"): timer = Timer() timer.start_timing() self._spikes = self._vertex.get_spikes( txrx=self._spinnaker.transceiver, placements=self._spinnaker.placements, graph_mapper=self._spinnaker.graph_mapper, compatible_output=compatible_output) if conf.config.getboolean("Reports", "outputTimesForSections"): timer.take_sample() return self._spikes
def __init__(self, n_neurons, machine_time_step, timescale_factor, spikes_per_second, ring_buffer_sigma, constraints=None, label=None, gbar_K=6.0, cm=0.2, e_rev_Na=50.0, tau_syn_E=0.2, tau_syn_I=2.0, i_offset=0.0, g_leak=0.01, e_rev_E=0.0, gbar_Na=20.0, e_rev_leak=-65.0, e_rev_I=-80, e_rev_K=-90.0, v_offset=-63, v_init=None): """ Single-compartment Hodgkin-Huxley model """ raise exceptions.SpynnakerException( "This neuron model is currently not supported by the tool chain")
def __init__(self, n_neurons, machine_time_step, timescale_factor, spikes_per_second, ring_buffer_sigma, constraints=None, label=None, tau_m=20, cm=1.0, e_rev_E=0.0, e_rev_I=-70.0, v_rest=-65.0, v_reset=-65.0, v_thresh=-50.0, tau_syn_E=0.3, tau_syn_I=0.5, tau_refrac=0.1, i_offset=0, v_init=None): """ Leaky integrate and fire model with fixed threshold and alpha-function\ -shaped post-synaptic conductance. """ raise exceptions.SpynnakerException( "This neuron model is currently not supported by the tool chain")
def get_cpu_usage_for_atoms(self, vertex_slice, graph): """ :param vertex_slice: :param graph: :return: """ raise exceptions.SpynnakerException( "This neuron model is currently not supported by the tool chain")
def generate_data_spec(self, subvertex, placement, partitioned_graph, graph, routing_info, hostname, graph_subgraph_mapper, report_folder, ip_tags, reverse_ip_tags, write_text_specs, application_run_time_folder): """ Model-specific construction of the data blocks necessary to build a single external retina device. """ # Create new DataSpec for this processor: data_writer, report_writer = \ self.get_data_spec_file_writers( placement.x, placement.y, placement.p, hostname, report_folder, write_text_specs, application_run_time_folder) spec = DataSpecificationGenerator(data_writer, report_writer) # reserve regions self.reserve_memory_regions(spec) # Write the setup region spec.comment("\n*** Spec for robot motor control ***\n\n") self._write_basic_setup_info(spec, self.SYSTEM_REGION) # locate correct subedge for key edge_key = None if len(graph.outgoing_edges_from_vertex(self)) != 1: raise exceptions.SpynnakerException( "This motor should only have one outgoing edge to the robot") partitions = partitioned_graph.\ outgoing_edges_partitions_from_vertex(subvertex) for partition in partitions.values(): edge_keys_and_masks = \ routing_info.get_keys_and_masks_from_partition(partition) edge_key = edge_keys_and_masks[0].key # write params to memory spec.switch_write_focus(region=self.PARAMS_REGION) spec.write_value(data=edge_key) spec.write_value(data=self._speed) spec.write_value(data=self._sample_time) spec.write_value(data=self._update_time) spec.write_value(data=self._delay_time) spec.write_value(data=self._delta_threshold) if self._continue_if_not_different: spec.write_value(data=1) else: spec.write_value(data=0) # End-of-Spec: spec.end_specification() data_writer.close() return data_writer.filename
def __init__(self, n_neurons, machine_time_step, timescale_factor, spikes_per_second, ring_buffer_sigma, constraints=None, label=None, tau_m=9.3667, cm=0.281, v_rest=-70.6, v_reset=-70.6, v_thresh=-50.4, tau_syn_E=5.0, tau_syn_I=0.5, tau_refrac=0.1, i_offset=0.0, a=4.0, b=0.0805, v_spike=-40.0, tau_w=144.0, e_rev_E=0.0, e_rev_I=-80.0, delta_T=2.0, v_init=None): """ Exponential integrate and fire neuron with spike triggered and \ sub-threshold adaptation currents (isfa, ista reps.) """ raise exceptions.SpynnakerException( "This neuron model is currently not supported by the tool chain")
def __init__(self, retina_key, spinnaker_link_id, position, machine_time_step, timescale_factor, label=None, n_neurons=None, polarity=None): if polarity is None: polarity = MunichRetinaDevice.MERGED_POLARITY self._fixed_key = (retina_key & 0xFFFF) << 16 self._fixed_mask = 0xFFFF8000 if polarity == MunichRetinaDevice.UP_POLARITY: self._fixed_key |= 0x4000 if polarity == MunichRetinaDevice.MERGED_POLARITY: # There are 128 x 128 retina "pixels" x 2 polarities fixed_n_neurons = 128 * 128 * 2 else: # There are 128 x 128 retina "pixels" fixed_n_neurons = 128 * 128 self._fixed_mask = 0xFFFFC000 AbstractVirtualVertex.__init__(self, fixed_n_neurons, spinnaker_link_id, max_atoms_per_core=fixed_n_neurons, label=label) AbstractSendMeMulticastCommandsVertex.__init__( self, self._get_commands(position)) AbstractProvidesOutgoingPartitionConstraints.__init__(self) self._polarity = polarity self._position = position if (self._position != self.RIGHT_RETINA and self._position != self.LEFT_RETINA): raise exceptions.SpynnakerException( "The external Retina does not recognise this _position") if n_neurons != fixed_n_neurons and n_neurons is not None: print "Warning, the retina will have {} neurons".format( fixed_n_neurons)
def __init__(self, n_neurons, machine_time_step, timescale_factor, spikes_per_second=None, ring_buffer_sigma=None, incoming_spike_buffer_size=None, constraints=None, label=None, g_leak=40.0, tau_syn_E=30.0, tau_syn_I=30.0, v_thresh=-55.0, v_rest=-65.0, e_rev_I=-80, v_reset=-80.0, v_init=None): raise exceptions.SpynnakerException( "This neuron model is currently not supported by the tool chain")
def get_v(self, gather=True, compatible_output=False): """ Return a 3-column numpy array containing cell ids, time, and Vm for recorded cells. :param gather: not used - inserted to match PyNN specs :type gather: bool :param compatible_output: not used - inserted to match PyNN specs :type compatible_output: bool """ if self._v is None: if not self._vertex.record_v: raise exceptions.ConfigurationException( "This population has not been set to record v. " "Therefore v cannot be retrieved. Please set this " "vertex to record v before running this command.") if not self._spinnaker.has_ran: raise local_exceptions.SpynnakerException( "The simulation has not yet run, therefore v cannot" " be retrieved. Please execute the simulation before" " running this command") timer = None if conf.config.getboolean("Reports", "outputTimesForSections"): timer = Timer() timer.start_timing() self._v = self._vertex.get_v( has_ran=self._spinnaker.has_ran, txrx=self._spinnaker.transceiver, placements=self._spinnaker.placements, machine_time_step=self._spinnaker.machine_time_step, graph_mapper=self._spinnaker.graph_mapper, compatible_output=compatible_output, runtime=self._spinnaker._runtime) if conf.config.getboolean("Reports", "outputTimesForSections"): timer.take_sample() return self._v
def __init__(self, n_neurons, machine_time_step, timescale_factor, spikes_per_second=None, ring_buffer_sigma=None, incoming_spike_buffer_size=None, constraints=None, label=None, tau_m=20, cm=1.0, v_rest=-65.0, v_reset=-65.0, v_thresh=-50.0, tau_syn_E=0.5, tau_syn_I=0.5, tau_refrac=0.1, i_offset=0, v_init=None): raise exceptions.SpynnakerException( "This neuron model is currently not supported by the tool chain")
def __init__(self, n_neurons, machine_time_step, timescale_factor, spikes_per_second, ring_buffer_sigma, constraints=None, label=None, g_leak=40.0, tau_syn_E=30.0, tau_syn_I=30.0, v_thresh=-55.0, v_rest=-65.0, e_rev_I=-80, v_reset=-80.0, v_init=None): """ Leaky integrate and fire model with conductance-based synapses and \ fixed threshold as it is resembled by the FACETS Hardware Stage 1. """ raise exceptions.SpynnakerException( "This neuron model is currently not supported by the tool chain")
def __init__(self, n_neurons, machine_time_step, timescale_factor, database_socket, label, port=12345, virtual_key=None, spikes_per_second=0, ring_buffer_sigma=None, device_id=0, fps=60, mode="128", scale_img=True, polarity="MERGED", inhibition=False, inh_area_width=2, threshold=12, adaptive_threshold=False, min_threshold=6, max_threshold=168, threshold_delta_down=2, threshold_delta_up=12, output_type="TIME", num_bits_per_spike=4, history_weight=0.99, save_spikes=None, run_time_ms=None, local_port=19876): """ :param device_id: int for webcam modes, or string for video file :param mode: The retina "mode" :param retina_key: The value of the top 16-bits of the key :param polarity: The "polarity" of the retina data :param machine_time_step: The time step of the simulation :param timescale_factor: The timescale factor of the simulation :param label: The label for the population :param n_neurons: The number of neurons in the population """ fixed_n_neurons = n_neurons if mode == ExternalDvsEmulatorDevice.MODE_128 or \ mode == ExternalDvsEmulatorDevice.MODE_64 or \ mode == ExternalDvsEmulatorDevice.MODE_32 or \ mode == ExternalDvsEmulatorDevice.MODE_16: self._out_res = int(mode) self._res_2x = self._out_res * 2 else: raise exceptions.SpynnakerException("the model does not " "recongise this mode") if (polarity == ExternalDvsEmulatorDevice.UP_POLARITY or polarity == ExternalDvsEmulatorDevice.DOWN_POLARITY or polarity == ExternalDvsEmulatorDevice.RECTIFIED_POLARITY): fixed_n_neurons = self._out_res**2 else: fixed_n_neurons = 2 * (self._out_res**2) if fixed_n_neurons != n_neurons and n_neurons is not None: logger.warn( "The specified number of neurons for the DVS emulator" " device has been ignored {} will be used instead".format( fixed_n_neurons)) self._video_source = None self._device_id = device_id self._is_virtual_cam = False self._polarity = polarity self._polarity_n = ExternalDvsEmulatorDevice.POLARITY_DICT[polarity] self._global_max = int16(0) self._output_type = output_type self._raw_frame = None self._gray_frame = None self._tmp_frame = None self._ref_frame = 128 * np.ones( (self._out_res, self._out_res), dtype=int16) self._curr_frame = np.zeros((self._out_res, self._out_res), dtype=int16) self._spikes_frame = np.zeros((self._out_res, self._out_res, 3), dtype=uint8) self._diff = np.zeros((self._out_res, self._out_res), dtype=int16) self._abs_diff = np.zeros((self._out_res, self._out_res), dtype=int16) self._spikes = np.zeros((self._out_res, self._out_res), dtype=int16) self._adaptive_threshold = adaptive_threshold self._thresh_matrix = None if adaptive_threshold: self._thresh_matrix = np.zeros((self._out_res, self._out_res), dtype=int16) self._threshold_delta_down = int16(threshold_delta_down) self._threshold_delta_up = int16(threshold_delta_up) self._max_threshold = int16(max_threshold) self._min_threshold = int16(min_threshold) self._up_spikes = None self._down_spikes = None self._spikes_lists = None self._threshold = int16(threshold) self._data_shift = uint8(np.log2(self._out_res)) self._up_down_shift = uint8(2 * self._data_shift) self._data_mask = uint8(self._out_res - 1) if self._output_type == ExternalDvsEmulatorDevice.OUTPUT_TIME_BIN: self._num_bins = 8 #8-bit images don't need more elif self._output_type == ExternalDvsEmulatorDevice.OUTPUT_TIME_BIN_THR: self._num_bins = 6 #should be enough? else: self._num_bins = int(1000. / fps) self._num_bits_per_spike = min(num_bits_per_spike, self._num_bins) if self._output_type == ExternalDvsEmulatorDevice.OUTPUT_TIME_BIN or \ self._output_type == ExternalDvsEmulatorDevice.OUTPUT_TIME_BIN_THR: self._log2_table = gs.generate_log2_table(self._num_bits_per_spike, self._num_bins) else: self._log2_table = gs.generate_log2_table( self._num_bits_per_spike, 8) #stupid hack, compatibility issues self._scale_img = scale_img self._img_height = 0 self._img_height_crop_u = 0 self._img_height_crop_b = 0 self._img_width = 0 self._img_width_crop_l = 0 self._img_width_crop_r = 0 self._img_ratio = 0. self._img_scaled_width = 0 self._scaled_width = 0 self._fps = fps self._max_time_ms = 0 self._time_per_frame = 0. self._time_per_spike_pack_ms = 0 self._get_sizes = True self._scale_changed = False self._running = True self._label = label self._n_neurons = fixed_n_neurons self._local_port = local_port self._inh_area_width = inh_area_width self._inhibition = inhibition self._inh_coords = gs.generate_inh_coords(self._out_res, self._out_res, inh_area_width) self._history_weight = history_weight self._run_time_ms = run_time_ms ################################################################ if spinn_version == "2015.005": ReverseIpTagMultiCastSource.__init__( self, n_neurons=self._n_neurons, machine_time_step=machine_time_step, timescale_factor=timescale_factor, port=self._local_port, label=self._label, virtual_key=virtual_key) else: ReverseIpTagMultiCastSource.__init__( self, n_keys=self._n_neurons, machine_time_step=machine_time_step, timescale_factor=timescale_factor, label=self._label, receive_port=self._local_port, virtual_key=virtual_key) AbstractProvidesOutgoingConstraints.__init__(self) print("number of neurons for webcam = %d" % self._n_neurons) self._live_conn = SpynnakerLiveSpikesConnection( send_labels=[ self._label, ], local_port=self._local_port) def init(label, n_neurons, run_time_ms, machine_timestep_ms): print("Sending %d neuron sources from %s" % (n_neurons, label)) self._live_conn.add_init_callback(self._label, init) self._live_conn.add_start_callback(self._label, self.run) self._sender = None self._save_spikes = save_spikes
def __init__(self, mode, retina_key, spinnaker_link_id, polarity, machine_time_step, timescale_factor, label=None, n_neurons=None): """ :param mode: The retina "mode" :param retina_key: The value of the top 16-bits of the key :param spinnaker_link_id: The spinnaker link to which the retina is\ connected :param polarity: The "polarity" of the retina data :param machine_time_step: The time step of the simulation :param timescale_factor: The timescale factor of the simulation :param label: The label for the population :param n_neurons: The number of neurons in the population """ self._polarity = polarity self._fixed_key = (retina_key & 0xFFFF) << 16 self._fixed_mask = 0xFFFF8000 if polarity == ExternalFPGARetinaDevice.UP_POLARITY: self._fixed_key |= 0x4000 fixed_n_neurons = n_neurons if mode == ExternalFPGARetinaDevice.MODE_128: if (polarity == ExternalFPGARetinaDevice.UP_POLARITY or polarity == ExternalFPGARetinaDevice.DOWN_POLARITY): fixed_n_neurons = 128 * 128 self._fixed_mask = 0xFFFFC000 else: fixed_n_neurons = 128 * 128 * 2 elif mode == ExternalFPGARetinaDevice.MODE_64: if (polarity == ExternalFPGARetinaDevice.UP_POLARITY or polarity == ExternalFPGARetinaDevice.DOWN_POLARITY): fixed_n_neurons = 64 * 64 self._fixed_mask = 0xFFFFF000 else: fixed_n_neurons = 64 * 64 * 2 elif mode == ExternalFPGARetinaDevice.MODE_32: if (polarity == ExternalFPGARetinaDevice.UP_POLARITY or polarity == ExternalFPGARetinaDevice.DOWN_POLARITY): fixed_n_neurons = 32 * 32 self._fixed_mask = 0xFFFFFC00 else: fixed_n_neurons = 32 * 32 * 2 elif mode == ExternalFPGARetinaDevice.MODE_16: if (polarity == ExternalFPGARetinaDevice.UP_POLARITY or polarity == ExternalFPGARetinaDevice.DOWN_POLARITY): fixed_n_neurons = 16 * 16 self._fixed_mask = 0xFFFFFF00 else: fixed_n_neurons = 16 * 16 * 2 else: raise exceptions.SpynnakerException("the FPGA retina does not " "recongise this mode") if fixed_n_neurons != n_neurons and n_neurons is not None: logger.warn( "The specified number of neurons for the FPGA retina" " device has been ignored {} will be used instead".format( fixed_n_neurons)) AbstractVirtualVertex.__init__(self, fixed_n_neurons, spinnaker_link_id, max_atoms_per_core=fixed_n_neurons, label=label) AbstractSendMeMulticastCommandsVertex.__init__( self, commands=[ MultiCastCommand(0, 0x0000FFFF, 0xFFFF0000, 1, 5, 100), MultiCastCommand(-1, 0x0000FFFE, 0xFFFF0000, 0, 5, 100) ]) AbstractProvidesOutgoingPartitionConstraints.__init__(self)
def model_name(self): raise exceptions.SpynnakerException( "This neuron model is currently not supported by the tool chain")
def __init__(self, fixed_key, spinnaker_link_id, machine_time_step, timescale_factor, label=None, n_neurons=None, polarity=PushBotRetinaPolarity.Merged, resolution=PushBotRetinaResolution.Downsample64): # Validate number of timestamp bytes if not isinstance(polarity, PushBotRetinaPolarity): raise exceptions.SpynnakerException( "Pushbot retina polarity should be one of those defined in" " Polarity enumeration") if not isinstance(resolution, PushBotRetinaResolution): raise exceptions.SpynnakerException( "Pushbot retina resolution should be one of those defined in" " Resolution enumeration") # Cache resolution self._resolution = resolution # Build standard routing key from virtual chip coordinates self._routing_key = fixed_key self._retina_source_key = self._routing_key # Calculate number of neurons fixed_n_neurons = resolution.value.pixels**2 # If polarity is merged if polarity == PushBotRetinaPolarity.Merged: # Double number of neurons fixed_n_neurons *= 2 # We need to mask out two coordinates and a polarity bit mask_bits = (2 * resolution.value.coordinate_bits) + 1 # Otherwise else: # We need to mask out two coordinates mask_bits = 2 * resolution.value.coordinate_bits # If polarity is up, set polarity bit in routing key if polarity == PushBotRetinaPolarity.Up: polarity_bit = 1 << (2 * resolution.value.coordinate_bits) self._routing_key |= polarity_bit # Build routing mask self._routing_mask = ~((1 << mask_bits) - 1) & 0xFFFFFFFF AbstractVirtualVertex.__init__(self, fixed_n_neurons, spinnaker_link_id, max_atoms_per_core=fixed_n_neurons, label=label) AbstractSendMeMulticastCommandsVertex.__init__(self, self._get_commands()) AbstractProvidesOutgoingPartitionConstraints.__init__(self) if n_neurons != fixed_n_neurons and n_neurons is not None: print "Warning, the retina will have {} neurons".format( fixed_n_neurons)
def __init__(self): raise exceptions.SpynnakerException("This connector is currently not " "supported by the tool chain....." "watch this space")
def generate_synapse_list( self, presynaptic_population, postsynaptic_population, delay_scale, weight_scale, synapse_type): raise exceptions.SpynnakerException("This connector is currently not " "supported by the tool chain....." "watch this space")
def get_neuron_parameter(self, region, compatible_output, has_ran, graph_mapper, placements, txrx, machine_time_step, runtime): if not has_ran: raise exceptions.SpynnakerException( "The simulation has not yet ran, therefore neuron param " "cannot be retrieved") ms_per_tick = self._machine_time_step / 1000.0 n_timesteps = runtime / ms_per_tick tempfilehandle = tempfile.NamedTemporaryFile() data = numpy.memmap(tempfilehandle.file, shape=(n_timesteps, self._n_atoms), dtype="float64,float64,float64") data["f0"] = (numpy.arange(self._n_atoms * n_timesteps) % self._n_atoms).reshape((n_timesteps, self._n_atoms)) data["f1"] = numpy.repeat( numpy.arange(0, n_timesteps * ms_per_tick, ms_per_tick), self._n_atoms).reshape((n_timesteps, self._n_atoms)) # Find all the sub-vertices that this pynn_population.py exists on subvertices = graph_mapper.get_subvertices_from_vertex(self) progress_bar = ProgressBar(len(subvertices), "Getting recorded data") for subvertex in subvertices: placment = placements.get_placement_of_subvertex(subvertex) (x, y, p) = placment.x, placment.y, placment.p # Get the App Data for the core app_data_base_address = txrx.\ get_cpu_information_from_core(x, y, p).user[0] # Get the position of the value buffer neuron_param_region_base_address_offset = \ dsg_utility_calls.get_region_base_address_offset( app_data_base_address, region) neuron_param_region_base_address_buf = txrx.read_memory( x, y, neuron_param_region_base_address_offset, 4) neuron_param_region_base_address = struct.unpack_from( "<I", neuron_param_region_base_address_buf)[0] neuron_param_region_base_address += app_data_base_address # Read the size number_of_bytes_written_buf = txrx.read_memory( x, y, neuron_param_region_base_address, 4) number_of_bytes_written = struct.unpack_from( "<I", number_of_bytes_written_buf)[0] # Read the values logger.debug("Reading {} ({}) bytes starting at {}".format( number_of_bytes_written, hex(number_of_bytes_written), hex(neuron_param_region_base_address + 4))) neuron_param_region_data = txrx.read_memory( x, y, neuron_param_region_base_address + 4, number_of_bytes_written) vertex_slice = graph_mapper.get_subvertex_slice(subvertex) bytes_per_time_step = vertex_slice.n_atoms * 4 number_of_time_steps_written = \ number_of_bytes_written / bytes_per_time_step logger.debug( "Processing {} timesteps".format(number_of_time_steps_written)) numpy_data = (numpy.asarray(neuron_param_region_data, dtype="uint8").view(dtype="<i4") / 32767.0).reshape((n_timesteps, vertex_slice.n_atoms)) data["f2"][:, vertex_slice.lo_atom:vertex_slice.hi_atom + 1] =\ numpy_data progress_bar.update() progress_bar.end() data.shape = self._n_atoms * n_timesteps # Sort the data - apparently, using lexsort is faster, but it might # consume more memory, so the option is left open for sort-in-place order = numpy.lexsort((data["f1"], data["f0"])) # data.sort(order=['f0', 'f1'], axis=0) result = data.view(dtype="float64").reshape( (self._n_atoms * n_timesteps, 3))[order] return result