Path manager

class dendrotweaks.path_manager.PathManager(path_to_model: str)[source]

Bases: object

A manager class for handling file and directory paths related to models data.

Parameters:

path_to_model (str) – The path to the model directory.

path_to_model

The path to the model directory.

Type:

str

paths

A dictionary of paths for different file types.

Type:

Dict[str, str]

property path_to_data

The path to the data directory.

copy_default_mod_files()[source]

Copy default mod files to the data directory.

copy_template_files()[source]

Copy template files to the data directory.

get_path(file_type: str) str[source]

Get the path for a specific file type.

Parameters:

file_type (str) – The type of file (e.g., ‘mod’, ‘swc’).

Returns:

The full directory path.

Return type:

str

get_file_path(file_type: str, file_name: str, extension: str) str[source]

Construct a file path with an optional extension for a specific type.

Parameters:
  • file_type (str) – The type of file (e.g., ‘morphology’, ‘stimuli’).

  • file_name (str) – The name of the file.

  • extension (str) – The file extension (e.g., ‘mod’, ‘swc’).

Returns:

The full file path.

Return type:

str

list_files(file_type: str, extension: str = '') List[str][source]

List all files of a given type and optional archive.

Parameters:
  • file_type (str) – The type of file (e.g. ‘morphology’, ‘stimuli’).

  • extension (str) – The file extension to filter by (e.g., ‘mod’, ‘swc’).

Returns:

A list of file names.

Return type:

List[str]

list_morphologies(extension: str = '.swc') List[str][source]

List all SWC files.

Returns:

A list of SWC file names.

Return type:

List[str]

list_stimuli(extension: str = '.json') List[str][source]

List all JSON files.

Returns:

A list of JSON file names.

Return type:

List[str]

list_biophys()[source]

List all biophysics files.

Returns:

A list of biophysics file names.

Return type:

List[str]

print_directory_tree(subfolder=None) None[source]

Print a directory tree for a given file type.

Parameters:

file_type (str) – The type of file (e.g., ‘mod’, ‘swc’).

get_channel_paths(mechanism_name: str, python_template_name: str = None) Dict[str, str][source]

Get all necessary paths for creating a channel.

Parameters:
  • mechanism_name (str) – The name of the mechanism.

  • python_template_name (str, optional) – The name of the Python template file.

Returns:

A dictionary of paths.

Return type:

Dict[str, str]

get_standard_channel_paths(mechanism_name: str, python_template_name: str = None, mod_template_name: str = None) Dict[str, str][source]

Get all necessary paths for creating a standard channel.

Parameters:
  • mechanism_name (str) – The name of the mechanism.

  • python_template_name (str, optional) – The name of the Python template file.

  • mod_template_name (str, optional) – The name of the MOD template file.

Returns:

A dictionary of paths.

Return type:

Dict[str, str]