def sholl_crossings(neurites, center, radii):
def _count_crossings(neurite, radius):<EOL><INDENT>'''<STR_LIT>'''<EOL>r2 = radius ** <NUM_LIT:2><EOL>count = <NUM_LIT:0><EOL>for start, end in iter_segments(neurite):<EOL><INDENT>start_dist2, end_dist2 = (morphmath.point_dist2(center, start),<EOL>morphmath.point_dist2(center, end))<EOL>count += int(start_dist2 <= r2 <= end_dist2 or<EOL>end_dist2 <= r2 <= start_dist2)<EOL><DEDENT>return count<EOL><DEDENT>return np.array([sum(_count_crossings(neurite, r)<EOL>for neurite in iter_neurites(neurites))<EOL>for r in radii])<EOL>
calculate crossings of neurites

    Args:
        nrn(morph): morphology on which to perform Sholl analysis
        radii(iterable of floats): radii for which crossings will be counted

    Returns:
        Array of same length as radii, with a count of the number of crossings
        for the respective radius