Code generators

class dendrotweaks.biophys.io.code_generators.PythonCodeGenerator[source]

Bases: CodeGenerator

A class to generate Python code from an AST using a Jinja2 template.

generate(ast, path_to_template)[source]

Generate a Python class from the AST using a Jinja2 template.

Parameters:
  • ast (dict) – The AST representation of the channel

  • path_to_template (str) – The path to the Jinja2 template file

Returns:

The Python code generated from the AST

Return type:

str

write_file(path_to_file)
class dendrotweaks.biophys.io.code_generators.NMODLCodeGenerator[source]

Bases: CodeGenerator

A class to generate NMODL code from a StandardIonChannel

generate(channel, path_to_template: str) None[source]

Generate NMODL code for a standardized ion channel using a Jinja2 template.

Parameters:
  • channel (StandardIonChannel) – The standardized ion channel.

  • path_to_template (str) – The path to the Jinja2 template file.

write_file(path_to_file)