neuro_morpho.reports.stats

Generates plots and reports for model comparison.

Attributes

VALID_DISTANCES

ERR_INVALID_DIST

SKELETON_STAT_FN

STAT_N_BRANCHES

STAT_N_TIP_POINTS

STAT_TOTAL_LENGTH

STAT_BRANCH_LENGTHS

Functions

extract_branch_ids(→ set[int])

Extract the branch ids from the skan skeleton data.

calculate_n_branches(→ int)

Calculate the number of branches in the skeleton data.

calculate_n_tip_points(→ int)

Calculate the number of tip points in the skeleton data.

calculate_total_length(→ float)

Calculate the total length of the skeleton data.

calculate_branch_lengths(→ numpy.ndarray)

Calculate the lengths of each branch in the skeleton data.

skeleton_analysis(→ dict[str, dict[str, float]])

Generate a summary of the skeleton analysis.

Module Contents

neuro_morpho.reports.stats.VALID_DISTANCES
neuro_morpho.reports.stats.ERR_INVALID_DIST = Multiline-String
Show Value
"""Invalid distance type. Must be one of Set.set(elts=[ <Const.str l.10 at 0x78344d9a2990>,
          <Const.str l.10 at 0x78344d9a2a10>])"""
neuro_morpho.reports.stats.SKELETON_STAT_FN
neuro_morpho.reports.stats.STAT_N_BRANCHES = 'n_branches'
neuro_morpho.reports.stats.STAT_N_TIP_POINTS = 'n_tip_points'
neuro_morpho.reports.stats.STAT_TOTAL_LENGTH = 'total_length'
neuro_morpho.reports.stats.STAT_BRANCH_LENGTHS = 'branch_lengths'
neuro_morpho.reports.stats.extract_branch_ids(skan_skel_data: pandas.DataFrame) set[int][source]

Extract the branch ids from the skan skeleton data.

Parameters:

skan_skel_data (pd.DataFrame) – The skan skeleton data.

Returns:

neuro_morpho.reports.stats.calculate_n_branches(skan_skel_data: pandas.DataFrame, *, include_isolated_branches: bool = False, include_isolated_cycles: bool = False) int[source]

Calculate the number of branches in the skeleton data.

Parameters:

skan_skel_data (pd.DataFrame) – The skan skeleton data.

Returns:

The number of branches in the skeleton data.

neuro_morpho.reports.stats.calculate_n_tip_points(skan_skel_data: pandas.DataFrame, *, include_isolated_branches: bool = False) int[source]

Calculate the number of tip points in the skeleton data.

Parameters:

skan_skel_data (pd.DataFrame) – The skan skeleton data.

Returns:

The number of tip points in the skeleton data.

neuro_morpho.reports.stats.calculate_total_length(skan_skel_data: pandas.DataFrame, dist_type: str = 'euclidean') float[source]

Calculate the total length of the skeleton data.

Parameters:
  • skan_skel_data (pd.DataFrame) – The skan skeleton data.

  • dist_type (str) – The type of distance to use for the length calculation.

Returns:

The total length of the skeleton data.

neuro_morpho.reports.stats.calculate_branch_lengths(skan_skel_data: pandas.DataFrame, dist_type: str = 'euclidean') numpy.ndarray[source]

Calculate the lengths of each branch in the skeleton data.

Parameters:
  • skan_skel_data (pd.DataFrame) – The skan skeleton data.

  • dist_type (str) – The type of distance to use for the length calculation.

Returns:

a numpy array of the branch lengths

neuro_morpho.reports.stats.skeleton_analysis(skeleton: numpy.ndarray, stat_fns: tuple[list[str], list[SKELETON_STAT_FN]], pixel_size: float = 1, *, assume_single_skeleton: bool = False) dict[str, dict[str, float]][source]

Generate a summary of the skeleton analysis.

Parameters:
  • skeleton (np.ndarray) – The skeleton of the image to analyze, should be 2d.

  • stat_fns (tuple[list[str], list[SKELETON_STAT_FN]]) – The list of functions to use for the analysis.

  • pixel_size (float) – The size of the pixel in the image.