<commit_before># Plot Empirical Cumulative Distribution Function for Object Size

import os
import cv2
import pandas as pd
from plantcv.plantcv import params
from plantcv.plantcv._debug import _debug
from statsmodels.distributions.empirical_distribution import ECDF
from plotnine import ggplot, aes, geom_point, labels, scale_x_log10


def obj_size_ecdf(mask, title=None):
    """ Plot empirical cumulative distribution for object size based on binary
    mask

    Inputs:
    mask  = binary mask
    title = a custom title for the plot (default=None)

    Returns:
    fig_ecdf = empirical cumulative distribution function plot

    :param mask: numpy.ndarray
    :param title: str
    :return fig_ecdf: plotnine.ggplot.ggplot
    """

    objects, hierarchy = cv2.findContours(mask, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)[-2:]
    areas = [cv2.contourArea(cnt) for cnt in objects]
# Remove objects with areas < 1px
areas = [i for i in areas if i >= 1.0]<commit_msg>Update obj_size_ecdf.py<commit_after># Plot Empirical Cumulative Distribution Function for Object Size

import os
import cv2
import pandas as pd
from plantcv.plantcv import params
from plantcv.plantcv._debug import _debug
from statsmodels.distributions.empirical_distribution import ECDF
from plotnine import ggplot, aes, geom_point, labels, scale_x_log10


def obj_size_ecdf(mask, title=None):
    """ Plot empirical cumulative distribution for object size based on binary
    mask

    Inputs:
    mask  = binary mask
    title = a custom title for the plot (default=None)

    Returns:
    fig_ecdf = empirical cumulative distribution function plot

    :param mask: numpy.ndarray
    :param title: str
    :return fig_ecdf: plotnine.ggplot.ggplot
    """

    objects, hierarchy = cv2.findContours(mask, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)[-2:]
    areas = [cv2.contourArea(cnt) for cnt in objects]
    # Remove objects with areas < 1px
    areas = [i for i in areas if i >= 1.0]
{'fraction_non_alphanumeric': 0.0701844262295082, 'fraction_numerical': 0.011270491803278689, 'mean_word_length': 4.046511627906977, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2128459', 'n_tokens_mistral': 623, 'n_tokens_neox': 593, 'n_words': 208}