neuro_morpho.reports.stats ========================== .. py:module:: neuro_morpho.reports.stats .. autoapi-nested-parse:: Generates plots and reports for model comparison. Attributes ---------- .. autoapisummary:: neuro_morpho.reports.stats.VALID_DISTANCES neuro_morpho.reports.stats.ERR_INVALID_DIST neuro_morpho.reports.stats.SKELETON_STAT_FN neuro_morpho.reports.stats.STAT_N_BRANCHES neuro_morpho.reports.stats.STAT_N_TIP_POINTS neuro_morpho.reports.stats.STAT_TOTAL_LENGTH neuro_morpho.reports.stats.STAT_BRANCH_LENGTHS Functions --------- .. autoapisummary:: neuro_morpho.reports.stats.extract_branch_ids neuro_morpho.reports.stats.calculate_n_branches neuro_morpho.reports.stats.calculate_n_tip_points neuro_morpho.reports.stats.calculate_total_length neuro_morpho.reports.stats.calculate_branch_lengths neuro_morpho.reports.stats.skeleton_analysis Module Contents --------------- .. py:data:: VALID_DISTANCES .. py:data:: ERR_INVALID_DIST :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """Invalid distance type. Must be one of Set.set(elts=[ , ])""" .. raw:: html
.. py:data:: SKELETON_STAT_FN .. py:data:: STAT_N_BRANCHES :value: 'n_branches' .. py:data:: STAT_N_TIP_POINTS :value: 'n_tip_points' .. py:data:: STAT_TOTAL_LENGTH :value: 'total_length' .. py:data:: STAT_BRANCH_LENGTHS :value: 'branch_lengths' .. py:function:: extract_branch_ids(skan_skel_data: pandas.DataFrame) -> set[int] Extract the branch ids from the skan skeleton data. :param skan_skel_data: The skan skeleton data. :type skan_skel_data: pd.DataFrame Returns: .. py:function:: calculate_n_branches(skan_skel_data: pandas.DataFrame, *, include_isolated_branches: bool = False, include_isolated_cycles: bool = False) -> int Calculate the number of branches in the skeleton data. :param skan_skel_data: The skan skeleton data. :type skan_skel_data: pd.DataFrame :returns: The number of branches in the skeleton data. .. py:function:: calculate_n_tip_points(skan_skel_data: pandas.DataFrame, *, include_isolated_branches: bool = False) -> int Calculate the number of tip points in the skeleton data. :param skan_skel_data: The skan skeleton data. :type skan_skel_data: pd.DataFrame :returns: The number of tip points in the skeleton data. .. py:function:: calculate_total_length(skan_skel_data: pandas.DataFrame, dist_type: str = 'euclidean') -> float Calculate the total length of the skeleton data. :param skan_skel_data: The skan skeleton data. :type skan_skel_data: pd.DataFrame :param dist_type: The type of distance to use for the length calculation. :type dist_type: str :returns: The total length of the skeleton data. .. py:function:: calculate_branch_lengths(skan_skel_data: pandas.DataFrame, dist_type: str = 'euclidean') -> numpy.ndarray Calculate the lengths of each branch in the skeleton data. :param skan_skel_data: The skan skeleton data. :type skan_skel_data: pd.DataFrame :param dist_type: The type of distance to use for the length calculation. :type dist_type: str :returns: a numpy array of the branch lengths .. py:function:: 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]] Generate a summary of the skeleton analysis. :param skeleton: The skeleton of the image to analyze, should be 2d. :type skeleton: np.ndarray :param stat_fns: The list of functions to use for the analysis. :type stat_fns: tuple[list[str], list[SKELETON_STAT_FN]] :param pixel_size: The size of the pixel in the image. :type pixel_size: float