From d21e4d951b05db9e5d7e930c505d81c77772d5cf Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 22 Mar 2016 14:30:48 +0100 Subject: scripts/detector-shift: Show a 'heat map' histogram of detector offset --- scripts/detector-shift | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'scripts/detector-shift') diff --git a/scripts/detector-shift b/scripts/detector-shift index 223ba5b2..a348e3c9 100755 --- a/scripts/detector-shift +++ b/scripts/detector-shift @@ -8,11 +8,13 @@ # # Author: # 2015-2016 Thomas White +# 2016 Marmoru Suzuki # import sys import os import re +import numpy as np import matplotlib.pyplot as plt f = open(sys.argv[1], 'r') @@ -118,12 +120,25 @@ if have_geom: g.close() h.close() -plt.plot(x_shifts, y_shifts, 'rx') -plt.plot(0, 0, 'bo') -plt.axis([-2,2,-2,2]) +nbins = 200 +H, xedges, yedges = np.histogram2d(x_shifts,y_shifts,bins=nbins) +H = np.rot90(H) +H = np.flipud(H) +Hmasked = np.ma.masked_where(H==0,H) + +# Plot 2D histogram using pcolor +fig2 = plt.figure() +plt.pcolormesh(xedges,yedges,Hmasked) plt.title('Detector shifts according to prediction refinement') plt.xlabel('x shift / mm') plt.ylabel('y shift / mm') +circle1 = plt.Circle((mean_x,mean_y),.1,color='r',fill=False) +fig = plt.gcf() +fig.gca().add_artist(circle1) +cbar = plt.colorbar() +cbar.ax.set_ylabel('Counts') +plt.plot(0, 0, 'bH', color='c') +plt.plot(mean_x, mean_y, 'b8', color='m') plt.grid(True) plt.show() -- cgit v1.2.3