from ColdTOFU.fits import *
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('seaborn')
%matplotlib inline
x = np.linspace(0, 10, 100) # x variable
params = [1, 5, 1, 0] #[amp, x_0, sigma_x, offset]
noise = np.random.randn(len(x))*np.sqrt(0.05) # random noise with mean=0 and sigma=0.05
data = gaussian(x, *params) + noise
fitParams = gaussianFit(x, data, p0=[1,4,3,1])
pixels = np.linspace(0, 100, 100)
X = np.meshgrid(pixels, pixels)
params = [1, 30, 40, 10, 5, np.pi/4, 0] #[amp, x_0, y_0, sigma_1, sigma_2, theta, offset]
noise = np.random.randn(len(X[0])**2)*np.sqrt(0.05)
image = (gaussian2D(X, *params) + noise).reshape((len(X[0]), len(X[0][0])))
fitParams = gaussian2DFit(image, p0=[1, 40, 40, 10, 10, 0.6, 0])
fitParams[0]
array([ 1.00888267e+00, 2.95515381e+01, 3.99994921e+01, 4.94761937e+00, 9.62408744e+00, -1.98829282e+06, -3.86989749e-04])
x = np.linspace(0, 10, 100) # x variable
params = [1, 5, 1, 0] #[amp, x_0, gamma, offset]
noise = np.random.randn(len(x))*np.sqrt(0.05) # random noise with mean=0 and sigma=0.05
data = lorentzian(x, *params) + noise
fitParams = lorentzianFit(x, data, p0=[1,4,3,1])