/* * ticket-528.sli * * This file is part of NEST. * * Copyright (C) 2004 The NEST Initiative * * NEST is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * NEST is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with NEST. If not, see <http://www.gnu.org/licenses/>. * */ /* Test for Tickets 528. On 32-bit systems, spikes from spike_generator arrive at the wrong time for certain spike times. The problem does not occur on 64-bit systems. This script defines steps at which spikes should occur, then computes spike times by multiplying with the resolution. It then sends spikes at the computed times from spike generator to detector and compares resulting spikes steps. It displays expected and observed spike steps, offsets and offset-resolution. Several spikes lag by one step with and offset of resolution-n*eps, where n is a small number. */ /unittest (6335) require /unittest using M_ERROR setverbosity /resolution 0.1 def /sd_params << /to_memory true /precise_times true /time_in_steps true >> def /spike_steps [ 48 116 184 252 320 388 456 524 592 660 728 796 864 932 1000] def /spike_times spike_steps resolution mul def /sg_params << /spike_times spike_times >> def /simtime 200.0 def ResetKernel 0 << /resolution resolution >> SetStatus /spike_detector sd_params Create /sd Set /spike_generator sg_params Create /sg Set sg sd Connect simtime Simulate sd [/events [/times /offsets]] get cva /res Set cout 2 setprecision (Expected steps: ) <- spike_steps pprint endl (Observed steps: ) <- res 0 get pprint endl ( offsets: ) <- res 1 get pprint endl ( offs-res: ) <- res 1 get resolution sub pprint endl spike_steps res 0 get eq assert_or_die