From 1bfbc9f51eaf5a397ab8de4780ff23de4c83e85e Mon Sep 17 00:00:00 2001 From: Marco Cammarata Date: Fri, 25 Nov 2016 18:05:50 +0100 Subject: [PATCH] fixed a BAD bug that was setting to zero everything that was < 5% of the max in the images (i.e. the profile was calculated based on the internal copy used for fit instead of the original image) --- alignment.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/alignment.py b/alignment.py index 88c85d3..d1e6d3e 100644 --- a/alignment.py +++ b/alignment.py @@ -81,7 +81,7 @@ fit_ret = collections.namedtuple("fit_ret",["init_pars","final_pars",\ "final_transform1","final_transform2","im1","im2","E","p1","p1_sum","p2","p2_sum","fom","ratio","tneeded"] ) def calcFOM(p1,p2,ratio): - idx = ( p1>p1.max()/10 ) & (p2>p2.max()/10) + idx = ( p1>p1.max()/10 )# & (p2>p2.max()/10) ratio = ratio[idx] return ratio.std()/ratio.mean() @@ -142,13 +142,13 @@ def plotShot(im1,im2,transf1=None,transf2=None,fig=None,ax=None,res=None,E=defau if res is None: p1 = np.nansum(im1,axis=0) p2 = np.nansum(im2,axis=0) - pr = p1/p2 + pr = p2/p1 else: p1 = res.p1; p2 = res.p2; pr = res.ratio ax[3].plot(E,p1,lw=3) ax[4].plot(E,p1,lw=1) ax[4].plot(E,p2,lw=3) - idx = (p1>p1.max()/10.) & (p2>p2.max()/10) + idx = (p1>p1.max()/10.) ax[5].plot(E[idx],pr[idx]) if res is not None: ax[5].set_title("FOM: %.2f"%res.fom) @@ -427,6 +427,9 @@ def transformIminuit(im1,im2,init_transform=dict(),show=False,verbose=True,zeroT final_params = imin.fitarg.copy() t1,t2 = transforms(*imin.args) i1,i2 = model(*imin.args) + + i1 = t1.transformImage(im1) + i2 = t2.transformImage(im2) if show: plotShot(i1,i2) fig = plt.gcf()