def fit_image(self, sma0=None, minsma=0., maxsma=None, step=0.1,
                  conver=DEFAULT_CONVERGENCE, minit=DEFAULT_MINIT,
                  maxit=DEFAULT_MAXIT, fflag=DEFAULT_FFLAG,
                  maxgerr=DEFAULT_MAXGERR, sclip=3., nclip=0,
                  integrmode=BILINEAR, linear=False, maxrit=None):
        isophote_list = []
        if not sma0:
            if self._geometry:
                sma = self._geometry.sma
            else:
                sma = 10.
        else:
            sma = sma0
        noiter = False
        first_isophote = True
        while True:
            minit_a = 2 * minit if first_isophote else minit
            first_isophote = False
            isophote = self.fit_isophote(sma, step, conver, minit_a, maxit,
                                         fflag, maxgerr, sclip, nclip,
                                         integrmode, linear, maxrit,
                                         noniterate=noiter,
                                         isophote_list=isophote_list)
            if (isophote.stop_code < 0 or isophote.stop_code == 1):
                if len(isophote_list) == 1:
                    warnings.warn('No meaningful fit was possible.',
                                  AstropyUserWarning)
                    return IsophoteList([])
                self._fix_last_isophote(isophote_list, -1)
                isophote = isophote_list[-1]
                if len(isophote_list) > 2:
                    if ((isophote.stop_code == 5 and
                         isophote_list[-2].stop_code == 5)
                            or isophote.stop_code == 1):
                        if maxsma and maxsma > isophote.sma:
                            noiter = True
                        else:
                            break
            isophote = isophote_list[-1]
            sma = isophote.sample.geometry.update_sma(step)
            if maxsma and sma >= maxsma:
                break
        first_isophote = isophote_list[0]
        sma, step = first_isophote.sample.geometry.reset_sma(step)
        while True:
            isophote = self.fit_isophote(sma, step, conver, minit, maxit,
                                         fflag, maxgerr, sclip, nclip,
                                         integrmode, linear, maxrit,
                                         going_inwards=True,
                                         isophote_list=isophote_list)
            if isophote.stop_code < 0:
                self._fix_last_isophote(isophote_list, 0)
            isophote = isophote_list[-1]
            sma = isophote.sample.geometry.update_sma(step)
            if sma <= max(minsma, 0.5):
                break
        if minsma == 0.0:
            isophote = self.fit_isophote(0.0, isophote_list=isophote_list)
        isophote_list.sort()
        return IsophoteList(isophote_list)