region_grower.utils

Utils module.

Functions

assign_morphologies(cells, morphologies)

Assign morphologies to CellCollection.

check_na_morphologies(morph_list, mtypes[, ...])

Check N/A ratio per mtype.

create_morphologies_dict(dat_file, morph_path)

Create dict to load the morphologies from a directory, with dat file.

load_morphology_list(filepath[, check_gids])

Read morphology list from tab-separated file.

random_rotation_y(n[, rng])

Random rotation around Y-axis.

setup_logger([level, prefix, suffix])

Setup application logger.

Classes

NumpyEncoder(*[, skipkeys, ensure_ascii, ...])

To encode numpy arrays.

class region_grower.utils.NumpyEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)

Bases: JSONEncoder

To encode numpy arrays.

default(o)

Actual encoder.

region_grower.utils.assign_morphologies(cells, morphologies)

Assign morphologies to CellCollection.

Parameters:
  • cells – CellCollection to be augmented

  • morphologies – dictionary {gid -> morphology_name}

No return value; cells is input/output argument.

region_grower.utils.check_na_morphologies(morph_list, mtypes, threshold=None)

Check N/A ratio per mtype.

region_grower.utils.create_morphologies_dict(dat_file, morph_path, ext='.asc')

Create dict to load the morphologies from a directory, with dat file.

region_grower.utils.load_morphology_list(filepath, check_gids=None)

Read morphology list from tab-separated file.

region_grower.utils.random_rotation_y(n, rng=<module 'numpy.random' from '/home/docs/checkouts/readthedocs.org/user_builds/region-grower/envs/latest/lib/python3.11/site-packages/numpy/random/__init__.py'>)

Random rotation around Y-axis.

Parameters:

n – number of rotation matrices to generate

Returns:

n x 3 x 3 NumPy array with rotation matrices.

region_grower.utils.setup_logger(level='info', prefix='', suffix='')

Setup application logger.