<commit_before>
import numpy as np

from basics.profile import profile_line


def azimuthal_profiles(image, blob, ntheta=360, verbose=False,
                       extend_factor=1.0):
    '''
    Calculate azimuthal profiles from the centre of a bubble to its edge.
    '''

    y0, x0, a, b, pa = blob.copy()

    a *= extend_factor
    b *= extend_factor

    thetas = np.linspace(0.0, 2*np.pi, ntheta)

    profiles = []

    for i, theta in enumerate(thetas):

        end_pt = (y0 + a*np.cos(theta)*np.sin(pa) - b*np.sin(theta)*np.cos(pa),
                  x0 + a*np.cos(theta)*np.cos(pa) - b*np.sin(theta)*np.sin(pa))

        profile, dists = profile_line(image, (y0, x0), end_pt)

        profiles.append(profile)

        if verbose:
            import matplotlib.pyplot as p

            p.subplot(121)
            p.imshow(image, cmap='afmhot')
            p.plot(x0, y0, 'bD')
            p.plot(end_pt[1], end_pt[0], 'rD')
            p.xlim([0, image.shape[1]])
            p.ylim([0, image.shape[0]])

            p.subplot(122)
            p.plot(dists, profile, 'bD-')

            p.show()

    profiles = np.asarray(profiles)

    return profiles<commit_msg>Array conversion does not work for ellipses<commit_after>
import numpy as np

from basics.profile import profile_line


def azimuthal_profiles(image, blob, ntheta=360, verbose=False,
                       extend_factor=1.0):
    '''
    Calculate azimuthal profiles from the centre of a bubble to its edge.
    '''

    y0, x0, a, b, pa = blob.copy()

    a *= extend_factor
    b *= extend_factor

    thetas = np.linspace(0.0, 2*np.pi, ntheta)

    profiles = []

    for i, theta in enumerate(thetas):

        end_pt = (y0 + a*np.cos(theta)*np.sin(pa) - b*np.sin(theta)*np.cos(pa),
                  x0 + a*np.cos(theta)*np.cos(pa) - b*np.sin(theta)*np.sin(pa))

        profile, dists = profile_line(image, (y0, x0), end_pt)

        profiles.append(profile)

        if verbose:
            import matplotlib.pyplot as p

            p.subplot(121)
            p.imshow(image, cmap='afmhot')
            p.plot(x0, y0, 'bD')
            p.plot(end_pt[1], end_pt[0], 'rD')
            p.xlim([0, image.shape[1]])
            p.ylim([0, image.shape[0]])

            p.subplot(122)
            p.plot(dists, profile, 'bD-')

            p.show()

    return profiles
{'fraction_non_alphanumeric': 0.14133673903788846, 'fraction_numerical': 0.023839931885908897, 'mean_word_length': 2.0283505154639174, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7210899', 'n_tokens_mistral': 888, 'n_tokens_neox': 831, 'n_words': 181}