Skip to content

Commit

Permalink
Made sure arrays are float
Browse files Browse the repository at this point in the history
  • Loading branch information
paulray committed Feb 15, 2019
1 parent 85018a1 commit 5ae459c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/fitharms.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def compute_phist(phases,nbins=200):
if args.white:
# Random phases uniform over [0,1)
ph = np.random.random_sample(len(en))
log.info("Replaces with {0} random phases".format(len(en)))
log.info("Replaced with {0} random phases".format(len(en)))


matplotlib.rcParams['font.family'] = "serif"
Expand Down Expand Up @@ -249,10 +249,12 @@ def compute_phist(phases,nbins=200):
colorbins = 32
softbins, softn = compute_phist(ph[softidx],nbins=colorbins)
hardbins, hardn = compute_phist(ph[hardidx],nbins=colorbins)
softn = np.asarray(softn,dtype=np.float)
hardn = np.asarray(hardn,dtype=np.float)
fig,ax = plt.subplots()
color = np.asarray(hardn,dtype=np.float)/softn
color = hardn/softn
# Propagate Poisson errors to get error in ratio
cerr = color*np.sqrt(1/softn + 1/hardn)
cerr = color*np.sqrt(1.0/softn + 1.0/hardn)
#ax.step(np.concatenate((softbins,np.ones(1))),np.concatenate((color,color[-1:])),color='C0',where='post')
ax.errorbar(softbins+0.5*softbins[1],color,yerr=cerr,color='k',fmt='.')
ax.set_xlim(0.0,1.0)
Expand Down

0 comments on commit 5ae459c

Please sign in to comment.