MOD File Converter

class dendrotweaks.biophys.io.converter.MODFileConverter[source]

Bases: object

Converts a MOD file to a Python file.

reader

The MOD file reader.

Type:

MODFileReader

parser

The MOD file parser.

Type:

MODFileParser

generator

The Python code generator.

Type:

PythonCodeGenerator

property mod_content

The content of the MOD file.

property blocks

The blocks of the MOD file corresponding to the NMODL blocks e.g. NEURON, PARAMETER, ASSIGNED, etc.

property ast

The abstract syntax tree of the MOD file.

property python_content

The content of the generated Python file.

convert(path_to_mod_file: str, path_to_python_file: str, path_to_python_template: str, path_to_json_file: str = None, verbose: bool = False) None[source]

Converts a MOD file to a Python file.

Parameters:
  • path_to_mod (str) – The path to the original MOD file.

  • path_to_python (str) – The path to the output Python file.

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

  • path_to_json (str, optional) – The path to the json file to write the AST.

  • verbose (bool, optional) – Whether to print the progress of the conversion.