utils

This module provides utility functions for the package, such as file path helpers.

add_mechanism(mech_file_path)[source]

Add a new mechanism file to the package’s ‘mechanisms’ directory.

Parameters

mech_file_pathstr

The file path of the mechanism file to add.

add_morphology(morph_file_path)[source]

Add a new morphology file to the package’s ‘cells’ directory.

Parameters

morph_file_pathstr

The file path of the morphology file to add.

compile_mechs(mech_path=None, workdir=None, nrnivmodl_path=None)[source]

Compile NEURON mechanisms in the specified directory using nrnivmodl.

Parameters

mech_pathstr, optional

Path to the directory containing NEURON mechanism files.

workdirstr, optional

Working directory where compilation will occur and load compiled mechanisms from.

nrnivmodl_pathstr, optional

Path to the nrnivmodl executable.

get_cell_dir_path()[source]

Get the path to the cell morphology files directory.

Returns

str:

The path to the ‘cells’ directory within the golding_mso package.

get_cell_file_paths(*filenames)[source]

Return a list[str] of filepaths to cell morphology files inside the package’s ‘cells’ directory. If no filenames are provided, it returns all cell files included in the package directory. Usage: >>> from golding_mso.utils import get_cell_file_paths >>> from golding_mso.cell import Cell >>> cell_file_path = get_cell_file_paths(“151124_03”)[0] >>> cell = Cell(cell_file_path) …

Parameters

filenames: str

Optional variable number of filenames to search for in the package’s ‘cells’ directory.

Returns

list:

A list of file paths to the cell morphology files.

get_mechanisms()[source]

Create a dictionary mapping mechanism names to their file paths in the package’s ‘mechanisms’ directory.

Returns

dict:

A dictionary where keys are mechanism names (file stems) and values are file paths.

get_morphologies()[source]

Create a dictionary mapping morphology names to their file paths in the package’s ‘cells’ directory.

Returns

dict:

A dictionary where keys are morphology names (file stems) and values are file paths.

get_package_path()[source]

Get the path to the golding_mso package directory.

Returns

str:

The path to the golding_mso package directory.

load_dll(dll_path='')[source]

Load a compiled NEURON mechanism DLL.

Parameters

dll_pathstr

Path to the compiled NEURON mechanism DLL.

load_pkg_dll()[source]

Load the compiled NEURON mechanism DLL from the package directory. Runs at package initialization.