Example #1
0
        print tempdir
    device.build(directory=tempdir,
                 compile=True,
                 run=True,
                 with_output=with_output)

    for idx in xrange(4):
        # x variable should have neuron independent values
        assert_equal(mon[idx].x[:],
                     np.clip(np.arange(11).repeat(10), 0, 9) * volt)

    for idx in xrange(3):
        # y variable is neuron-specific
        assert_equal(mon[idx].y[:], np.clip(np.arange(110), 0, 99) + idx * 100)
    # the 2d array only has 3 columns, the last neuron should therefore contain
    # only NaN
    assert_equal(mon[3].y[:], np.nan)

    set_device(previous_device)


if __name__ == '__main__':
    # Print the debug output when testing this file only but not when running
    # via nose test
    for t in [
            test_cpp_standalone, test_multiple_connects, test_storing_loading,
            test_openmp_consistency, test_timedarray
    ]:
        t(with_output=True)
        restore_device()
Example #2
0
if __name__ == '__main__':
    SANITY_CHECK_PERMUTATION_ANALYSIS_EXAMPLE = True
    from brian2 import prefs
    # prefs.codegen.target = 'numpy'
    import time
    start = time.time()

    test_creation()
    test_name_clashes()
    test_incoming_outgoing()
    test_connection_string_deterministic()
    test_connection_random()
    test_connection_multiple_synapses()
    test_connection_arrays()
    test_connection_array_standalone()
    restore_device()
    test_state_variable_assignment()
    test_state_variable_indexing()
    test_indices()
    test_subexpression_references()
    test_delay_specification()
    test_pre_before_post()
    test_transmission_simple()
    test_transmission_custom_event()
    test_invalid_custom_event()
    test_transmission()
    test_transmission_all_to_one_heterogeneous_delays()
    test_transmission_one_to_all_heterogeneous_delays()
    test_transmission_scalar_delay()
    test_transmission_scalar_delay_different_clocks()
    test_clocks()