MAINT: optimize: use OptimizeWarning in curve_fit