nest.tests package¶
Subpackages¶
- nest.tests.test_sp package
- Submodules
- nest.tests.test_sp.mpitest_issue_578_sp module
- nest.tests.test_sp.test_all module
- nest.tests.test_sp.test_conn_builder module
- nest.tests.test_sp.test_disconnect module
- nest.tests.test_sp.test_disconnect_multiple module
- nest.tests.test_sp.test_enable_multithread module
- nest.tests.test_sp.test_get_sp_status module
- nest.tests.test_sp.test_growth_curves module
- nest.tests.test_sp.test_sp_manager module
- nest.tests.test_sp.test_synaptic_elements module
- nest.tests.test_sp.test_update_synaptic_elements module
- nest.tests.test_sp.utils module
- Module contents
Submodules¶
nest.tests.compatibility module¶
nest.tests.test_aeif_lsodar module¶
-
class
nest.tests.test_aeif_lsodar.
AEIFTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Check the coherence between reference solution and NEST implementation.
-
assert_pass_tolerance
(rel_diff, di_tol)[source]¶ Test that relative differences are indeed smaller than the tolerance.
-
compute_difference
(multimeters, params, reference, recordables)[source]¶ Compute the relative differences between the values recorded by the multimeter and those of the reference (recorded at same times).
- multimeters : dict of tuples
- Dictionary containing the model name as key and the GID of the associated multimeter as value.
- params : dict
- Parameters used for the models.
- reference : dict
- Reference arrays (one per entry in recordables).
- recordables : list of strings
- List of recordables that will be compared.
- rel_diff : dict of dict of doubles
- Relative differences between recorded data and reference (one dict per model, containing one value per entry in recordables).
-
nest.tests.test_connect_all_patterns module¶
nest.tests.test_connect_all_to_all module¶
nest.tests.test_connect_array_fixed_indegree module¶
Tests of connection with rule fixed_indegree and parameter arrays in syn_spec
nest.tests.test_connect_array_fixed_outdegree module¶
Tests of connection with rule fixed_outdegree and parameter arrays in syn_spec
nest.tests.test_connect_distributions module¶
nest.tests.test_connect_fixed_indegree module¶
-
class
nest.tests.test_connect_fixed_indegree.
TestFixedInDegree
(methodName='runTest')[source]¶ Bases:
nest.tests.test_connect_parameters.TestParams
-
C
= 10¶
-
N1
= 50¶
-
N2
= 70¶
-
N_s
= 10¶
-
N_t
= 10¶
-
Nin
= 10¶
-
conn_dict
= {'indegree': 10, 'rule': 'fixed_indegree'}¶
-
rule
= 'fixed_indegree'¶
-
stat_dict
= {'alpha2': 0.05, 'n_runs': 50}¶
-
nest.tests.test_connect_fixed_outdegree module¶
-
class
nest.tests.test_connect_fixed_outdegree.
TestFixedOutDegree
(methodName='runTest')[source]¶ Bases:
nest.tests.test_connect_parameters.TestParams
-
C
= 10¶
-
N1
= 50¶
-
N2
= 70¶
-
N_s
= 10¶
-
N_t
= 10¶
-
Nout
= 10¶
-
conn_dict
= {'outdegree': 10, 'rule': 'fixed_outdegree'}¶
-
rule
= 'fixed_outdegree'¶
-
stat_dict
= {'alpha2': 0.05, 'n_runs': 100}¶
-
nest.tests.test_connect_fixed_total_number module¶
-
class
nest.tests.test_connect_fixed_total_number.
TestFixedTotalNumber
(methodName='runTest')[source]¶ Bases:
nest.tests.test_connect_parameters.TestParams
-
N
= 100¶
-
N1
= 50¶
-
N2
= 70¶
-
N_s
= 20¶
-
N_t
= 20¶
-
Nconn
= 100¶
-
conn_dict
= {'N': 100, 'rule': 'fixed_total_number'}¶
-
rule
= 'fixed_total_number'¶
-
stat_dict
= {'alpha2': 0.05, 'n_runs': 150}¶
-
nest.tests.test_connect_helpers module¶
-
nest.tests.test_connect_helpers.
adaptive_check
(stat_dict, degrees, expected)[source]¶ Create a single network using fixed in/outdegrees and run a chi-squared GOF test on the connection distribution. If the result is extreme (high or low), run a two-level test.
test : Instance of RCC_tester or RDC_tester class. n_runs: If chi-square test fails, test is repeated n_runs times,
and the KS test is used to analyze results.boolean value. True if test was passed, False otherwise.
-
nest.tests.test_connect_helpers.
all_equal
(x)[source]¶ Tests if all elements in a list are equal. Returns True or False
-
nest.tests.test_connect_helpers.
chi_squared_check
(degrees, expected, distribution=None)[source]¶ Create a single network and compare the resulting degree distribution with the expected distribution using Pearson’s chi-squared GOF test.
seed : PRNG seed value. control: Boolean value. If True, _generate_multinomial_degrees will
be used instead of _get_degrees.chi-squared statistic. p-value from chi-squared test.
-
nest.tests.test_connect_helpers.
counter
(x, fan, source_pop, target_pop)[source]¶ Count similar elements in list.
x: Any list.list containing counts of similar elements.
-
nest.tests.test_connect_helpers.
gather_data
(data_array)[source]¶ Gathers data from all mpi processes by collecting all element in a list if data is a list and summing all elements to one numpy-array if data is one numpy-array. Returns gathered data if rank of current mpi node is zero and None otherwise.
-
nest.tests.test_connect_helpers.
get_connectivity_matrix
(pop1, pop2)[source]¶ Returns a connectivity matrix describing all connections from pop1 to pop2 such that M_ij describes the connection between the jth neuron in pop1 to the ith neuron in pop2.
-
nest.tests.test_connect_helpers.
get_expected_degrees_bernoulli
(p, fan, len_source_pop, len_target_pop)[source]¶ Calculate expected degree distribution.
Degrees with expected number of observations below e_min are combined into larger bins.
2D array. The four columns contain degree, expected number of observation, actual number observations, and the number of bins combined.
-
nest.tests.test_connect_helpers.
get_expected_degrees_fixedDegrees
(N, fan, len_source_pop, len_target_pop)[source]¶
-
nest.tests.test_connect_helpers.
get_expected_degrees_totalNumber
(N, fan, len_source_pop, len_target_pop)[source]¶
-
nest.tests.test_connect_helpers.
get_weighted_connectivity_matrix
(pop1, pop2, label)[source]¶ Returns a weighted connectivity matrix describing all connections from pop1 to pop2 such that M_ij describes the connection between the jth neuron in pop1 to the ith neuron in pop2. Only works without multapses.
-
nest.tests.test_connect_helpers.
is_array
(data)[source]¶ Returns True if data is a list or numpy-array and False otherwise.
-
nest.tests.test_connect_helpers.
mpi_assert
(data_original, data_test, TestCase)[source]¶ Compares data_original and data_test using assertTrue from the TestCase.
-
nest.tests.test_connect_helpers.
reset_seed
(seed, nr_threads)[source]¶ Reset the simulator and seed the PRNGs.
seed: PRNG seed value.
-
nest.tests.test_connect_helpers.
two_level_check
(n_runs, degrees, expected, verbose=True)[source]¶ Create a network and run chi-squared GOF test n_runs times. Test whether resulting p-values are uniformly distributed on [0, 1] using the Kolmogorov-Smirnov GOF test.
n_runs : Number of times to repeat chi-squared test. start_seed: First PRNG seed value. control : Boolean value. If True, _generate_multinomial_degrees
will be used instead of _get_degrees.verbose : Boolean value, determining whether to print progress.
KS statistic. p-value from KS test.
nest.tests.test_connect_one_to_one module¶
nest.tests.test_connect_pairwise_bernoulli module¶
-
class
nest.tests.test_connect_pairwise_bernoulli.
TestPairwiseBernoulli
(methodName='runTest')[source]¶ Bases:
nest.tests.test_connect_parameters.TestParams
-
N_s
= 50¶
-
N_t
= 50¶
-
conn_dict
= {'p': 0.5, 'rule': 'pairwise_bernoulli'}¶
-
p
= 0.5¶
-
rule
= 'pairwise_bernoulli'¶
-
stat_dict
= {'alpha2': 0.05, 'n_runs': 20}¶
-
nest.tests.test_connect_parameters module¶
Tests of non pattern specific parameter. The tests for all rules will run these tests separately.
nest.tests.test_connect_symmetric_pairwise_bernoulli module¶
-
class
nest.tests.test_connect_symmetric_pairwise_bernoulli.
TestSymmetricPairwiseBernoulli
(methodName='runTest')[source]¶ Bases:
nest.tests.test_connect_parameters.TestParams
-
N_s
= 60¶
-
N_t
= 60¶
-
conn_dict
= {'autapses': False, 'make_symmetric': True, 'multapses': True, 'p': 0.5, 'rule': 'symmetric_pairwise_bernoulli'}¶
-
p
= 0.5¶
-
rule
= 'symmetric_pairwise_bernoulli'¶
-
stat_dict
= {'alpha2': 0.05, 'n_runs': 20}¶
-
nest.tests.test_create module¶
Creation tests
nest.tests.test_csa module¶
CSA tests
nest.tests.test_current_recording_generators module¶
Test if currents from generators are being recorded properly
-
class
nest.tests.test_current_recording_generators.
CurrentRecordingGeneratorTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Test if currents from generators are recorded properly. Specifically: 1) Length of current vector should be equal to length of membrane
potential vector- Value of current should be equal to zero when device is inactive
- Check if value of current recorded as expected during active period
nest.tests.test_dataconnect module¶
DataConnect
nest.tests.test_erfc_neuron module¶
Test implementation of erfc-neuron.
-
class
nest.tests.test_erfc_neuron.
ErfcNeuronTheoryTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Compare results to theoretical predictions
-
nest.tests.test_erfc_neuron.
activation_function_theory
(sigma, theta)[source]¶ returns the probability for a binary neuron to be in the up state, given the parameters sigma and theta.
nest.tests.test_errors module¶
Tests for error handling
nest.tests.test_events module¶
Test of events
nest.tests.test_facetshw_stdp module¶
nest.tests.test_getconnections module¶
GetConnections
nest.tests.test_helper_functions module¶
nest.tests.test_labeled_synapses module¶
Test setting and getting labels on synapses.
nest.tests.test_mc_neuron module¶
-
class
nest.tests.test_mc_neuron.
TestMCNeuron
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
-
I0
= 5000¶
-
I1
= 5020¶
-
I_e
= 150.0¶
-
V_reset
= -65.0¶
-
V_th
= -60.0¶
-
Vm_dist_test
= array([-70.0003797 , -70.00037554, -70.00037143, -70.00036737, -70.00036335, -70.00035938, -70.00035545, -70.00035157, -70.00034773, -70.00034393, -70.00033573, -70.00030289, -70.00022565, -70.00008895, -69.99988167, -69.99959601, -69.99922696, -69.9987718 , -69.9982297 , -69.99760137])¶
-
Vm_prox_test
= array([-70.00041394, -70.00041065, -70.00040738, -70.00040414, -70.00040093, -70.00039774, -70.00039457, -70.00039143, -70.00038832, -70.00038523, -69.98857137, -69.95638129, -69.90815375, -69.84758846, -69.77782368, -69.70150641, -69.62085572, -69.53771917, -69.45362308, -69.36981694])¶
-
Vm_soma_test
= array([-70.00033871, -70.00033626, -70.00033383, -70.00033141, -70.00032901, -70.00032662, -70.00032426, -70.00032191, -70.00031957, -70.00031725, -70.00030162, -70.00021189, -69.99998874, -69.99958683, -69.99897263, -69.99812256, -69.99702137, -69.99566068, -69.99403779, -69.99215463])¶
-
distal
= {'C_m': 90.0}¶
-
g_sp
= 5.0¶
-
gex_dist_test
= array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])¶
-
gex_prox_test
= array([0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0.24596033, 0.44510821, 0.60412585, 0.72884756, 0.82436068, 0.89509487, 0.94490122, 0.97712226, 0.99465388, 1.00000005])¶
-
gex_soma_test
= array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])¶
-
proximal
= {'tau_syn_ex': 1.0, 'tau_syn_in': 5.0}¶
-
rec_dic_dc_distal
= {'amplitude': 100.0, 'start': 50.0, 'stop': 100.0}¶
-
rec_dic_dc_proximal
= {'amplitude': -50.0, 'start': 150.0, 'stop': 200.0}¶
-
rec_dic_dc_soma
= {'amplitude': 50.0, 'start': 250.0, 'stop': 300.0}¶
-
rec_sp_dist_ex
= [400.0, 420.0]¶
-
rec_sp_dist_in
= [410.0, 430.0]¶
-
rec_sp_prox_ex
= [500.0, 520.0]¶
-
rec_sp_prox_in
= [510.0, 530.0]¶
-
rec_sp_soma_ex
= [600.0, 620.0]¶
-
rec_sp_soma_in
= [610.0, 630.0]¶
-
soma
= {'g_L': 12.0}¶
-
t0
= 700¶
-
t_ref
= 10.0¶
-
t_stim
= 300¶
-
tau_syn_ex
= 1.0¶
-
tau_syn_in
= 5.0¶
-
nest.tests.test_networks module¶
Network tests
nest.tests.test_onetooneconnect module¶
UnitTests for the PyNEST connect API.
nest.tests.test_parrot_neuron module¶
-
class
nest.tests.test_parrot_neuron.
ParrotNeuronPoissonTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Check parrot_neuron spike repetition properties
-
test_ParrotNeuronIncomingMultiplicity
()[source]¶ Check parrot_neuron heeds multiplicity information in incoming spikes.
This test relies on the fact that poisson_generator transmits multiple spikes during a time step using multiplicity, and that these spikes are delivered directly, i.e., without multiplicity- unrolling in send_remote().
We create a high-rate poisson_generator. If parrot_neuron ignored multiplicity, it would only transmit one spike per time step. We chain two parrot_neurons to check against any loss.
-
-
class
nest.tests.test_parrot_neuron.
ParrotNeuronSTDPTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Check STDP protocol between two parrot_neurons connected by a stdp_synapse. Exact pre- and post-synaptic spike times are set by spike_generators connected to each parrot neuron. Additional spikes sent through the stdp_synapse are explicitly ignored in the postsynaptic parrot_neuron by setting the stdp_synapse to connect to port 1.
-
class
nest.tests.test_parrot_neuron.
ParrotNeuronTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Check parrot_neuron spike repetition properties
nest.tests.test_parrot_neuron_ps module¶
-
class
nest.tests.test_parrot_neuron_ps.
ParrotNeuronPSPoissonTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Check parrot_neuron spike repetition properties
-
test_ParrotNeuronIncomingMultiplicity
()[source]¶ Check parrot_neuron heeds multiplicity information in incoming spikes.
This test relies on the fact that poisson_generator transmits multiple spikes during a time step using multiplicity, and that these spikes are delivered directly, i.e., without multiplicity- unrolling in send_remote().
We create a high-rate poisson_generator. If parrot_neuron ignored multiplicity, it would only transmit one spike per time step. We chain two parrot_neurons to check against any loss.
Note: Even though we test parrot_neuron_ps, we drive it with the plain poisson_generator, since only that generator uses multiplicity.
-
-
class
nest.tests.test_parrot_neuron_ps.
ParrotNeuronPSSTDPTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Check STDP protocol between two parrot_neurons_ps connected by a stdp_synapse. Exact pre- and post-synaptic spike times are set by spike_generators connected to each parrot neuron. Additional spikes sent through the stdp_synapse are explicitly ignored in the postsynaptic parrot_neuron_ps by setting the stdp_synapse to connect to port 1.
-
class
nest.tests.test_parrot_neuron_ps.
ParrotNeuronPSTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Check parrot_neuron spike repetition properties
nest.tests.test_pp_psc_delta module¶
nest.tests.test_pp_psc_delta_stdp module¶
-
class
nest.tests.test_pp_psc_delta_stdp.
PpPscDeltaSTDPTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Regressiontest to reproduce failure of pp_psc_delta to show spike timing dependent plasticity (STDP), as opposed to iaf_psc_delta. The problem is probably related to the setting of ‘archiver_length’.
Moritz Deger, moritz.deger@epfl.ch, Aug 14, 2015
nest.tests.test_quantal_stp_synapse module¶
nest.tests.test_rate_copy_model module¶
nest.tests.test_rate_instantaneous_and_delayed module¶
nest.tests.test_rate_neuron module¶
nest.tests.test_rate_neuron_communication module¶
nest.tests.test_refractory module¶
-
class
nest.tests.test_refractory.
RefractoryTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Check the correct implementation of refractory time in all neuronal models.
-
compute_reftime
(model, sd, vm, neuron)[source]¶ Compute the refractory time of the neuron.
- model : str
- Name of the neuronal model.
- sd : tuple
- GID of the spike detector.
- vm : tuple
- GID of the voltmeter.
- neuron : tuple
- GID of the recorded neuron.
- t_ref_sim : double
- Value of the simulated refractory period.
-
nest.tests.test_siegert_neuron module¶
nest.tests.test_split_simulation module¶
nest.tests.test_stack module¶
Stack tests
nest.tests.test_status module¶
Test if Set/GetStatus work properly
nest.tests.test_stdp_multiplicity module¶
-
class
nest.tests.test_stdp_multiplicity.
StdpSpikeMultiplicity
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Test correct handling of spike multiplicity in STDP.
This test originated from work on issue #77.
Concerning the definition of STDP for multiplicity > 1, consider the following (see also @flinz on #82): A plastic synapse is created between two parrot neurons. As reference case, we use two precise spiking parrot neurons driven by spike trains n*h - k*delta with delta < h, and 1 < k < K such that K delta < h, i.e., we get K spikes in each time step (h is resolution). If we transmit the same spike trains via plain parrot neurons, they will be handled as spikes with multiplicity K. Then, in the limit delta -> 0, the weight changes observed in the synapse between the precise parrots shall converge to the weight changes observed between the plain parrots.
We test the resulting weights as follows:
Weights obtained using parrot_neuron must be identical independent of delta, since in this case all spikes are at the end of the step, i.e., all spikes have identical times independent of delta.
We choose delta values that are decrease by factors of 2. The plasticity rules depend on spike-time differences through
exp(dT / tau)
where dT is the time between pre- and postsynaptic spikes. We construct pre- and postsynaptic spike times so that
dT = pre_post_shift + m * delta
with m * delta < resolution << pre_post_shift. The time-dependence of the plasticity rule is therefore to good approximation linear in delta.
We can thus test as follows: Let w_pl be the weight obtained with the plain parrot, and w_ps_j the weight obtained with the precise parrot for delta_j = delta0 / 2^j. Then,
( w_ps_{j+1} - w_pl ) / ( w_ps_j - w_pl ) ~ 0.5 for all j
i.e., the difference between plain and precise weights halves each time delta is halved.
-
run_protocol
(pre_post_shift)[source]¶ Create network and simulate for each delta value.
Returns a dict with the synaptic weight at end of simulation for plain and precise parrots, one weight per delta value.
All values for the plain parrot case should be identical, and the values for the precise parrot case should converge to that value for delta -> 0.
All delta values must fulfill
multiplicity * delta < resolution / 2so that in the plain case off-grid spike times are rounded up to the end of the step and thus belong to the same step as the corresponding precise spikes.
Parameters: pre_post_shift – Delay between pre- and postsynaptic trains Returns: {‘parrot’: [<weights>], ‘parrot_ps’: [<weights>]}
nest.tests.test_stdp_triplet_synapse module¶
-
class
nest.tests.test_stdp_triplet_synapse.
STDPTripletConnectionTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Check stdp_triplet_connection model properties.
-
assertAlmostEqualDetailed
(expected, given, message)[source]¶ Improve assetAlmostEqual with detailed message.
-
test_badPropertiesSetupsThrowExceptions
()[source]¶ Check that exceptions are thrown when setting bad parameters.
-
test_maxWeightStaturatesWeight
()[source]¶ Check that setting maximum weight property keep weight limited.
-
test_preVarsDecayAfterPostSpike
()[source]¶ Check that pre-synaptic variables (Kplus, Kplus_triplet) decay after each post-synaptic spike.
-
test_preVarsDecayAfterPreSpike
()[source]¶ Check that pre-synaptic variables (Kplus, Kplus_triplet) decay after each pre-synaptic spike.
-
test_preVarsIncreaseWithPreSpike
()[source]¶ Check that pre-synaptic variables (Kplus, Kplus_triplet) increase after each pre-synaptic spike.
-
-
class
nest.tests.test_stdp_triplet_synapse.
STDPTripletInhTestCase
(methodName='runTest')[source]¶ Bases:
nest.tests.test_stdp_triplet_synapse.STDPTripletConnectionTestCase
nest.tests.test_threads module¶
UnitTests for multithreaded pynest
nest.tests.test_use_gid_in_filename module¶
Test if use_gid_in_filename works properly as a parameter of recording devices
nest.tests.test_vogels_sprekeler_synapse module¶
-
class
nest.tests.test_vogels_sprekeler_synapse.
VogelsSprekelerConnectionTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Check vogels_sprekeler_synapse model properties.
-
assertAlmostEqualDetailed
(expected, given, message)[source]¶ Improve assetAlmostEqual with detailed message.
-
test_badPropertiesSetupsThrowExceptions
()[source]¶ Check that exceptions are thrown when setting bad parameters.
-
test_maxWeightStaturatesWeight
()[source]¶ Check that setting maximum weight property keep weight limited.
-
test_preVarsDecayAfterPostSpike
()[source]¶ Check that pre-synaptic variables Kplus decay after each post-synaptic spike.
-
test_preVarsDecayAfterPreSpike
()[source]¶ Check that pre-synaptic variables Kplus decay after each pre-synaptic spike.
-
nest.tests.test_weight_recorder module¶
Test of events