NumpyCodeGenerator class

(Shortest import: from brian2 import NumpyCodeGenerator)

class brian2.codegen.generators.numpy_generator.NumpyCodeGenerator(variables, variable_indices, owner, iterate_all, codeobj_class, name, template_name, override_conditional_write=None, allows_scalar_write=False)[source]

Bases: brian2.codegen.generators.base.CodeGenerator

Numpy language

Essentially Python but vectorised.

Methods

conditional_write(line, stmt, variables, …)
determine_keywords() A dictionary of values that is made available to the templated.
read_arrays(read, write, indices, variables, …)
translate_expression(expr) Translate the given expression string into a string in the target language, returns a string.
translate_one_statement_sequence(statements)
translate_statement(statement) Translate a single line Statement into the target language, returns a string.
ufunc_at_vectorisation(statement, variables, …)
vectorise_code(statements, variables, …[, …])
write_arrays(statements, read, write, …)

Details

conditional_write(line, stmt, variables, conditional_write_vars, created_vars)[source]
determine_keywords()[source]

A dictionary of values that is made available to the templated. This is used for example by the CPPCodeGenerator to set up all the supporting code

read_arrays(read, write, indices, variables, variable_indices)[source]
translate_expression(expr)[source]

Translate the given expression string into a string in the target language, returns a string.

translate_one_statement_sequence(statements, scalar=False)[source]
translate_statement(statement)[source]

Translate a single line Statement into the target language, returns a string.

ufunc_at_vectorisation(statement, variables, indices, conditional_write_vars, created_vars, used_variables)[source]
vectorise_code(statements, variables, variable_indices, index='_idx')[source]
write_arrays(statements, read, write, variables, variable_indices)[source]