/* * test_set_tics.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/>. * */ /* BeginDocumentation Name: testsuite::test_set_tics - test whether tics can be configured at run time Synopsis: (test_set_tics) run -> comparison with reference data Description: The base of the integer clock tics of NEST and the number of those tics per computation time step are specified at configuration time with options like --with-tics-per-ms='std::ldexp(1.0,14)' --with-tics-per-step='1024' . However, these values can also be changed at run time. This is of advantage if the correctness of a script or the validity of a result need to be checked by running the same simulation at different computation step sizes. While it is more comfortable in demonstrations and for beginners to operate with tics to the base of 10, in production it is often better to use base 2 because of the increased density of data points and exact representation in the double data type. Therefore, these parameters can also be specified at run time in the root object prior to the creation of any network element. Here, it is often more convenient to specify the resolution (the computation time step) in units of milliseconds instead of the number of tics per step. This script tests whether the NEST kernel accepts a modification of the parameters and whether the corresponding conversions are correct. FirstVersion: January 2008 Author: Diesmann SeeAlso: get, dexp */ /unittest (6335) require /unittest using 0 << /tics_per_ms 14 dexp /resolution -4 dexp >> SetStatus % this is equivalent to: % 0 << /tics_per_ms 16384. /resolution 0.625 >> SetStatus % % with the conversion of units: % tics/ms * ms/step = tics/step % 2^14 * 2^-4 = 2^10 = 1024 { 0 /tics_per_ms get 14 dexp eq 0 /resolution get -4 dexp eq and 0 /tics_per_step get 10 dexp cvi eq and 0 /ms_per_tic get -14 dexp eq and } assert_or_die