class_docstr: Total least squares estimator for 2D circles.
  
  The functional model of the circle is::
  
      r**2 = (x - xc)**2 + (y - yc)**2
  
  This estimator minimizes the squared distances from all points to the
  circle::
  
      min{ sum((r - sqrt((x_i - xc)**2 + (y_i - yc)**2))**2) }
  
  A minimum number of 3 points is required to solve for the parameters.
  
  Attributes
  ----------
  params : tuple
      Circle model parameters in the following order `xc`, `yc`, `r`.
  
  Notes
  -----
  The estimation is carried out using a 2D version of the spherical
  estimation given in [1]_.
  
  References
  ----------
  .. [1] Jekel, Charles F. Obtaining non-linear orthotropic material models
         for pvc-coated polyester via inverse bubble inflation.
         Thesis (MEng), Stellenbosch University, 2016. Appendix A, pp. 83-87.
         https://hdl.handle.net/10019.1/98627
  
  Examples
  --------
  >>> t = np.linspace(0, 2 * np.pi, 25)
  >>> xy = CircleModel().predict_xy(t, params=(2, 3, 4))
  >>> model = CircleModel()
  >>> model.estimate(xy)
  True
  >>> tuple(np.round(model.params, 5))
  (2.0, 3.0, 4.0)
  >>> res = model.residuals(xy)
  >>> np.abs(np.round(res, 9))
  array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
         0., 0., 0., 0., 0., 0., 0., 0.])
class_docstr_tok: ["Total","least","squares","estimator","for","2D","circles",".","The","functional","model","of","the","circle","is",":",":","r","*","*","2","=","(","x","-","xc",")","*","*","2","+","(","y","-","yc",")","*","*","2","This","estimator","minimizes","the","squared","distances","from","all","points","to","the","circle",":",":","min","{","sum","(","(","r","-","sqrt","(","(","x_i","-","xc",")","*","*","2","+","(","y_i","-","yc",")","*","*","2",")",")","*","*","2",")","}","A","minimum","number","of","3","points","is","required","to","solve","for","the","parameters",".","Attributes","--","--","--","--","--","params",":","tuple","Circle","model","parameters","in","the","following","order","`","xc","`",",","`","yc","`",",","`","r","`",".","Notes","--","--","-","The","estimation","is","carried","out","using","a","2D","version","of","the","spherical","estimation","given","in","[","1","]","_.","References","--","--","--","--","--","..","[","1","]","Jekel",",","Charles","F.","Obtaining","non-linear","orthotropic","material","models","for","pvc-coated","polyester","via","inverse","bubble","inflation",".","Thesis","(","MEng",")",",","Stellenbosch","University",",","2016",".","Appendix","A",",","pp",".","83-87.","https",":","\/\/hdl.handle.net\/10019.1\/98627","Examples","--","--","--","--",">",">",">","t","=","np.linspace","(","0",",","2","*","np.pi",",","25",")",">",">",">","xy","=","CircleModel","(",")",".predict_xy","(","t",",","params=","(","2",",","3",",","4",")",")",">",">",">","model","=","CircleModel","(",")",">",">",">","model.estimate","(","xy",")","True",">",">",">","tuple","(","np.round","(","model.params",",","5",")",")","(","2.0",",","3.0",",","4.0",")",">",">",">","res","=","model.residuals","(","xy",")",">",">",">","np.abs","(","np.round","(","res",",","9",")",")","array","(","[","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0",".","]",")"]
docstr: Predict x- and y-coordinates using the estimated model.
  
  Parameters
  ----------
  t : array
      Angles in circle in radians. Angles start to count from positive
      x-axis to positive y-axis in a right-handed system.
  params : (3,) array, optional
      Optional custom parameter set.
  
  Returns
  -------
  xy : (..., 2) array
      Predicted x- and y-coordinates.
docstr_tok: ["Predict","x-","and","y-coordinates","using","the","estimated","model",".","Parameters","--","--","--","--","--","t",":","array","Angles","in","circle","in","radians",".","Angles","start","to","count","from","positive","x-axis","to","positive","y-axis","in","a","right-handed","system",".","params",":","(","3",",",")","array",",","optional","Optional","custom","parameter","set",".","Returns","--","--","--","-","xy",":","(","...",",","2",")","array","Predicted","x-","and","y-coordinates","."]
code: def predict_xy(self, t, params=None):
      """Predict x- and y-coordinates using the estimated model.
  
      Parameters
      ----------
      t : array
          Angles in circle in radians. Angles start to count from positive
          x-axis to positive y-axis in a right-handed system.
      params : (3,) array, optional
          Optional custom parameter set.
  
      Returns
      -------
      xy : (..., 2) array
          Predicted x- and y-coordinates.
  
      """
      if params is None:
          params = self.params
      xc, yc, r = params
  
      x = xc + r * np.cos(t)
      y = yc + r * np.sin(t)
  
      return np.concatenate((x[..., None], y[..., None]), axis=t.ndim)
  
imports: import math
  from warnings import warn
  import numpy
  from numpy.linalg import inv
  from scipy import optimize, spatial
label_desc: Use image node_id 3 for calling the CircleModel obj's underlying member method code with example usage: obj.predict_xy(t, params) and returns: np