How to understand a code to calculate fluxes

I am unable to understand how this code work. Where window is a line with two points. Window is where we calculate the flux. I want to understand how exactly the code is working

times = np.zeros((len(x)), dtype=int)
    
    center_x, center_y = 0.5 * (window.point1[0] + window.point2[0]),                          0.5 * (window.point1[1] + window.point2[1])
    safety_value = 3.0
    radius = safety_value * 0.5 * (math.sqrt((window.point1[0] - window.point2[0])**2 +                               (window.point1[1] - window.point2[1])**2))
    
    # fictive boaders
    left_boarder, right_boarder = center_x - radius, center_x + radius
    bottom_boarder, up_boarder = center_y - radius, center_y + radius
    
    i = 1
    while (i < len(x)-1):


        if (left_boarder <= x[i] <= right_boarder) and         (x[i] > x[i-1]) and         np.sign(window.perpendicular_distance_unnormalized(x[i], y[i])) !=         np.sign(window.perpendicular_distance_unnormalized(x[i-1], y[i-1])) and         window.is_point_on_segment(x[i], y[i]) and         window.is_point_on_segment(x[i-1], y[i-1]):

            times[i] += 1
            i += 1
            
        else:
            i += 1

    return times

result = 0

for i in range(y_min, y_max):
    result += UX[x_, i]

return result

def calculate_vel_fluxes(ux, windows):
    vel_fluxes = np.empty((len(windows), ux.shape[0]))
    for i in range(len(windows)):
        for j in range(ux.shape[0]):
            vel_fluxes[i, j] = uFlux(ux[j], windows[i])
    return vel_fluxes
How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum