arte/utils/shape_fitter.py
def fit_circle_correlation(self,
                               method='Nelder-Mead',
                               display=False,
                               **keywords):
        '''Perform a circle fitting on the current mask using minimization 
        algorithm  with correlation merit functions.

        Tested with following minimizations methods: 'Nelder-Mead'. Relative 
        precision of 1% reached on synthetic images without noise.

        Parameters
        ----------
            method: string, default='Nelder-Mead'
                from scipy.optimize.minimize.
            display: bool, default=False
                SLOWLY shows the progress of the fit.
            **keywords: dict, optional
                passed to scipy.optimize.minimize
        '''

        self._method = 'correlation ' + method

        img = np.asarray(self._mask.copy(), dtype=int)
        regions = measure.regionprops(img)
        bubble = regions[0]

        x0, y0 = bubble.centroid
        r = bubble.major_axis_length / 2.
        if display:
            fign = plt.figure()

        self._shape_fitted = 'circle'
        self._initial_guess = (x0, y0, r)

        def _cost_disk(params):
            x0, y0, r = params
            coords = draw.disk((x0, y0), r, shape=img.shape)
            template = np.zeros_like(img)
            template[coords] = 1
            if display:
                self._dispnobl(template + img, fign)
            return -np.sum((template > 0) & (img > 0))

        res = optimize.minimize(_cost_disk, self._initial_guess,
                                method=method, **keywords)
        self._params = res.x
        self._success = res.success
        if res.success is False or (method != 'COBYLA' and res.nit == 0):
            raise Exception("Fit circle didn't converge %s" % res)
Perform a circle fitting on the current mask using minimization 
        algorithm  with correlation merit functions.

        Tested with following minimizations methods: 'Nelder-Mead'. Relative 
        precision of 1% reached on synthetic images without noise.

        Parameters
        ----------
            method: string, default='Nelder-Mead'
                from scipy.optimize.minimize.
            display: bool, default=False
                SLOWLY shows the progress of the fit.
            **keywords: dict, optional
                passed to scipy.optimize.minimize
        
Perform a circle fitting on the current mask using minimization
algorithm  with correlation merit functions.

Tested with following minimizations methods: 'Nelder-Mead'. Relative
precision of 1% reached on synthetic images without noise.

Parameters


Perform a circle fitting on the current mask using minimization algorithm with correlation merit functions . Tested with following minimizations methods : ' Nelder - Mead ' . Relative precision of 1% reached on synthetic images without noise . Parameters
def fit_circle_correlation(self,
                               method='Nelder-Mead',
                               display=False,
                               **keywords):
        self._method = 'correlation ' + method
        img = np.asarray(self._mask.copy(), dtype=int)
        regions = measure.regionprops(img)
        bubble = regions[0]
        x0, y0 = bubble.centroid
        r = bubble.major_axis_length / 2.
        if display:
            fign = plt.figure()
        self._shape_fitted = 'circle'
        self._initial_guess = (x0, y0, r)
        def _cost_disk(params):
            x0, y0, r = params
            coords = draw.disk((x0, y0), r, shape=img.shape)
            template = np.zeros_like(img)
            template[coords] = 1
            if display:
                self._dispnobl(template + img, fign)
            return -np.sum((template > 0) & (img > 0))
        res = optimize.minimize(_cost_disk, self._initial_guess,
                                method=method, **keywords)
        self._params = res.x
        self._success = res.success
        if res.success is False or (method != 'COBYLA' and res.nit == 0):
            raise Exception("Fit circle didn't converge %s" % res)
def fit_circle_correlation ( self , method = 'Nelder-Mead' , display = False , ** keywords ) : self . _method = 'correlation ' + method img = np . asarray ( self . _mask . copy ( ) , dtype = int ) regions = measure . regionprops ( img ) bubble = regions [ 0 ] x0 , y0 = bubble . centroid r = bubble . major_axis_length / 2. if display : fign = plt . figure ( ) self . _shape_fitted = 'circle' self . _initial_guess = ( x0 , y0 , r ) def _cost_disk ( params ) : x0 , y0 , r = params coords = draw . disk ( ( x0 , y0 ) , r , shape = img . shape ) template = np . zeros_like ( img ) template [ coords ] = 1 if display : self . _dispnobl ( template + img , fign ) return - np . sum ( ( template > 0 ) & ( img > 0 ) ) res = optimize . minimize ( _cost_disk , self . _initial_guess , method = method , ** keywords ) self . _params = res . x self . _success = res . success if res . success is False or ( method != 'COBYLA' and res . nit == 0 ) : raise Exception ( "Fit circle didn't converge %s" % res )
Perform a circle fitting on the current mask using minimization
algorithm  with correlation merit functions.
Perform a circle fitting on the current mask using minimization algorithm with correlation merit functions .
'''Perform a circle fitting on the current mask using minimization 
        algorithm  with correlation merit functions.

        Tested with following minimizations methods: 'Nelder-Mead'. Relative 
        precision of 1% reached on synthetic images without noise.

        Parameters
        ----------
            method: string, default='Nelder-Mead'
                from scipy.optimize.minimize.
            display: bool, default=False
                SLOWLY shows the progress of the fit.
            **keywords: dict, optional
                passed to scipy.optimize.minimize
        '''
self
method
display