Spherical Cap Approximation

droppy.circularfits.dist(param, points)

Calculate the total distance from the calculated circle to the points

Parameters
  • param – list of 3 elements with the center of a circle and its radius

  • points – list of (x, y) points that should be lying on the circle

Returns

the sum of squared errrors from the points on the circle with the provided parameters

droppy.circularfits.find_intersection(baseline_coeffs, circ_params)

Compute the intersection points between the best fit circle and best-fit baseline.

For this we rely on several coordinate transformations, first a translation to the centerpoint of the circle and then a rotation to give the baseline zero-slope.

Parameters
  • baseline_coeffs – Numpy array of coefficients to the baseline polynomial

  • circ_params – centerpoint and radius of best-fit circle

Returns

(x,y) point of intersection between these two shapes

droppy.circularfits.fit_circle(points, width=None, start=False)

Compute the best-fit circle to points by minimizing dist from changing values of the centerpoint and radius

Parameters
  • points – list of (x,y) points lying on the droplet to fit

  • width – estimated width of the droplet from the crop boundaries

  • start – boolean flag to determine how many parameters to fit (just radius if True, otherwise radius and centerpoint)

Returns

result structure from scipy.opt.minimize

droppy.circularfits.generate_circle_vectors(intersection)

Using the intersection point with the baseline, compute the vector that points tangent to the circle

Parameters

intersection – (x,y) point on the circle that crosses the baseline

Returns

baseline vector and vector tangent to best-fit circle