synthesis_workflow.tools

Some tool functions used in synthesis.

Classes

IdProcessingFormatter

Logging formatter class.

DebugingFileHandler

Logging class that can be retrieved.

Functions

add_morphology_paths(morphs_df, morphology_dirs)

Same as the path loader of morph_tool.utils.neurondb_dataframe, but add multiple columns.

add_apical_points(morphs_df, apical_points)

Adds apical points isec in morphs_df.

load_neurondb_to_dataframe(neurondb_path[, ...])

Loads morphology release to a dataframe.

ensure_dir(file_path)

Creates directory to save file.

find_case_insensitive_file(path)

Helper function to find a file ignoring case.

update_morphs_df(morphs_df_path, new_morphs_df)

Updates a morphs_df with new entries to preserve duplicates.

_wrap_worker(_id, worker[, logger_kwargs])

Wraps the worker job and catch exceptions that must be caught.

run_master(master_cls, kwargs[, parser_args, ...])

Running the parallel computation, (adapted from placement_algorithm).

Module Contents

add_morphology_paths(morphs_df, morphology_dirs)

Same as the path loader of morph_tool.utils.neurondb_dataframe, but add multiple columns.

Parameters:
  • morphs_df (pandas.DataFrame) – the morphs_df DataFrame

  • morphology_dirs – (dict) If passed, a column with the path to each morphology file will be added for each entry of the dict, where the column name is the dict key

add_apical_points(morphs_df, apical_points)

Adds apical points isec in morphs_df.

Parameters:
  • morphs_df (pandas.DataFrame) – the morphs_df DataFrame

  • apical_points (dict) – name of cell as key and apical point isec as value

load_neurondb_to_dataframe(neurondb_path, morphology_dirs=None, apical_points_path=None)

Loads morphology release to a dataframe.

Parameters:
  • neurondb_path (str) – path to a neurondb.xml file

  • morphology_dirs (dict) – If passed, a column with the path to each morphology file will be added for each entry of the dict, where the column name is the dict key

  • apical_points_path (str) – path to JSON file containing apical points

ensure_dir(file_path)

Creates directory to save file.

find_case_insensitive_file(path)

Helper function to find a file ignoring case.

update_morphs_df(morphs_df_path, new_morphs_df)

Updates a morphs_df with new entries to preserve duplicates.

class IdProcessingFormatter(fmt=None, datefmt=None, current_id=None)

Bases: logging.Formatter

Logging formatter class.

orig_datefmt
orig_fmt
set_id(new_id)

Updates current ID to insert in format.

class DebugingFileHandler(filename, mode='a', encoding=None, delay=False, errors=None)

Bases: logging.FileHandler

Logging class that can be retrieved.

_wrap_worker(_id, worker, logger_kwargs=None)

Wraps the worker job and catch exceptions that must be caught.

run_master(master_cls, kwargs, parser_args=None, defaults=None, nb_jobs=-1, verbose=10, logger_kwargs=None)

Running the parallel computation, (adapted from placement_algorithm).

Parameters:
  • master_cls (class) – The Master application

  • kwargs (dict) – A class with same attributes as CLI args

  • parser_args (list) – The arguments of the parser

  • defaults (dict) – The default values

  • nb_jobs (int) – Number of threads used

  • verbose (int) – verbosity level used by Joblib

  • logger_kwargs (dict) – Parameters given to logger in each processes