Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #54 from kreczko/cleaning
Browse files Browse the repository at this point in the history
Minor fixes: spelling + unused imports/variables
  • Loading branch information
HDembinski committed Nov 8, 2018
2 parents a11401f + 8f5be26 commit fa5a91b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 25 deletions.
2 changes: 1 addition & 1 deletion doc/pyplots/costfunc/blh.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#Unextended

blh = BinnedLH(gaussian, data)
#if you wonder what it loos like call desceibe(blh)
#if you wonder what it looks like call describe(blh)
m = Minuit(blh, mean=0., sigma=0.5)

plt.figure(figsize=(8, 6))
Expand Down
1 change: 0 additions & 1 deletion doc/pyplots/pdf/histogrampdf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from iminuit import Minuit
from probfit import BinnedLH, Extended, AddPdf, gen_toy
from probfit.pdf import HistogramPdf
from probfit.plotting import draw_pdf
import numpy as np

bound = (0, 10)
Expand Down
26 changes: 6 additions & 20 deletions probfit/plotting.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Plotting is on python since this will make it much easier to debug and adjsut
# Plotting is on python since this will make it much easier to debug and adjust
# no need to recompile everytime i change graph color....
# needs a serious refactor
from math import sqrt, ceil, floor
Expand Down Expand Up @@ -57,7 +57,7 @@ def _get_args_and_errors(self, minuit=None, args=None, errors=None):

def _param_text(parameters, arg, error):
txt = u''
for i, (k, v) in enumerate(zip(parameters, arg)):
for (k, v) in zip(parameters, arg):
txt += u'%s = %5.4g' % (k, v)
if error is not None:
txt += u'±%5.4g' % error[k]
Expand All @@ -73,10 +73,7 @@ def draw_ulh(self, minuit=None, bins=100, ax=None, bound=None,
args=None, errors=None, parts=False, show_errbars='normal',
no_plot=False):
from matplotlib import pyplot as plt

data_ret = None
error_ret = None
total_ret = None
part_ret = []

ax = plt.gca() if ax is None and not no_plot else ax
Expand All @@ -89,7 +86,7 @@ def draw_ulh(self, minuit=None, bins=100, ax=None, bound=None,

if not show_errbars:
if not no_plot:
pp = ax.hist(mid(e), bins=e, weights=n, histtype='step')
ax.hist(mid(e), bins=e, weights=n, histtype='step')
error_ret = (np.sqrt(n), np.sqrt(n))
else:
w2 = None
Expand Down Expand Up @@ -244,10 +241,7 @@ def draw_residual_ulh(self, minuit=None, bins=100, ax=None, bound=None,
def draw_x2(self, minuit=None, ax=None, parmloc=(0.05, 0.95), print_par=True,
args=None, errors=None, grid=True, parts=False, no_plot=False):
from matplotlib import pyplot as plt

data_ret = None
error_ret = None
total_ret = None
part_ret = []

ax = plt.gca() if ax is None and not no_plot else ax
Expand All @@ -261,10 +255,10 @@ def draw_x2(self, minuit=None, ax=None, parmloc=(0.05, 0.95), print_par=True,
data_ret = x, y
if data_err is None:
if not no_plot: ax.plot(x, y, '+')
err_ret = (np.ones(len(self.x)), np.ones(len(self.x)))
error_ret = (np.ones(len(self.x)), np.ones(len(self.x)))
else:
if not no_plot: ax.errorbar(x, y, data_err, fmt='.', zorder=0)
err_ret = (data_err, data_err)
error_ret = (data_err, data_err)
draw_arg = [('lw', 2), ('zorder', 2)]
draw_arg.append(('color', 'r'))

Expand Down Expand Up @@ -301,7 +295,7 @@ def draw_x2_residual(self, minuit=None, ax=None, args=None, errors=None, grid=Tr

ax = plt.gca() if ax is None else ax

arg, error = _get_args_and_errors(self, minuit, args, errors)
arg, _ = _get_args_and_errors(self, minuit, args, errors)

x = self.x
y = self.y
Expand Down Expand Up @@ -330,10 +324,6 @@ def draw_bx2(self, minuit=None, parmloc=(0.05, 0.95), nfbins=500, ax=None,
print_par=True, args=None, errors=None, parts=False, grid=True,
no_plot=False):
from matplotlib import pyplot as plt

data_ret = None
error_ret = None
total_ret = None
part_ret = []

ax = plt.gca() if ax is None and not no_plot else ax
Expand Down Expand Up @@ -392,10 +382,6 @@ def draw_blh(self, minuit=None, parmloc=(0.05, 0.95),
nfbins=1000, ax=None, print_par=True, grid=True,
args=None, errors=None, parts=False, no_plot=False):
from matplotlib import pyplot as plt

data_ret = None
error_ret = None
total_ret = None
part_ret = []

ax = plt.gca() if ax is None and not no_plot else ax
Expand Down
2 changes: 0 additions & 2 deletions probfit/statutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ def fwhm_f(f, range, arg=None, bins=1000):
ymax = y[imax]
rs = y[imax:] - ymax / 2.0
ls = y[:imax] - ymax / 2.0
xl = 0
xr = 0

il = first_neg(ls, 'l')
# print il,x[il],ls[il],x[il+1],ls[il+1]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def test_merge_func_code_factor_list():


def test_merge_func_code_skip_prefix():
funccode, pos = merge_func_code(
funccode, _ = merge_func_code(
f, f2,
prefix=['f_', 'g_'],
skip_first=True,
Expand Down

0 comments on commit fa5a91b

Please sign in to comment.