|
[yoda-svn] r600 - in trunk: . pyext pyext/yoda pyext/yoda/includeblackhole at projects.hepforge.org blackhole at projects.hepforge.orgFri May 17 00:58:02 BST 2013
Author: buckley Date: Fri May 17 00:58:02 2013 New Revision: 600 Log: Mapping HistoBin1D.relErr in Python. Modified: trunk/ChangeLog trunk/pyext/setup.py.in trunk/pyext/yoda/declarations.pxd trunk/pyext/yoda/include/HistoBin1D.pyx Modified: trunk/ChangeLog ============================================================================== --- trunk/ChangeLog Fri May 17 00:57:05 2013 (r599) +++ trunk/ChangeLog Fri May 17 00:58:02 2013 (r600) @@ -1,5 +1,7 @@ 2013-05-17 Andy Buckley <andy.buckley at cern.ch> + * Mapping HistoBin1D.relErr in Python. + * Adding a non-const points() accessor to Scatter2D. 2013-05-13 Andy Buckley <andy.buckley at cern.ch> Modified: trunk/pyext/setup.py.in ============================================================================== --- trunk/pyext/setup.py.in Fri May 17 00:57:05 2013 (r599) +++ trunk/pyext/setup.py.in Fri May 17 00:58:02 2013 (r600) @@ -4,7 +4,6 @@ from distutils.extension import Extension from Cython.Distutils import build_ext from glob import glob -from template import make_templates PKGNAME = 'yoda' @@ -13,10 +12,9 @@ incdir = os.path.abspath('@top_srcdir@/include') srcdir = os.path.abspath('@top_srcdir@/src') libdir = os.path.abspath("@top_builddir@/src/.libs") - statics = os.path.join('yoda', 'errors.cpp') -# A helper function (since we have two modules now...) +## A helper function (since we have two modules now...) def ext(name, depends=[], statics=[]): return Extension( '%s.%s' % (PKGNAME, name), @@ -29,19 +27,18 @@ extra_link_args = ["-L at prefix@/lib"], libraries=['stdc++', 'YODA']) - -# Make the templates +## Make instantiations of Cython mapping templates for axes with different DBN types +from template import make_templates make_templates('Axis1D_BIN1D_DBN', dict(DBN='Dbn2D', BIN1D='ProfileBin1D'), dict(DBN='Dbn1D', BIN1D='HistoBin1D')) - make_templates('Axis2D_BIN2D_DBN', dict(DBN='Dbn3D', BIN2D='ProfileBin2D'), dict(DBN='Dbn2D', BIN2D='HistoBin2D')) - make_templates('Bin1D_DBN', DBN=('Dbn1D', 'Dbn2D')) make_templates('Bin2D_DBN', DBN=('Dbn2D', 'Dbn3D')) + header_files = glob('../include/YODA/*.h') + glob('../include/YODA/Utils/*.h') extns = [ext('util'), Modified: trunk/pyext/yoda/declarations.pxd ============================================================================== --- trunk/pyext/yoda/declarations.pxd Fri May 17 00:57:05 2013 (r599) +++ trunk/pyext/yoda/declarations.pxd Fri May 17 00:58:02 2013 (r600) @@ -419,6 +419,7 @@ double height() except +err double areaErr() except +err double heightErr() except +err + double relErr() except +err HistoBin1D operator+(HistoBin1D) except +err HistoBin1D operator-(HistoBin1D) except +err Modified: trunk/pyext/yoda/include/HistoBin1D.pyx ============================================================================== --- trunk/pyext/yoda/include/HistoBin1D.pyx Fri May 17 00:57:05 2013 (r599) +++ trunk/pyext/yoda/include/HistoBin1D.pyx Fri May 17 00:58:02 2013 (r600) @@ -3,10 +3,12 @@ cdef inline c.HistoBin1D *_HistoBin1D(self) except NULL: return <c.HistoBin1D *> self.ptr() + def __init__(self, double a, double b): util.set_owned_ptr( self, new c.HistoBin1D(a, b)) - + + def fill(self, value=None, double weight=1.0): """ (value=None, weight=1.0) @@ -19,6 +21,7 @@ except TypeError: self._HistoBin1D().fillBin(weight) + @property def area(self): """ @@ -30,6 +33,7 @@ """ return self._HistoBin1D().area() + @property def height(self): """ @@ -41,6 +45,7 @@ """ return self._HistoBin1D().height() + @property def areaErr(self): """ @@ -50,6 +55,7 @@ """ return self._HistoBin1D().areaErr() + @property def heightErr(self): """ @@ -59,17 +65,27 @@ """ return self._HistoBin1D().heightErr() + + @property + def relErr(self): + """ + Relative error - same for either area or height interpretations. + + """ + return self._HistoBin1D().relErr() + + def __add__(HistoBin1D a, HistoBin1D b): return util.new_owned_cls( HistoBin1D, new c.HistoBin1D( - deref(a._HistoBin1D()) + + deref(a._HistoBin1D()) + deref(b._HistoBin1D()))) + def __sub__(HistoBin1D a, HistoBin1D b): return util.new_owned_cls( HistoBin1D, new c.HistoBin1D( deref(a._HistoBin1D()) - deref(b._HistoBin1D()))) -
More information about the yoda-svn mailing list |