import myFitter as mf import matplotlib.pyplot as plt import scipy.stats as stats import sys import numpy as np import random # Import our example model. from mymodel import MyModel # Set random seed to get reproducable results random.seed(1234) np.random.seed(1234) # To find the global minimum of the chi-square function we first randomly # sample the model's parameter space. The points with the smallest chi-square # values are then used for local (gradient search) minimisations. # Create an instance of MyModel. model = MyModel() # Create a Fitter object to fit the model. fitter = mf.Fitter(model) # Sample 100 points. fitter.sample(100) # Try 5 minimisations to (hopefully) find the global minimum. globalmin = fitter.fit(tries=5) print globalmin