Model evaluationΒΆ

In [1]:
from __future__ import print_function, division
from PyAstronomy import funcFit2 as fuf2
import numpy as np
import matplotlib.pylab as plt

# Create a a model object representing a Gaussian
gf = fuf2.GaussFit()

# Parameters can be accessed using the square bracket
# notation
gf["A"] = 10.0
gf["sig"] = 15.77
gf["off"] = 1.0
gf["mu"] = 7.5

x = np.linspace(gf["mu"]-5*gf["sig"], gf["mu"]+5*gf["sig"], 150)
y = gf.evaluate(x)

gf["A"] = 7.5
y2 = gf.evaluate(x)

plt.plot(x, y, 'b.-', label="A=10")
plt.plot(x, y2, 'r.-', label="A=7.5")
plt.legend()
plt.show()
../_images/funcFit2Doc_ex_model_evaluation_1_0.png
In [2]: