-
Notifications
You must be signed in to change notification settings - Fork 0
/
test2D.py
70 lines (46 loc) · 1.38 KB
/
test2D.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 04 09:54:08 2014
@author: Alexandre DAREAU
"""
import matplotlib.pyplot as plt
import inspect
import os
import numpy as np
import pickle
import pyfit as pf
path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
print(path)
name = u'185214 Nom de sequence TOF = 3_Final_frac = -3.5_lumenerb.jpg'
#fit = pf.PyDoubleFit2D()
#fit.fit = pf.fit2D_dic['GaussTF']
fit = pf.PyFit2D()
fit.fit = pf.fit2D_dic['Gauss']
fit.camera = pf.cam_collection.lumenera.gen()
fit.fit.options.do_binning=True
fit.fit.options.auto_binning = True
fit.fit.options.binning = 5
fit.fit.options.askROI = False
fit.fit.options.askHole = False
fit.picture.filename = name
fit.picture.path = path
#fit.picture.ROI = (286.00403225806451, 626.38911290322574, 153.07258064516134, 339.88508064516128)
#fit.hole = (424.0645161290322, 496.53024193548384, 250.12500000000006, 274.27217741935482)
fit.load_data()
fit.do_fit()
fit.save_fit()
savename = name[0:len(name)-4]+'.fit'
file_save = os.path.join(path,'saved_fits',savename)
f = open(file_save,'rb')
fit = pickle.load(f)
fit.print_values()
plt.figure('pyfit test')
plt.clf()
xm = fit.xm_fit
ym = fit.ym_fit
d = fit.data_fit
p = fit.fit.results
fit_res = fit.fit.formula((xm,ym),*p)
plt.imshow(d,extent=(xm.min(), xm.max(), ym.max(), ym.min()))
plt.contour(xm,ym,fit_res,8,colors='w')
plt.show()