code: def _optimize(self, period, tmpid, use_gradient=True):
          
          theta_0 = [self.y.min(), self.y.max() - self.y.min(), 0]
          result = minimize(self._chi2, theta_0, jac=bool(use_gradient),
                            bounds=[(None, None), (0, None), (None, None)],
                            args=(period, tmpid, use_gradient))
          return result.x
docs: Optimize the model for the given period & template