def fit_lorentizan(curve,p0=None,N_points=1000):
	'''Fits a lorentzian curve using p0=[x0,A,gamma] as an initial guess.
	It returns a curve with N_points.'''
	def lorentzian(x,x0,A,gamma): return A*gamma**2/((x-x0)**2+gamma**2)
	N=len(curve)
	x=[curve[i][0] for i in range(N)]
	y=[curve[i][1] for i in range(N)]

	from scipy.optimize import curve_fit
	popt,pcov = curve_fit(lorentzian,x,y,p0=p0)
	x0=popt[0]; A=popt[1]; gamma=popt[2]

	a=x[0]; b=x[-1]
	x_step=(b-a)/(N_points-1)
	x_fit=[a+i*x_step for i in range(N_points)]
	fited_curve=[(xi,lorentzian(xi,x0,A,gamma)) for xi in x_fit]
	return fited_curve,A,x0,gamma