diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,1984 +1,1987 @@ 2019-11-01 Andy Buckley + * Add extra optional bool arguments to the mkScatter converter + functions for Histo1D and Histo2D types. + * Force rebuild of the Python interface if a sufficient Cython is found, even if the generated .cpp file is present at configure-time. 2019-09-05 Andy Buckley * Final conversion to use ast module not just in autotype but as first choice in AO.annotation. 2019-08-20 Andy Buckley * Remove ALL uses of @property in the Python interfaces: all methods must have call-parentheses now. 2019-07-30 Andy Buckley * Improve Python annotation parsing to preferentially use ast rather than yaml. 2019-06-21 Andy Buckley * Add x/yErrs and x/yErrAvgs functions to Scatter2D Python. 2019-06-018 Louie Corpe * Release 1.7.7 * Fix printing of YAML annotations. * Fix Python 3 / Unicode compatibility for Point.pyx. 2019-06-07 Andy Buckley * Release 1.7.6 2019-06-06 Andy Buckley * Add xEdges and yEdges methods to the 2D Histo and Profile classes, in C++ and Python. * Remove @property attributes from Python xEdges methods. More of that to come in version 1.8.0. 2019-05-26 Andy Buckley * Fix Python3/argparse attribute access bug in yodamerge. 2019-05-09 Andy Buckley * Release 1.7.5 2019-05-06 Andy Buckley * Convert bin/* scripts to use Python3-compatible argparse rather than old optparse. 2019-05-02 Christian Gutschow * Fix Histo1D::integralRange to include the second-argument bin content as described in the docstring. 2019-04-29 Andy Buckley * Fix Python3 StringIO import compatibility -- thanks to Tom Neep for the patch! 2019-03-05 Andy Buckley * Add -m/-M filtering to yodadiff. 2019-02-27 Andy Buckley * Fix HistoBin2D printing in Python interface. 2019-02-17 Jon Butterworth * Protect yodamerge against zero-valued (?!) ScaledBy attributes. 2018-12-10 Andy Buckley * Release 1.7.4 2018-11-16 Christian Gutschow * Roll out sameBinning methods for Profile1D and Profile2D. 2018-11-08 Christian Gutschow * Add sameBinning methods for Histo1D and Histo2D. 2018-11-08 Andy Buckley * Remove debug couts from single-AO Writer::write() function. * Add --ignore-missing and --ignore-new flags to yodadiff. * Tidy up point-comparison output of yodadiff. 2018-10-13 Christian Gutschow * Fix additional weighting in yodamerge 2018-09-24 Andy Buckley * Release 1.7.3 2018-09-12 Louie Corpe * Fix bug in multi-err point reader which was not parsing Variations correctly, and a minor typo where the err- was duplicated for the additional columns. 2018-09-06 Andy Buckley * Fix missing y and z components of Point2D and Point3D equality testing. 2018-09-04 Andy Buckley * Add array accessors of x,y,zMins/Mids/Maxs/Vals/Errs, etc. to Python Histo2D and Profile2D. 2018-08-30 Andy Buckley * Update embedded yaml-cpp to v0.6.0. * Convert xyzMin/Max properties to functions in the Python interfaces. * Return numpy arrays if possible in Python interface array methods. 2018-08-23 Andy Buckley * Release 1.7.2 * Add missing bin(i) method to Python Profile1D interface. 2018-08-22 Andy Buckley * Avoid const-overloading clash for binAt functions. 2018-08-14 Chris Gutschow * Merge Graeme Watt's modifications to yodadiff. 2018-08-14 Andy Buckley * Release 1.7.1 2018-08-08 Andy Buckley * yodadiff now supports quiet (-q) and list (-l) modes. 2018-06-01 Louie Corpe * Point1,2,3D now support multiple error sources for the highest dimension. * Scatter1,2,3D now read in/out with additional columns for the extra error sources, with a variations() method to check with sources are available 2018-05-02 Andy Buckley * StringUtils.h: Replace std::ptr_fun (removed in C++17) with a lambda function. Thanks to Stefan Richter. 2018-04-30 Andy Buckley * Add "-" = stdin/stdout recognition to C++ IO functions. * Convert remaining Python read/write methods to use the C++ IO functions. * Convert Python read/write methods with filename arguments to use the gzip-aware IO functions. 2018-04-27 Andy Buckley * Fix missing lock=false flag initialisation in Histo2D constructor from a Bins vector. * Improve axis locking error messages. 2017-12-21 Andy Buckley * Version 1.7.0 release 2017-12-11 Andy Buckley * Add Nentries printout to yodals -v 2017-09-18 Andy Buckley * Patches for ROOT conversion from Robert Hatcher -- thanks! 2017-09-16 Andy Buckley * Add YODA format version annotation, at version 2, and update YODA reader to use version info and multiline YAML EOF marker. * Write YODA annotations in YAML with a --- YAML break-line. 2017-09-14 Andy Buckley * Enable compressed writing from Python. 2017-09-13 Andy Buckley * Remove UNUSED macro in favour of anonymous args. * Enable zipped writing... but only works from C++ so far. 2017-09-11 Andy Buckley * Add HistoBin2D::area(), and provide a default normto=1.0 argument on the Python Histo2D.normalize() method. 2017-09-04 Andy Buckley * Change license explicitly to GPLv3, cf. MCnet3 agreement. * Parse YODA format AO headers as YAML (restriction to single-line dict entries for now). 2017-08-24 Andy Buckley * Use a slightly enhanced fast numeric parser in ReaderYODA (taken from LHAPDF, originally inspired by Gavin Salam). * Add an UNSCALE spec option to yodascale, to undo ScaledBy effects. 2017-08-19 Andy Buckley * Add optional zlib support via zstr -- massive thanks to Dmitry Kalinkin for the lovely patch! 2017-08-16 Andy Buckley * Fix setVal(i, x) numbered-axis methods on Point2D and Point3D: switch break statements were missing. * Explicitly load all ROOT objects as a list rather than generator. Patch from Dmitry Kalinkin. 2017-07-24 Andy Buckley * Improvements to yodaplot, including two operating modes: the default CMP mode is suitable for plotting histos by path, from raw .yoda files. * Update yoda.plotting functions to treat plot-keys as args and AO annotations via case-insensitive keys. * Add annotationsDict to the Python AO interface. * Add AO as an alias for AnalysisObject. 2017-07-23 Andy Buckley * Add parallel/compatibility yoda1 package to aid eventual transition to YODA v2. 2017-07-22 Andy Buckley * Add x,y,zMins and Maxs to all 1D data types and scatters (and x,yMin/Max to the scatters) -- Python interface only. * Rework some of the yoda.plotting tools, making it a bit more compatible with user-scripted matplotlib. 2017-07-18 Andy Buckley * Add convenience aliases H1D, H2D, P1D, P2D, and S1D, S2D, S3D for the HistoXD, ProfileXD, and ScatterXD classes respectively. 2017-07-08 Andy Buckley * Add xyVals/Errs and other 'bin array property' accessors to the Python Histo1D and Profile1D types: important for connection to matplotlib. 2017-06-28 Andy Buckley * Use Python natsort library to sort yodals output if available. 2017-06-18 Andy Buckley * Version 1.6.7 release. 2017-05-12 Andy Buckley * pyext/yoda/rootcompat.pyx: Fix ordering of TH1 vs. TProfile conversion -- TProfile *is* a TH1, so we have to test for the more specific type-match first. Thanks to Dmitry Kalinkin for the patch. 2017-05-02 Andy Buckley * Add static Reader methods to match the Writer ones. 2017-02-23 Andy Buckley * Fix Histo2D and Profile2D total distribution reading from YODA format. 2017-02-19 Holger Schulz * Convert TH1F to TH1D in root2flat. Much simpler than duplicating the TH1D stuff in pyext. 2016-12-13 Andy Buckley * Version 1.6.6 release. 2016-12-12 Holger Schulz * Bugfixes in Cython bins accessors for Histo2D. 2016-11-17 Leif Lonnblad * Fixed warning messages about the obsoleteness of AIDA so that the scripts actually still work. 2016-09-28 Andy Buckley * Version 1.6.5 release, for the benefit of ROOT fans. * Fix handling of --enable/disable-root configure options. 2016-09-26 David Grellscheid * Improvements to Cython version testing. 2016-09-25 Andy Buckley * Version 1.6.4 release. 2016-09-20 David Grellscheid * Remove aliases for @property functions. They were scheduled for removal anyway, and don't work with Cython >= 24. 2016-09-06 Andy Buckley * Update configure scripts to use newer (Py3-safe) Python testing macros. 2016-08-09 Andy Buckley * Version 1.6.3 release! 2016-07-22 Andy Buckley * Add 'add' modes for scatter combination to yodamerge. * Fix yodamerge scatter averaging to use the first AO. 2016-07-21 Andy Buckley * Add --type-mismatch-mode flag and fallback logic to yodamerge. * Fix yodamerge logic to handle cases where an AO only appears once. 2016-07-19 Andy Buckley * Deprecate flat2yoda script and add warning output to it and the AIDA conversion scripts. * Add a convenience yoda2yoda script. 2016-07-14 Andy Buckley * Try to build PyROOT interface by default, if root-config is found. 2016-07-11 Andy Buckley * Remove accidentally remaining reference to Boost flags in yoda-config. 2016-07-06 Andy Buckley * Version 1.6.2 release! 2016-07-05 Andy Buckley * Pass the toNewScatter3D() scalebyarea flag to the called toScatter3D() functions. 2016-06-06 Andy Buckley * Re-enable the disabled-for-some-reason Scatter1D combineWith Python mappings. 2016-04-28 Andy Buckley * Version 1.6.1 release! * Add a unit test for annotation handling correctness. * Fix numerical precision of string storage of floating-point attributes. * Fix a bug in use of the replacement for lexical_cast. 2016-04-20 Andy Buckley * Version 1.6.0 release! 2016-04-16 Andy Buckley * Extend SFINAE craziness to allow writing of any object (e.g. smart pointer) that can be dereferenced to something that has AnalysisObject as its base class... and also to any container of them! Amazing what you can do with C++11! 2016-04-14 Andy Buckley * Add a few consts to the arguments in Scatter error setting via pairs. * Fix double-writing of minus errors in WriterYODA for Scatter1D and Scatter3D. Thanks to Graeme Watt for the report and fix. 2016-04-12 Andy Buckley * Remove Boost dependency and require C++11 compilation. 2016-04-08 Andy Buckley * Add a --guess-prefix flag to yoda-config, cf. fastjet-config. 2015-12-20 Andy Buckley * Change AO uncomputable division and mkScatter operations to return/set NaN rather than 0 -- behaviour change requires new major version series 1.6. 2016-03-09 Andy Buckley * Version 1.5.9! (oh no, we're out of convenient version number space!!) 2016-03-08 Andy Buckley * Add abs function to eq calculation in yodadiff. 2016-02-29 Andy Buckley * Remove blocking of builds against ROOT6 -- it works fine. 2016-02-16 Andy Buckley * Add a --add option to yodamerge, for simple histo stacking. Thanks to Chris Gutschow for the patch, although my spidey sense is tingling... 2015-12-21 Andy Buckley * Version 1.5.8! * Add a rebinning unit test, pytest-rebin. * Add optional range arguments to rebinBy methods, allowing block rebinnings to be applied only within a range of (original) bin indices. * Add missing root.py submodule file. Oops! 2015-12-20 Andy Buckley * Convert linspace to use multiplication rather than repeated addition to construct edge values, reducing precision errors. Thanks to Holger Schulz for the suggestion. 2015-12-15 Andy Buckley * Add xEdges() methods to Axis1D and the Histo1D and Profile1D that use it. The returned edge lists are finite only, i.e. they do not contain the +-inf values on the ends of the internal BinSearcher edges. 2015-12-13 Andy Buckley * Version 1.5.7! * Extend batch-adding in ReaderYODA to include Scatter types. * Add a match_aos function to Python, for filtering AO lists/dicts on path patterns and anti-patterns. 2015-12-12 Andy Buckley * Add a flag to yoda2root to change whether the conversion is to 'proper' types or to (more robustly) TGraphAsymmErrors objects. * Fix accidental use of S2D_MODE flag where S1D_MODE should have been used, in yodamerge. Thanks again to Radek Podskubka. * Allow new rebinTo() merging to restrict to a subset of the bin range, merging the outside bins into the overflow distributions. 2015-12-11 Andy Buckley * Add a rebinTo() method on Axis1D, allowing rebinning to a new given set of bin edges. Add an explicitly named rebinBy(), and overloaded rebin() aliases for both, and pass through to Histo1D and Profile1D APIs. Plus other internal tweaks to binning functionality... anticipating/fuelling the fundamental rewrite. 2015-12-10 Andy Buckley * Improve ReaderYODA to use temporary bin containers, to minimise calling sort when adding bins to histos. A quick test suggests this has sped up big file reading by a factor of 30 or so!!! * Add missing addBins() operators (only in C++ so far) to Histo and Profile classes. * Fix Counter::numEntries to return an unsigned long rather than double. Thanks to Radek Podskubka for the bug discovery and detective work. * Improve sortedvector to insert new elements into the sorted position, rather than resorting the whole vector. This should be a bit more efficient, but I think the asymptotic complexity is the same. Might help a bit with reading big data files. 2015-12-04 Andy Buckley * Add yoda.HAS_ROOT_SUPPORT flag, for API user convenience. 2015-11-22 Andy Buckley * Version 1.5.6! * Make AO path setting and retrieval prepend a leading slash if it is missing (unless the path is completely empty). 2015-11-21 Andy Buckley * Add root2yoda conversion script. * Deprecating yoda.to_root() in favour of yoda.root module, which contains to_root and to_yoda functions, as well as a ROOT file walking function. 2015-11-17 Andy Buckley * Map ROOT-to-YODA (as scatter) functions to Python. Phew. * Map new to-ROOT functions, including TGraph ones, to Python. 2015-11-16 Andy Buckley * ROOTCnv.h: Add toScatter3D ROOT->YODA, and toNew* YODA->ROOT conversion routines. * ROOTCnv.h: Fix bug in toTH2D(const Histo2D& h) as used with ROOT6. Thanks to Tim Martin. 2015-11-05 Andy Buckley * Fix double-dealloc in new Point class hierarchy Python mapping. 2015-10-23 Andy Buckley * Make the version() function inline, and the numerical constants static. * Change the default plotting backend to MPL rather than the much slower PGF. 2015-10-09 Andy Buckley * Reinstate __getitem__ special methods for Scatters in Python. * Provide dim() methods/attributes for the Point and Bin base classes. * Rename set*Err to set*Errs for the asymmetric variants. Plural aliases are also provided for the symm case. 2015-10-08 Andy Buckley * Pass std::pairs by reference in Point*D error setting functions. * Add Point base class with generic accessors to Point*D properties via an integer axis ID argument. 2015-10-07 Andy Buckley * Version 1.5.5 release. * Counter.pyx: Typo fix in sumW mapping. * yodamerge: Re-add checking for non-emptiness before merging, in case the empty ones are missing a ScaledBy attribute. Won't normally apply to Profiles, since they don't usually get normalised, but we might as well include them in the vetoing since empty histos don't contribute to the merging. Added a command-line option to disable this heuristic since in very strange situations a null sumW does not mean no fills. 2015-10-06 Andy Buckley * Version 1.5.4 release. * ReaderYODA: Typo fixes in Counter filling of sumW and Scatter3D reader state flag. * yodamerge: add merging heuristics for Scatter1D and Scatter3D (needs unification) 2015-10-05 Andy Buckley * yodamerge: add a fix for empty-in-all-runs histo merging; thanks to Daniel Rauch. 2015-10-04 Andy Buckley * Adding dim() function and corresponding Python attribute to AnalysisObject. * Map Counter arithmetic operations into Python. * Map Counter mkScatter() into Python (as bound method). * Add a YODA::version() function, mapped into Python and used to set the yoda.__version__ variable. 2015-10-01 Andy Buckley * Expose the yoda.plot() Python function in a way that doesn't automatically induce a dependence on matplotlib. 2015-09-30 Andy Buckley * Fix yodals to work with Counters. 2015-09-23 Andy Buckley * Version 1.5.3 release. * Update Boost version requirement to 1.48, due to use of type_traits/has_dereference, and add a check for that feature's header. 2015-09-19 Andy Buckley * Further improvements to handling leading _multiple_ # marks on YODA format BEGIN lines. 2015-09-11 Andy Buckley * Version 1.5.2 release. * Tolerate leading # symbols without separating whitespace on BEGIN lines in YODA format parsing. * Further improvements to handling LowStatsErrors in YODA format writing. * Fix shadowed variables that made ReaderYODA unhappy. 2015-09-03 Andy Buckley * Version 1.5.1 release. * Fix bugs in Python wrapper for Point3D. 2015-08-28 Peter Richardson * Catch LowStatsError when writing multiple histograms so only the histogram with the problem is not written 2015-08-28 Andy Buckley * Version 1.5.0 release. 2015-08-24 Andy Buckley * Improve protection of efficiency calculation against the weird world of general weighted events. 2015-08-17 Andy Buckley * Add some protection against calling matplotlib's legend() method if there are no valid labels to display, to suppress an MPL warning message when using yoda.plot(). 2015-08-12 Andy Buckley * Fix cut & paste typo, and add LowStatsError catching in Profile division. 2015-08-11 Andy Buckley * Replace old Spirit-based ReaderYODA with the new hand-rolled one. * Adding filling of Histo1D, Profile1D, Histo2D and Profile2D in new ReaderYODA. More hacking of Axis and Histo/Profile interfaces... needs clean-up, and infinite binning implementation. 2015-08-07 Andy Buckley * Convert the ReaderFLAT parser to also use a simple hand-written parser rather than Spirit. 2015-08-04 Andy Buckley * Add methods for Counter, Axis and Histo1D internal state access/setting, mainly for new persistency. NEEDS PRE-RELEASE TESTING!!! 2015-07-30 Andy Buckley * Remove # markers from YODA format BEGIN/END output. The parser will continue to accept them. 2015-07-29 Andy Buckley * Add SFINAE trait magic to restrict write(RANGE) functions to accepting iterables. Also generalising to allow either container-of-objects or container-of-pointers args by providing a writeBody(AO*) function to complement writeBody(AO&). Based on a patch from Lukas Heinrich. * Add configuration of output streams to throw exceptions on bad/fail state (based on patch from Lukas Heinrich). 2015-07-01 Andy Buckley * 1.4.0 release. 2015-06-30 Andy Buckley * More tweaks to yodamerge: adding control of S2D merging strategy, and now performing weighted normalized histo merges without reference to an absolute normalization. * Change yodamerge norm-detection heuristic to just look for a ScaledBy attribute rather than fuzzily compare norms. 2015-06-26 Andy Buckley * Removing add, subtract, and divide functions and operators on Scatter types, and re-implementing Histo and Profile divide functions explicitly rather than via mkScatter. Also removed from the Python interface. The combine() methods remain. 2015-06-24 Andy Buckley * Adding workaround versions of binAt to all the Python histo types (for some reason the direct mapping that works for bin(i) produces a compile error for binAt(x) :-/ 2015-06-23 Andy Buckley * Renaming, tidying, completing, etc. the Python-mapped methods on Bin1D and Bin2D. * Rename Python Histo2D mean, variance, etc. pair-returning methods to xyMean, xyVariance, etc., to distinguish from Profile2D mean, variance, etc. * Add Python mappings of all the methods below. * Add full set of {x,y}{Mean,Variance,StdDev,StdErr,RMS} to 1D and 2D binned distributions. * Add optional includeoverflows=True argument to all binned AO numEntries and effNumEntries. * Fix type of numEntries to always be unsigned long. 2015-06-18 Andy Buckley * Fix typos in Point3D Python mapping (accidentally trying to get the ptr via _Point2D rather than _Point3D). 2015-06-13 Andy Buckley * Adding an AnalysisObject::name() method, to return the last part of the path. Mapped into a Python property. * Adding an optional usestddev argument to mkScatter for profile types, so the error bars can represent distribution width rather than uncertainty on the mean. Mapped to Python. 2015-06-08 Andy Buckley * Adding unpatterns arguments to Python read functions, and auto-conversion from single strings and re.compile()d strs. 2015-06-04 Andy Buckley * Add binAt(x,y) and binIndexAt(iglobal) Python methods for 2D histos. Still want a way to get and pass a pair of bin indices, I think. * Adding includeoverflows optional args for Histo1D (eff)numEntries. * Adding Rename Histo1D integral() methods as integral(), integralRange(), and integralTo(), and mapping to Python. 2015-06-02 Andy Buckley * Adding missing binAt and binIndexAt methods to Histo1D and Profile1D, plus other minor Python mapping tweaks. * Add a regex pattern match optional argument to the IO.read() Python functions, for pre-emptive filtering. 2015-03-27 Andy Buckley * Fix a harmless possibility to raise an FPE exception in the BinSearcher. Thanks to Leif Lonnblad for the discovery, debug and patch! 2015-03-19 Andy Buckley * Bump version for 1.3.1 release. 2015-03-06 Andy Buckley * Adding usefocus optional argument to some mkScatter functions, plus the Python bindings. * Cleaning up some Python mappings of 2D histogram bin classes. * Removing mappings of bin-level fill and scale operations in Python. * Fix formatting and error handling in Python Bin and Dbn __repr__ methods. * Add a -i/--in-place option pair on yodascale. 2015-02-05 Andy Buckley * Convert script matching options to use re search rather than match. * Adding matching options and verbose option to yodals. 2015-01-27 Andy Buckley * Improvements and additions to ROOTCnv.h routines, particularly to TProfile creation: thanks to Roman Lysak for advice. 2015-01-16 Andy Buckley * Add convenience YODA/YODA.h header. 2015-01-15 Andy Buckley * yodascale now uses PointMatcher and can normalize or multiply to abs values or ref histos/bin ranges. 2015-01-05 Andy Buckley * Adding yoda.matcher Python sub-package with PointMatcher functionality. To be used in Professor 2.0 and in yodascale. * Adding 'scat2' type to yodahist. * Add match/unmatch args to all conversion scripts, via a new Python yoda.script_helpers function. * Script updates, improved docstrings, and improved tab completion. 2014-12-10 Andy Buckley * Add a yoda.plotting sub-module, based on matplotlib. 2014-12-03 Andy Buckley * Small build improvements: cleaning test1.root from the yoda2root test, and adding a make target & flag file for mktemplates in pyext/yoda to make sure that it only gets run once. 2014-11-25 Andy Buckley * Handle overflow filling in binned types without invoking an exception. * Change inRange to have non-fuzzy comparison behaviour. 2014-11-11 Andy Buckley * Improving/adding __div__ functions in Python for all binned types. * Add std:: prefix to isinf() calls in BinSearcher.h. 2014-09-30 Andy Buckley * 1.3.0 release! * Use numEntries() rather than effNumEntries() when checking consistency of inputs to efficiency() calculations -- the effNumEntries of a set can be smaller than that of a strict subset, surprisingly! 2014-09-17 Andy Buckley * Small improvements to yodahist and yodaplot behaviours/UIs. * Adding setX/Y/Z(val, err) methods to Point3D. * Add an efficiency method for 2D histos. * Hide fill and fillBin methods from Python mappings of bin types. 2014-09-01 Andy Buckley * YODA 1.2.1 release! 2014-08-29 Andy Buckley * Hide non-const access to bin objects from histogram users: avoids potential for inconsistency between total dbns and in-range bins. * Bug in BinSearcher fixed by Peter Richardson: constructor arguments were passed in the wrong order when constructing a LinEstimator in cases where log binning wouldn't be allowed. 2014-08-26 Andy Buckley * Add protection against / characters in histo names in yoda2root (thanks to Will Bell for the report and suggested patch). 2014-08-17 Andy Buckley * Add +=, -=, *-, /=, ++ and -- operators to Counter, along with an (implicit) constructor from a double -- all for user convenience so Counter can be used in lieu of a simple number. 2014-08-15 Andy Buckley * YODA 1.2.0 release! * Permit +-inf values to be filled into histograms; NaN fills will still explicitly throw an exception. * Add unit tests for Counter, Scatter1D, and Scatter2D, including persistency. * Adding YODA and FLAT format I/O for Scatter1D and Counter (as far as currently possible -- FLAT Counter can't be read due to a #item ambiguity, just like the one between the YODA format Point3D and ProfileBin1D). To be continued... 2014-08-14 Andy Buckley * Python mappings for Dbn0D and Counter, and other improvements. * Adding val() and err() methods to Counter, and errW() and relErrW() to all DbnXD types. * Adding Scatter1D and Point1D types, with conversion from Counter supported. Both Counter and Scatter1D still need to be supported by YODA persistency. 2014-08-11 Andy Buckley * Add ROOT version checking to configure. Thanks to Michael Grosse for the report/request. 2014-08-05 Andy Buckley * Remove all methods not specific about the axis to which they refer, e.g. Histo1D::mean -> xMean. Also remove all related aliases (a nightmare to maintain) and low/highEdge and midpoint functions: use the proper xMin/Max/Mid from now on. This is a significant compatibility breaking API change (and the decision was not taken lightly) so will require a 2nd digit version change. * Lots of adding xMin/Max etc. functions to C++ and Python bin/histo classes. * Compiler pickiness fixes in BinSearcher. * Improvement to linspace, avoiding fuzzyEquals and again making sure that the end value is exact. 2014-07-23 Andy Buckley * Fix to logspace: make sure that start and end values are exact, not the result of exp(log(x)). * Clean-up, minor improvements, and adding a test for BinSearcher and friends. 2014-07-19 Andy Buckley * Various consistency improvements and minor bugfixes to Python mapping utils and Dbn and Bin objects. * Fix Axis2D::reset, which was resetting the total dbn and outflows, but not the bins!!! Thanks to Ewen Gillies for the report. 2014-07-18 Andy Buckley * Add scaleX,Y,Z and scaleXYZ to Point and Scatter classes, and deprecate less explicit/consistent Scatter2D/3D.scale method. 2014-07-17 Andy Buckley * yodascale now writes out rescaled histograms and profiles rather than scatters. * A few more improvements on Point2D/3D, adding x,y,zMin/Max function mappings. * Add first version of a yodascale script, based on code from Simone Amoroso. 2014-07-16 Andy Buckley * More Scatter and 2D histo interface improvement. * Remove 'return *this' from Scatter2D/3D add and combine methods. * Add unit test checks for 1D and 2D mkScatter functions. * Improve Scatter2D/3D C++ and Python interfaces. * Add Scatter3D Python mapping. 2014-07-15 Andy Buckley * Add auto-parsing of yes/no/on/off/true/false as bools in the Python ao.annotation() function. * Add parsing of yodaplot styles from command line args and analysis object annotations. 2014-07-12 Andy Buckley * Fix infinite recursions in Python wrappers for Point2D and Point3D, and make the Python Point3D interface more standard. * Add yodaplot script for basic plotting, using pgfplots as a backend. 2014-07-10 Andy Buckley * Add mkScatter(Scatter2D) and mkScatter(Scatter3D) functions and Python mappings: this allows all AOs to be used as args to mkScatter(...) without needing to check if they already are scatters. 2014-07-02 Andy Buckley * Set y value and/or error to 0 in mkScatter(Histo1D) if an exception is thrown when calculating the appropriate values. Need an optional param to control this error handling behaviour between set-zero and skip-bin? 2014-07-01 Andy Buckley * Add exception translation to the mkScatter functions. * Add -m/-M match/unmatch options to yodacnv -- useful for filtering histogram file contents in a YODA->YODA conversion. 2014-06-24 Andy Buckley * Don't complain about merge assumptions if there is only one object with that path name to be 'merged' 2014-06-17 Andy Buckley * Adding explicit int cast in Python wrapping of numEntries functions. 2014-06-13 Andy Buckley * Adding yodals script to list data file contents. 2014-06-11 David Grellscheid * pyext/yoda/Makefile.am: 'make distcheck' and out-of-source builds should work now. 2014-06-10 Andy Buckley * Fix use of the install command for bash completion installation on Macs. 2014-06-06 Andy Buckley * YODA 1.1.0 release. Middle version number change to reflect API changes w.r.t 1.0.6. * Adding unit tests against ref data for yodamerge in make check. 2014-06-04 Andy Buckley * Fix silly typos in yodamerge which somehow made it past "make check" testing :-( 2014-06-02 Andy Buckley * YODA 1.0.7 release. DO NOT USE: prefer 1.1.0, above. 2014-05-30 Andy Buckley * Removing 'foreach' macro definition and using raw BOOST_FOREACH instead until C++11 is allowed. * Adding pytest-p1d and pytest-p2d tests, and FLAT writing/reading in pytests. * Tweaking WriterFLAT and adding ReaderFLAT functionality for 2D histos and profiles. 2014-05-30 Holger Schulz * Some basic (FLAT) write-out capability for 2D histos 2014-05-29 Andy Buckley * Improvements to the yodahist script, including support for 2D histograms and input files. * Adding bin edges constructors for all 1D and 2D histos in Python. 2014-05-22 Andy Buckley * Improvements to Profile2D and Point2D interfaces in Python. * Add a single-file at a time yodacnv multi-format converter script (thanks to Andrii Verbytskyi for the suggestion). 2014-05-19 Andy Buckley * Typo fixes in Profile2D YODA-format parsing: 2D histo tests now pass! * Adding Python tests for Histo2D and Profile2D. * Adding a YODA/Predicates.h header and using it in Axis2D bin edge construction. * Enabling Profile2D writing in various Writers, and a bit of IO code tidying. 2014-05-17 Andy Buckley * Disable writing out of Histo2D and Profile2D outflows for now, while they are redesigned, and get 2D I/O working for the in-range part. 2014-05-14 Andy Buckley * Mapping the divide and efficiency functions into the Python interface as class methods, including the __div__ special function. 2014-05-13 Andy Buckley * Add the AnalysisObject::type() method back in Python (even though type(ao) is more Pythonic, this may be useful) 2014-05-06 Andy Buckley * Add Profile2D YODA format writing, note need for Scatter format change, add sumXY storage to both 2D histo types. 2014-05-03 Andy Buckley * Adding YODA reader functionality for Histo2D and Profile2D, but without outflows support yet. 2014-04-25 Andy Buckley * Adding simple command line yodahist script for quick 1D histogramming from plain text files, with weight support. More development to come! * Mapping linspace, logspace and a few stat functions into Python. 2014-04-24 Andy Buckley * Fixes, script installation, and detailed numerical comparisons in yodadiff. 2014-04-17 Andy Buckley * Change AnalysisObject::annotations to return the list of annotation keys rather than the map, since the previous behaviour mapped very badly into Python. 2014-04-16 Andy Buckley * Add special case handling for 2-arg use of x2y scripts where the second arg is -, for stdin. This will be treated as writing out to stdout, not converting two files one of which is stdin. 2014-04-15 Andy Buckley * Adding a more portable version of getline to be used in the YODA file parsing to avoid falling over on DOS-produced input files. 2014-04-14 Andy Buckley * Adding the namespace protection workaround for Boost described at http://www.boost.org/doc/libs/1_55_0/doc/html/foreach.html 2014-04-13 Andy Buckley * Adding an assumed-equal-run-size, ratio-like merging heuristic for Scatter2Ds to yodamerge, and renaming the --normalize-all flag to --assume-normalized. * Adding and installing a pkg-config data file for YODA. * Rationalising (and fixing?) the yodamerge logic re. user & normalization scalings, and making way for a Scatter2D merging heuristic. 2014-03-10 Andy Buckley * YODA 1.0.6 release. 2014-03-06 Andy Buckley * Improvements to AnalysisObject annotation handling in Python. * Adding rescaling arguments to yodamerge (and scale function to Python Scatter2D). * Better documentation and consistency of Histo and Profile Python wrappers, and removing some inappropriate attributes. * Adding clone() and newclone() functions to all analysis object classes. 2014-02-28 Andy Buckley * Cython mapping improvements, esp. adding numPoints/numBins functions and better Scatter2D __repr__. * Adding mapping of the mkScatter functions into Python (as methods on Histo1D and Profile1D rather than the original free functions, at least for now: some Python type-identifying boilerplate is needed to make a single mkScatter function work in Python) 2014-02-27 Leif Lönnblad * Minor modifications to BinSearcher to avoid NaN's. The NaN's were treated correctly before, but better to avoid them all together. 2014-02-27 Andy Buckley * Adding the generated pyext/yoda/rootcompat.cpp to the tarball and sorting out the ROOT/Cython interface conditionals a bit more sanely. Thanks to Oldrich Kepka for the bug report. * Protecting yodamerge against input histograms with zero integrals (thanks to Christian Bierlich for the bug report). 2014-02-14 Frank Siegert * Fix race condition with mktemplates. 2014-02-12 David Grellscheid * Fix bug in mktemplates code (thanks to Christian Johnson for the bug report). 2014-02-09 Andy Buckley * Adding explicit include/generated dir creation to Python extension build (thanks to Christian Johnson for the bug report). 2014-02-06 Andy Buckley * 1.0.5 release! 2014-02-05 Andy Buckley * Adding patches to ReaderFLAT and ReaderYODA use of Boost Spirit which reduce the Boost version requirement from 1.47 -> 1.41. Thanks to Andrii Verbytskyi for the patch. * Protect against invalid prefix value if the --prefix configure option is unused. 2014-02-04 Andy Buckley * Adding copy assignment operators where missing, based on an implementation in AnalysisObject which only copies rvalue paths and titles if they are non-null. 2014-02-03 Andy Buckley * Improving (i.e. increasing) bin edge overlap tolerance: 1e-10 relative was too tight. 2014-01-31 Andy Buckley * Adding x/yMid etc. methods on Bin1D and 2D, and more related Python API improvements. 2014-01-28 Andy Buckley * Adding missing fillBin methods to 1D and 2D Histo/Profile Python classes. * Fixed yodamerge default output file name treatment. * Avoid computing an unrecoverable error in Histo1D.__repr__ * Clean-ups and API improvements in Python IO functions. * Adding more sumW,W2 and (eff)NumEntries attrs to Python objects. 2013-12-17 Andy Buckley * Improved argument handling for x2y scripts. 2013-11-16 Andy Buckley * Fix to build the Cython rootcompt extension .cpp on request. 2013-11-14 Andy Buckley * Adding flags for the C++11 or C++0x standard if supported, cf. Rivet. 2013-10-24 Andy Buckley * YODA 1.0.4 release. * Supporting zsh completion via bash completion compatibility. 2013-10-21 Andy Buckley * Removing unused internal iterator typedefs from Writer functions. 2013-10-18 Andy Buckley * Adding a yodaenv.sh sourceable script to help with environment setup. * Remove Scatters from being handled by yodamerge by blocking the __add__ method fallback. 2013-10-09 Andy Buckley * Improvements to yoda-config and command-line completion, for the Rivet 2.0.0 release. 2013-10-09 Andy Buckley * Version 1.0.3 release. 2013-10-04 Andy Buckley * Cython mapping improvements. * Adding some improved heuristics and a --normalize-all option to yodamerge. Frank S is now happy again ;-) 2013-10-01 Andy Buckley * Adding operator +, -, +=, -= Python mappings wherever possible for Histo1/2D, Profile1/2D, and Scatter2D. 2013-09-26 Andy Buckley * Cython is no longer needed by tarball users. 2013-09-25 Andy Buckley * Unset path of returned histogram if those of the args to add() and subtract() are difference. 2013-09-24 Andy Buckley * Python mapping improvements. 2013-09-23 Andy Buckley * Add the -avoid-version flag to libtool. * Adding more add and subtract special methods in Python. 2013-09-22 Andy Buckley * mkScatter schanged to use histo midpoints rather than focuses by default for the point x value. 2013-08-14 Andy Buckley * Version 1.0.2. * Some exception message improvements and improving the protection of cosmetic mean calculations in WriterYODA. 2013-07-12 Andy Buckley * Adding ROOT detection in configure and otherwise updating Dave's rootcompat module so that it'll compile. There might be an inconvenient ROOT version dependency in the signature of one of the PyROOT API functions that is used as a shim :-( 2013-06-17 Andy Buckley * Adding yoda.m4 from James Robinson. 2013-06-06 Hendrik Hoeth * Improve "==" operator in Axis1D and Axis2D 2013-06-06 Andy Buckley * Adding fillBin() methods to all 1D and 2D histos, and noting that Bin types need a back-link to their axis to maintain consistency. * Release of version 1.0.1 2013-06-05 Andy Buckley * Change the divide(Scatter, Scatter) behaviours to use the midpoint of the num/denom bins rather than mean of foci for the output point position (and hence errors, too). * Adding a toIntegralEfficiencyHisto function. * Adding another Histo1D::integral() function, this time from 0 -> i, maybe including the underflow. 2013-06-04 Andy Buckley * Updating the Cython version requirement to 0.18 2013-06-03 Andy Buckley * Adding relErr functions to 1D and 2D histo and profile bins, and being careful about div by zero. * Improvements in error treatment in division (better handling of zeros). * Renaming merge-histos to yodamerge and installing it (and improving the usage string a bit). 2013-05-31 Andy Buckley * Adding the Counter type, and ability to output it from the YODA writer. * Adding numEntries and effNumEntries methods to 1D and 2D Histo and Profile classes. * Adding Dbn0D and using it to implement Dbn1D. 2013-05-30 Andy Buckley * Fixing several nasty errors in argument ordering for Point{1,2,3}D construction in Scatter addPoint functions. * Adding abs(...) to the returned Dbn1D::variance(), to avoid problems when negative weights produce negative variance. No, we don't like this either: is there a more correct way? * Fixing the efficiency(Histo1D, Histo1D) implementation, cf. http://root.cern.ch/phpBB3/viewtopic.php?t=3753 * Adding mkScatter(Profile2D) 2013-05-29 Hendrik Hoeth * Adding a reader for FLAT files and a flat2yoda converter 2013-05-27 Andy Buckley * Adding a yoda-completion file for bash. 2013-05-17 Andy Buckley * Mapping HistoBin1D.relErr in Python. * Adding a non-const points() accessor to Scatter2D. 2013-05-13 Andy Buckley * Adding combined value+error setX/Y functions on Point2D. * Adding HistoBin1D::relErr() 2013-04-23 Andy Buckley * Adding Python output handling for single AOs and to be able to use a "-" filename to mean stdout. 2013-04-12 Andy Buckley * Releasing version 1.0.0 -- it seems stable enough. 2013-04-10 Andy Buckley * Being more careful about adding -Wno-* flags to the C++ compiler used to built the Cython extension lib. 2013-03-22 Andy Buckley * Removing the use of svn:external to pull in Boost macros and using a minimal local set instead. * Using the nice Boost-finding macros from https://github.com/tsuna/boost.m4 and tidying up configure.ac 2013-03-15 Andy Buckley * Re-organising the C++ side of the auto-format I/O functions, into a new IO header and separated from the Reader.h and Writer.h. I'm tempted to say that users shouldn't really NEED to ever directly touch the Reader and Writer objects... * Adding auto-format read and write functions. I will probably change the API. Python mappings have been provided, but the string workarounds were too much of a pain with Cython 0.16 so I have updated the Cython version requirement to 0.17 where it is automatic and hence much cleaner. 2013-03-08 Andy Buckley * Making the x2y converter scripts write a copy into the *current* directory if only the input is specified. 2013-03-05 Andy Buckley * Removing Plot entirely from YODA: it was an anomaly only added to make plot file generation easy, but this is now done better via StringIO (in new compare-histos/rivet-cmphistos). * Removing the Plot from Cython... and soon from YODA itself: we'll do this stuff manually and less hackily. * Make Cython automatically add a copy of the original call signature to each function's docstring. 2013-03-04 Andy Buckley * Adding Plot mapping to Cython and improving the AO annotations handling in Python. * Adding PLOT section writing to WriterFLAT (and WriterYODA, although that might be a bad idea...) * Adding aida2yoda and aida2flat converter scripts. 2013-02-02 David Mallows * Adding support for Python >= 2.4 (was Python >= 2.6) * Fixing miscellaneous warnings on GCC 4.1 2013-01-30 Andy Buckley * Adding a points() method to the Python Scatter2D wrapper. * Adding a virtual destructor to Bin. 2012-12-30 Andy Buckley * Adding support for Boost.Range arguments and file format autodetection in Writer. 2012-11-24 Andy Buckley * Bump version to 0.6beta0 * Adding more ROOT converters. Who knows how to make TProfiles from scratch, but Histo1D and Scatter2D are covered, which should be enough to get started with, at least. 2012-11-16 Andy Buckley * Adding yoda-config 2012-11-16 Hendrik Hoeth * Adding WriterFLAT and yoda2flat 2012-11-16 Andy Buckley * Adding YODA/ROOTCnv.h. for data object converter functions. Two (untested) functions added for TH1 -> YODA. * Adding toIntegralHisto(Histo1D&) function. 2012-11-15 Dave Mallows * Commited numerous changes to Axis2D. Axis2D now uses BinSearcher as with Axis1D. 2012-11-15 Andy Buckley * Improving division and efficiency treatments, and allowing arbitrary f(x), f(y), and flip transformations on Scatter2D. 2012-11-14 Andy Buckley * Converting linspace, logspace, and their usage to place the nbins argument first. 2012-08-07 Andy Buckley * Removing unused (beyond 2nd order) sumWXYZ counter from Dbn3D. 2012-08-07 Dave Mallows * Converted Axis1D to use new Utils/BinSearcher. 2012-08-02 Dave Mallows * Heavily refactored Cython bindings * HistoBin1D, ProfileBin1D etc. now inherit from Bin1D[DBN] * Temporarily removed Histo2D, Profile2D and Scatter3D mappings. 2012-07-23 Andy Buckley * Installing scripts from bin dir, and making the yoda2aida interface nicer. * Adding Cython mappings for Dbn3D and Profile2D, and other fixes/improvements. 2012-07-22 Andy Buckley * Adding Cython mappings for Scatter3D and ProfileBin2D. * Fixing more crap code legacy from old 2D plot implementation, this time in Scatter3D. 2012-07-19 Andy Buckley * Adding stdErr for Histo2D + Python mapping, and more Cython improvements. * Adding path/title-only AO constructors and making nice Python constructor for Histo2D. * Cython mapping improvements & additions for Point3D + Scatter3D. * Removing mixed symm/asymm constructors on Point*D & Scatter*D classes. 2012-07-12 Andy Buckley * Reintroducing Profile2D and Scatter3D. * Adding axis locking to Axis2D. * Supporting Histo2D in WriterYODA. 2012-07-02 Andy Buckley * More incremental progress toward a working 2D bin hash mechanism. 2012-05-03 Andy Buckley * Adding nice constructor behaviours to the Histo1D and Profile2D Python interfaces, and adding the mkScatter operation for Profile1D. * Adding more default constructors for analysis objects, to allow member variable and STL container use without pointers. 2012-05-02 Andy Buckley * A much simplified and more robust rewrite of the Axis1D class, just using STL map in place of the hand-written bin edge caching. * Improvements (I hope) to the binary search in Axis1D, and providing an experimental default constructor for Histo1D. 2011-12-08 Hendrik Hoeth * ReaderYODA can now parse Histo1D and Profile1D flat files 2011-12-08 Andy Buckley * Adding a Utils::ndarray object and using it to implement a general Scatter system, with generalised Point and Error to boot. 2011-12-07 Hendrik Hoeth * Lots of cleanup 2011-12-07 Andy Buckley * Mapping the Dbn1D and Dbn2D classes into Python. * Adding an outflows() accessor to Histo2D. * Writing out total dbn lines for Histo1D and Profile1D in the YODA format, and now writing out the 'cross-terms' for Profile1D, too. * Properly adding Dbn1D accessors for Histo1D. * Updating the Cython mappings to provide the totalDbn() methods and add a placeholder mapping for Dbn2D. Completed mappings are needed for Dbn{1,2,3}D and the Profile types. * Adding totalDbn() accessors to data types. 2011-12-06 Andy Buckley * Making Histo1D/2D::scaleW() write a ScaledBy annotation. * Adding annotation-fetching methods with a default return value argument to AnalysisObject. * Adding normalize() methods to Histo1D/2D. * Adding weighted RMS calculating methods to Dbn1D, Dbn2D and Bin1D/2D. 2011-09-03 Dave Mallows * Fixed ReaderAIDA: x-value and low y-error interchanged when filling Scatter2D. * Changed to Cython for Python bindings: Swig bindings were in need of serious amounts of work. Cython should provide a means to provide more Pythonic bindings to YODA. A minimal subset of ReaderAIDA, Scatter2D and Point2D have been wrapped. * Modified configure.ac, Makefile.am and pyext/Makefile.am to reflect change to Cython. Added cython.m4 from python-efl (Part of the enlightenment project; LGPL) 2011-08-31 Dave Mallows * Fixed python tests by installing python extension to pyext/build 2011-08-23 Andy Buckley * Adding rebinning interface to Histo1D and Profile1D, and adding a test (and a new test feature for output message formatting) * Adding first implementation of 1D bin merging to Axis1D. 2011-08-22 Andy Buckley * Adding copy constructors and assignment operators to Histo1D, Profile1D, and Scatter2D, and their respective bins/points. * Remove use of sign(weight) in filling sum(w2) -- I think this was an historical attempt based on a scaling axiom which turned out to be inappropriate. * Reworking the Bin1D inheritance and composition design so that all bin types store a single distribution object -- a Dbn1D for histo bins and a Dbn2D for profile bins. 2011-08-18 Andy Buckley * Removing the Profile1D -> ProfileBin1D friendship. This is very heartening -- the fewer friend declarations we need, the more indication that the class structure is not pathological! (Or that we've just made everything public... but we haven't) 2011-08-15 Andy Buckley * Inlining all functions in HistoBin1D, ProfileBin1D, and HistoBin2D. * Converting Dbn2D to be composed of two Dbn1Ds and a cross-term. Also tidying the interfaces of the 2D classes and the scaleX/Y methods throughout, and adding Doxygen comments. 2011-08-12 Andy Buckley * Adding proper Doxygen structures and full descriptive comments to Dbn2D. * Adding the persistency state-setting constructors for Profile1D and Dbn2D. * Inlining lots of methods on Dbn1D. Same should be done for Dbn2D, but first it needs to be reimplemented in terms of two Dbn1Ds + the cross-term. 2011-08-11 Andy Buckley * Various typo fixes and comments relating to persistency constructors, Histo2D slicing, etc. * Changing the HistoBin1D state-setting constructors (aargh, these should *not* have already existed) to take Dbn1D as an argument rather than a long list of doubles. 2011-08-01 Andy Buckley * Adding tests to check that implicit construction of Weights objects from literal doubles and ints works. 2011-07-28 Andy Buckley * Bumping version number to 0.4.0beta0 -- there have been substantial changes recently and YODA is now in a state where it should be interesting for outsiders to start playing with it. * Templating the Axis1D on the distribution type to be used for total and under/overflow statistics: Profile1D now has Dbn2D objects handling its total and overflow statistics. 2011-07-26 Andy Buckley * Added a Histo1D::integral(index1, index2) method. Not sure how or if to extend this to Profile1D. * Implementing incomplete Scatter2D operator+ and operator- functions. 2011-07-25 Andy Buckley * Adding a Weights class, designed to seamlessly replace double-type weights and weighted moments with a named and vectorised form. 2011-07-19 Andy Buckley * Add Profile1D and Scatter2D division operators. * Add xMin/xMax synonyms to the Axis1D, cf. the bins. 2011-07-18 Andy Buckley * Add a first stab at a Histo1D/Histo1D division operator. 2011-07-10 Andy Buckley * Add construction of Histo1Ds from Profile1D and Histo1D, and construction of Profile1Ds from those and Scatter2D. 2011-07-07 Andy Buckley * Add construction of a Histo1D from Scatter2D. 2011-06-15 Andy Buckley * Making the AIDA reader work, including reading of annotations and a few tweaks to the simple type persistency system. Test histo 1b updated. 2011-06-12 Andy Buckley * Removing Histo1D::area * Filling and using under/overflow and total db on Histo1D, and adding boolean arg to integral, sumW, etc. * Fixing for C++ change in behaviour of std::make_pair * Adding addAnnotation, and mapping annotations to Python. 2011-02-22 Andy Buckley * Use distutils rather than setuptools for the Python interface build. * Renaming Bin, HistoBin and ProfileBin to be Bin1D, HistoBin1D, ProfileBin1D. Bin is now a top-level abstract class with minimal functionality to be shared between 1D and 2D bins. 2011-01-12 Andy Buckley * Type annotations in mkScatter * Added many vector constructors and addPoint functions to Scatter2D. 2011-01-11 Andy Buckley * Add lexical_cast support to annotation get and set functions. * Write out annotations in AIDA format, and copy annotations in mkScatter -- using a new AnalysisObject::setAnnotations method. * Convert DPS output to use interim Scatter construction * Make (unused) yoda.plot subpackage. * Write out annotations in YODA format. * Make Scatter2D representations of Histo1D and Profile1D. * Write out Scatter2D objects in AIDA and YODA formats. * Make Scatter2D and Point2D work. Add a few extra methods... evolution and tweaking required. 2011-01-10 Andy Buckley * Add Boost checks and header includes. Not used yet. * Hide Utils:: content from Doxygen and nvector -> Utils::nvector. * Removing unused YAML stuff: we aren't going that way for persistency anymore. * Renaming Axis -> Axis1D * Removing dead-end templated Scatter stuff. * Move (generated) config files into the Config subdir. * Move sortedvector and indexedset into the Utils dir. * Move the "utils" directory and namespace to "Utils" * Put the Doxyfile under configure control by moving it to Doxyfile.in and using the @PACKAGE_VERSION@ token. * Make Doxygen find the .icc file and hide functions with name _* and in the YAML namespace. * Removing the Binning argument and enum in favour of explicit bin edge vectors, possibly produced explicitly via the MathUtils linspace and logspace functions, or the new Axis::mkBinEdgesLin/Log alias functions. * Fixed Axis, Histo1D and Profile1D constructors, by adding a path argument, passing the path and title args to the AnalysisObject base constructor properly. * Removed several old and unused files such as Tree.h 2011-01-09 Andy Buckley * Updating copyright comments to be valid into 2011. * Persistency fixes, and changing the interface to use the annotated path. * Using annotations for path and title. * Adding tests of collection and iterator range AO writing. * Adding static write functions on Writer*.h implementations to avoid needing to make an explicit Writer object via the create() functions. * Rename Exception.h -> Exceptions.h * Added AnnotationError. * Re-enable persistency of collections with begin/end iterators. 2011-01-08 Andy Buckley * Enabling quiet compilation. * More annotation functionality. 2011-01-07 Andy Buckley * Sorting out autoheaders to be more useful. * Rewriting AIDA writer to use DPS representation (no reloading) for Histo1D and Profile1D objects. * Adding persistency system hooks, since RTTI just sucks too much. * Renaming test files to have more meaningful names. 2010-12-10 Andy Buckley * Some tweaks to Axis, Bin, etc. to use the sortedvector. Seems to be working! (I must be checking it wrongly...) * Adding another candidate object for the axis bin container: a sorted extension to STL std::vector with an insert method. This will do as a development placeholder: a proper sorted & indexed container may be substituted later. * Fix test code: titles are no longer given as histogram constructor arguments. 2010-11-21 Andy Buckley * Adding indexed set for holding bins on axes. Still not sure it's what we want, as (I just realised) STL sets are iterator-immutable because they are self-keyed and changes to elements would also change their sorting. 2010-09-19 Andy Buckley * Restarting ChangeLog contributions! Many changes in the huge time since last update... activity on YODA has renewed and we have a better picture of the distinctive features we require. New idea: named weight vector filling, allowing "parallel" histograms for various event weight variations. I/O remains an awkward issue, especially since the classes are now much richer than they used to be, and don't know about paths. Output can be easily put on top: not an issue... and we can probably do something with pickling. But reading in from C++? 2008-09-16 Andy Buckley * Moved duplicate Histo1D/Profile1D code on to Axis, making Axis a templated class at the same time. 2008-09-12 Andy Buckley * Started work on a little plotting tool, initially for Herwig++ parton pT cut testing, but incrementally enhancing it to be a command-line quick plotter seems like a good idea. * Added some more test programs... working towards a proper test suite. * Added "no path & title" constructors - you don't always want to write out the histo, since sometimes it's just a good way to gather statistics. * Fixed YODA mapping to allow use of vectors of bins as Python lists. * Added Profile1D functionality. * Fixed Dbn1D to use sign(weight) as part of the "w**2" measure, so that negative weights behave themselves. 2008-05-23 Andy Buckley * Added Dbn1D class to centralise the calculation of statistics from unbounded, unbinned, weighted distributions. 2008-05-15 Andy Buckley * Added Profile1D class. * Fixed NaN errors from zero weights. 2008-04-14 Andy Buckley * Python SWIG interface now compiles and can be used: the subtlety that was breaking it was that SWIG has to be prodded in pretty non-obvious ways to make std::vectors of classes without default (no-arg) constructors. See http://osdir.com/ml/programming.swig/2004-04/msg00011.html for about the only reference to this to be found anywhere! * Basic AIDA writer now available - it doesn't yet output all the necessary information though, especially not for merging parallel runs. diff --git a/include/YODA/Scatter2D.h b/include/YODA/Scatter2D.h --- a/include/YODA/Scatter2D.h +++ b/include/YODA/Scatter2D.h @@ -1,439 +1,441 @@ // -*- C++ -*- // // This file is part of YODA -- Yet more Objects for Data Analysis // Copyright (C) 2008-2018 The YODA collaboration (see AUTHORS for details) // #ifndef YODA_SCATTER2D_H #define YODA_SCATTER2D_H #include "YODA/AnalysisObject.h" #include "YODA/Point2D.h" #include "YODA/Utils/sortedvector.h" #include #include namespace YODA { // Forward declarations class Histo1D; class Profile1D; /// A very generic data type which is just a collection of 2D data points with errors class Scatter2D : public AnalysisObject { public: /// Type of the native Point2D collection typedef Point2D Point; typedef Utils::sortedvector Points; typedef std::shared_ptr Ptr; /// @name Constructors //@{ /// Empty constructor Scatter2D(const std::string& path="", const std::string& title="") : AnalysisObject("Scatter2D", path, title) { } /// Constructor from a set of points Scatter2D(const Points& points, const std::string& path="", const std::string& title="") : AnalysisObject("Scatter2D", path, title), _points(points) { } /// Constructor from a vector of values with no errors Scatter2D(const std::vector& x, const std::vector& y, const std::string& path="", const std::string& title="") : AnalysisObject("Scatter2D", path, title) { if (x.size() != y.size()) throw UserError("x and y vectors must have same length"); for (size_t i = 0; i < x.size(); ++i) addPoint(x[i], y[i]); } /// Constructor from vectors of values with symmetric errors on x and y Scatter2D(const std::vector& x, const std::vector& y, const std::vector& ex, const std::vector& ey, const std::string& path="", const std::string& title="") : AnalysisObject("Scatter2D", path, title) { if (x.size() != y.size()) throw UserError("x and y vectors must have same length"); if (x.size() != ex.size()) throw UserError("x and ex vectors must have same length"); if (y.size() != ey.size()) throw UserError("y and ey vectors must have same length"); for (size_t i = 0; i < x.size(); ++i) addPoint(x[i], y[i], ex[i], ey[i]); } /// Constructor from values with asymmetric errors on both x and y Scatter2D(const std::vector& x, const std::vector& y, const std::vector >& ex, const std::vector >& ey, const std::string& path="", const std::string& title="") : AnalysisObject("Scatter2D", path, title) { if (x.size() != y.size()) throw UserError("x and y vectors must have same length"); if (x.size() != ex.size()) throw UserError("x and ex vectors must have same length"); if (y.size() != ey.size()) throw UserError("y and ey vectors must have same length"); for (size_t i = 0; i < x.size(); ++i) addPoint(Point2D(x[i], y[i], ex[i], ey[i])); } /// Constructor from values with completely explicit asymmetric errors Scatter2D(const std::vector& x, const std::vector& y, const std::vector& exminus, const std::vector& explus, const std::vector& eyminus, const std::vector& eyplus, const std::string& path="", const std::string& title="") : AnalysisObject("Scatter2D", path, title) { if (x.size() != y.size()) throw UserError("x and y vectors must have same length"); if (x.size() != exminus.size()) throw UserError("x and ex vectors must have same length"); if (y.size() != eyminus.size()) throw UserError("y and ey vectors must have same length"); if (exminus.size() != explus.size()) throw UserError("ex plus and minus vectors must have same length"); if (eyminus.size() != eyplus.size()) throw UserError("ey plus and minus vectors must have same length"); for (size_t i = 0; i < x.size(); ++i) addPoint(Point2D(x[i], y[i], exminus[i], explus[i], eyminus[i], eyplus[i])); } /// Copy constructor with optional new path /// @todo Also allow title setting from the constructor? Scatter2D(const Scatter2D& s2, const std::string& path="") : AnalysisObject("Scatter2D", (path.size() == 0) ? s2.path() : path, s2, s2.title()), _points(s2._points) { for ( auto &ann : annotations()){ setAnnotation(ann, annotation(ann)); } } /// Assignment operator Scatter2D& operator = (const Scatter2D& s2) { AnalysisObject::operator = (s2); //< AO treatment of paths etc. _points = s2._points; return *this; } /// Make a copy on the stack Scatter2D clone() const { return Scatter2D(*this); } /// Make a copy on the heap, via 'new' Scatter2D* newclone() const { return new Scatter2D(*this); } //@} /// Dimension of this data object size_t dim() const { return 2; } /// @name Modifiers //@{ /// Clear all points void reset() { _points.clear(); } /// Scaling of x axis void scaleX(double scalex) { for (Point2D& p : _points) p.scaleX(scalex); } /// Scaling of y axis void scaleY(double scaley) { for (Point2D& p : _points) p.scaleY(scaley); } /// Scaling of both axes void scaleXY(double scalex, double scaley) { for (Point2D& p : _points) p.scaleXY(scalex, scaley); } /// Scaling of both axes /// @deprecated Use scaleXY void scale(double scalex, double scaley) { scaleXY(scalex, scaley); } //@} /////////////////////////////////////////////////// - + void parseVariations() ; /// Get the list of variations stored in the points const std::vector variations() const; - + // Construct a covariance matrix from the error breakdown std::vector > covarianceMatrix(bool ignoreOffDiagonalTerms=false) ; /// @name Point accessors //@{ /// Number of points in the scatter size_t numPoints() const { return _points.size(); } /// Get the collection of points (non-const) Points& points() { return _points; } /// Get the collection of points (const) const Points& points() const { return _points; } /// Get a reference to the point with index @a index (non-const) Point2D& point(size_t index) { if (index >= numPoints()) throw RangeError("There is no point with this index"); return _points.at(index); } /// Get a reference to the point with index @a index (const) const Point2D& point(size_t index) const { if (index >= numPoints()) throw RangeError("There is no point with this index"); return _points.at(index); } //@} /// @name Point inserters //@{ /// Insert a new point void addPoint(const Point2D& pt) { _points.insert(pt); } /// Insert a new point, defined as the x/y value pair and no errors void addPoint(double x, double y) { Point2D thisPoint= Point2D(x, y); thisPoint.setParentAO(this); _points.insert(thisPoint); } /// Insert a new point, defined as the x/y value pair and symmetric errors void addPoint(double x, double y, double ex, double ey) { Point2D thisPoint= Point2D(x, y, ex, ey); thisPoint.setParentAO(this); _points.insert(thisPoint); } /// Insert a new point, defined as the x/y value pair and asymmetric error pairs void addPoint(double x, double y, const std::pair& ex, const std::pair& ey) { Point2D thisPoint= Point2D(x, y, ex, ey); thisPoint.setParentAO(this); _points.insert(thisPoint); } /// Insert a new point, defined as the x/y value pair and asymmetric errors void addPoint(double x, double y, double exminus, double explus, double eyminus, double eyplus) { Point2D thisPoint=Point2D(x, y, exminus, explus, eyminus, eyplus); thisPoint.setParentAO(this); _points.insert(thisPoint); } /// Insert a collection of new points void addPoints(const Points& pts) { for (const Point2D& pt : pts) { addPoint(pt); } } //@} /// @name Combining sets of scatter points //@{ /// @todo Better name? Make this the add operation? void combineWith(const Scatter2D& other) { addPoints(other.points()); //return *this; } /// @todo Better name? /// @todo Convert/extend to accept a Range or generic void combineWith(const std::vector& others) { for (const Scatter2D& s : others) combineWith(s); //return *this; } //@} /// Equality operator bool operator == (const Scatter2D& other) { return _points == other._points; } /// Non-equality operator bool operator != (const Scatter2D& other) { return ! operator == (other); } - + ////////////////////////////////// private: Points _points; bool _variationsParsed =false ; }; /// Convenience typedef typedef Scatter2D S2D; /// @name Combining scatters by merging sets of points //@{ inline Scatter2D combine(const Scatter2D& a, const Scatter2D& b) { Scatter2D rtn = a; rtn.combineWith(b); return rtn; } inline Scatter2D combine(const std::vector& scatters) { Scatter2D rtn; rtn.combineWith(scatters); return rtn; } //@} ////////////////////////////////// /// @name Conversion functions from other data types //@{ /// Make a Scatter2D representation of a Histo1D /// /// Optional @c usefocus argument can be used to position the point at the bin - /// focus rather than geometric midpoint. - Scatter2D mkScatter(const Histo1D& h, bool usefocus=false); + /// focus rather than geometric midpoint. Optional @c binwidthdiv argument can be + /// used to disable the default (physical, differential!) scaling of y values and + /// errors by 1/bin-width. + Scatter2D mkScatter(const Histo1D& h, bool usefocus=false, bool binwidthdiv=true); /// Make a Scatter2D representation of a Profile1D /// /// Optional @c usefocus argument can be used to position the point at the bin /// focus rather than geometric midpoint. Optional @c usestddev argument can /// be used to draw the y-distribution sigma rather than the standard error on /// the mean as the y-error bar size. Scatter2D mkScatter(const Profile1D& p, bool usefocus=false, bool usestddev=false); /// Make a Scatter2D representation of... erm, a Scatter2D! /// @note Mainly exists to allow mkScatter to be called on any AnalysisObject type inline Scatter2D mkScatter(const Scatter2D& s) { return Scatter2D(s); } // /// @note The usefocus arg is just for consistency and has no effect for Scatter -> Scatter // inline Scatter2D mkScatter(const Scatter2D& s, bool) { return mkScatter(s); } //@} ////////////////////////////////// /// @name Transforming operations on Scatter2D //@{ /// @brief Apply transformation fx(x) to all values and error positions (operates in-place on @a s) /// /// fx should be a function which takes double x -> double newx template inline void transformX(Scatter2D& s, FNX fx) { for (size_t i = 0; i < s.numPoints(); ++i) { Point2D& p = s.point(i); const double newx = fx(p.x()); const double fx_xmin = fx(p.xMin()); const double fx_xmax = fx(p.xMax()); // Deal with possible inversions of min/max ordering under the transformation const double newxmin = std::min(fx_xmin, fx_xmax); const double newxmax = std::max(fx_xmin, fx_xmax); // Set new point x values p.setX(newx); /// @todo Be careful about transforms which could switch around min and max errors, or send both in the same direction! p.setXErrMinus(newx - newxmin); p.setXErrPlus(newxmax - newx); } } /// @brief Apply transformation fy(y) to all values and error positions (operates in-place on @a s) /// /// fy should be a function which takes double y -> double newy template inline void transformY(Scatter2D& s, FNY fy) { for (size_t i = 0; i < s.numPoints(); ++i) { Point2D& p = s.point(i); const double newy = fy(p.y()); const double fy_ymin = fy(p.yMin()); const double fy_ymax = fy(p.yMax()); // Deal with possible inversions of min/max ordering under the transformation const double newymin = std::min(fy_ymin, fy_ymax); const double newymax = std::max(fy_ymin, fy_ymax); // Set new point y values p.setY(newy); /// @todo Be careful about transforms which could switch around min and max errors, or send both in the same direction! p.setYErrMinus(newy - newymin); p.setYErrPlus(newymax - newy); } } /// @todo Add external scale, scaleX, scaleY functions /// Exchange the x and y axes (operates in-place on @a s) inline void flip(Scatter2D& s) { for (size_t i = 0; i < s.numPoints(); ++i) { Point2D& p = s.point(i); const double newx = p.y(); const double newy = p.x(); const double newxmin = p.yMin(); const double newxmax = p.yMax(); const double newymin = p.xMin(); const double newymax = p.xMax(); p.setX(newx); p.setY(newy); /// @todo Be careful about transforms which could switch around min and max errors, or send both in the same direction! p.setXErrMinus(newx - newxmin); p.setXErrPlus(newxmax - newx); p.setYErrMinus(newy - newymin); p.setYErrPlus(newymax - newy); } } //@} } #endif diff --git a/include/YODA/Scatter3D.h b/include/YODA/Scatter3D.h --- a/include/YODA/Scatter3D.h +++ b/include/YODA/Scatter3D.h @@ -1,449 +1,449 @@ // -*- C++ -*- // // This file is part of YODA -- Yet more Objects for Data Analysis // Copyright (C) 2008-2018 The YODA collaboration (see AUTHORS for details) // #ifndef YODA_SCATTER3D_H #define YODA_SCATTER3D_H #include "YODA/AnalysisObject.h" #include "YODA/Point3D.h" #include "YODA/Utils/sortedvector.h" #include #include namespace YODA { // Forward declarations class Histo2D; class Profile2D; /// A very generic data type which is just a collection of 3D data points with errors class Scatter3D : public AnalysisObject { public: /// Types of the native Point3D collection typedef Point3D Point; typedef Utils::sortedvector Points; typedef std::shared_ptr Ptr; /// @name Constructors //@{ /// Empty constructor Scatter3D(const std::string& path="", const std::string& title="") : AnalysisObject("Scatter3D", path, title) { } /// Constructor from a set of points Scatter3D(const Points& points, const std::string& path="", const std::string& title="") : AnalysisObject("Scatter3D", path, title), _points(points) { std::sort(_points.begin(), _points.end()); } /// Constructor from vectors of values with no errors Scatter3D(const std::vector& x, const std::vector& y, const std::vector& z, const std::string& path="", const std::string& title="") : AnalysisObject("Scatter3D", path, title) { if (x.size() != y.size() || y.size() != z.size()) { throw RangeError("There are different numbers of x, y, and z values in the provided vectors."); } const std::pair nullerr = std::make_pair(0.0, 0.0); for (size_t i = 0; i < x.size(); ++i) { addPoint(Point3D(x[i], y[i], z[i], nullerr, nullerr, nullerr)); } std::sort(_points.begin(), _points.end()); } /// Constructor from vectors of values with asymmetric errors on both x and y Scatter3D(const std::vector& x, const std::vector& y, const std::vector& z, const std::vector >& ex, const std::vector >& ey, const std::vector >& ez, const std::string& path="", const std::string& title="") : AnalysisObject("Scatter3D", path, title) { if (x.size() != y.size() || y.size() != z.size()) { throw RangeError("There are different numbers of x, y, and z values in the provided vectors."); } if (x.size() != ex.size() || y.size() != ey.size() || z.size() != ez.size()) { throw RangeError("The sizes of the provided error vectors don't match the corresponding x, y, or z value vectors."); } for (size_t i = 0; i < x.size(); ++i) { addPoint(Point3D(x[i], y[i], z[i], ex[i], ey[i], ez[i])); } std::sort(_points.begin(), _points.end()); } /// Constructor from vectors of values with completely explicit asymmetric errors Scatter3D(const std::vector& x, const std::vector& y, const std::vector z, const std::vector& exminus, const std::vector& explus, const std::vector& eyminus, const std::vector& eyplus, const std::vector& ezminus, const std::vector& ezplus, const std::string& path="", const std::string& title="") : AnalysisObject("Scatter3D", path, title) { if(x.size() != y.size() || y.size() != z.size() || x.size() != exminus.size() || x.size() != explus.size() || y.size() != eyminus.size() || y.size() != eyplus.size() || z.size() != ezminus.size() || z.size() != ezplus.size()) throw RangeError("There are either different amounts of points on x/y/z vectors or not every of these vectors has properly defined error vectors!"); for (size_t i = 0; i < x.size(); ++i) { addPoint(Point3D(x[i], y[i], z[i], exminus[i], explus[i], eyminus[i], eyplus[i], ezminus[i], ezplus[i])); } std::sort(_points.begin(), _points.end()); } /// Copy constructor with optional new path /// @todo Also allow title setting from the constructor? Scatter3D(const Scatter3D& s3, const std::string& path="") : AnalysisObject("Scatter3D", (path.size() == 0) ? s3.path() : path, s3, s3.title()), _points(s3._points) - { + { for ( auto &ann : annotations()){ setAnnotation(ann, annotation(ann)); } } /// Assignment operator Scatter3D& operator = (const Scatter3D& s3) { AnalysisObject::operator = (s3); //< AO treatment of paths etc. _points = s3._points; return *this; } /// Make a copy on the stack Scatter3D clone() const { return Scatter3D(*this); } /// Make a copy on the heap, via 'new' Scatter3D* newclone() const { return new Scatter3D(*this); } //@} /// Dimension of this data object size_t dim() const { return 3; } /// @name Modifiers //@{ /// Clear all points void reset() { _points.clear(); } /// Scaling of x axis void scaleX(double scalex) { for (Point3D& p : _points) p.scaleX(scalex); } /// Scaling of y axis void scaleY(double scaley) { for (Point3D& p : _points) p.scaleY(scaley); } /// Scaling of z axis void scaleZ(double scalez) { for (Point3D& p : _points) p.scaleZ(scalez); } /// Scaling of all three axes void scaleXYZ(double scalex, double scaley, double scalez) { for (Point3D& p : _points) p.scaleXYZ(scalex, scaley, scalez); } /// Scaling of all three axes /// @deprecated Use scaleXYZ void scale(double scalex, double scaley, double scalez) { scaleXYZ(scalex, scaley, scalez); } //@} /////////////////////////////////////////////////// - + void parseVariations() ; - /// Get the list of variations stored in the points + /// Get the list of variations stored in the points const std::vector variations() const; /// @name Point accessors //@{ /// Number of points in the scatter size_t numPoints() const { return _points.size(); } /// Get the collection of points (non-const) Points& points() { return _points; } /// Get the collection of points (const) const Points& points() const { return _points; } /// Get a reference to the point with index @a index Point3D& point(size_t index) { if (index >= numPoints()) throw RangeError("There is no point with this index"); return _points.at(index); } /// Get the point with index @a index (const version) const Point3D& point(size_t index) const { if (index >= numPoints()) throw RangeError("There is no point with such index!"); return _points.at(index); } //@} /// @name Point inserters //@{ /// Insert a new point void addPoint(const Point3D& pt) { _points.insert(pt); } /// Insert a new point, defined as the x/y/z value triplet and no errors void addPoint(double x, double y, double z) { Point3D thisPoint=Point3D(x, y, z); - thisPoint.setParentAO(this); + thisPoint.setParentAO(this); _points.insert(thisPoint); } /// Insert a new point, defined as the x/y/z value triplet and symmetric errors void addPoint(double x, double y, double z, double ex, double ey, double ez) { Point3D thisPoint=Point3D(x, y, z, ex, ey, ez); - thisPoint.setParentAO(this); + thisPoint.setParentAO(this); _points.insert(thisPoint); } /// Insert a new point, defined as the x/y/z value triplet and asymmetric error pairs void addPoint(double x, double y, double z, const std::pair& ex, const std::pair& ey, const std::pair& ez) { Point3D thisPoint= Point3D(x, y, z, ex, ey, ez); - thisPoint.setParentAO(this); + thisPoint.setParentAO(this); _points.insert(thisPoint); } /// Insert a new point, defined as the x/y/z value triplet and asymmetric errors void addPoint(double x, double y, double z, double exminus, double explus, double eyminus, double eyplus, double ezminus, double ezplus) { Point3D thisPoint = Point3D(x, y, z, exminus, explus, eyminus, eyplus, ezminus, ezplus); - thisPoint.setParentAO(this); + thisPoint.setParentAO(this); _points.insert(thisPoint); } /// Insert a collection of new points void addPoints(const Points& pts) { for (const Point3D& pt : pts) addPoint(pt); } //@} /// @todo Better name? void combineWith(const Scatter3D& other) { addPoints(other.points()); //return *this; } /// @todo Better name? /// @todo Convert to accept a Range or generic void combineWith(const std::vector& others) { for (const Scatter3D& s : others) combineWith(s); } /// Equality operator bool operator == (const Scatter3D& other) { return _points == other._points; } /// Non-equality operator bool operator != (const Scatter3D& other) { return ! operator == (other); } - + ////////////////////////////////// - - + + private: Points _points; - + bool _variationsParsed =false ; }; /// Convenience typedef typedef Scatter3D S3D; /// @name Combining scatters by merging sets of points //@{ inline Scatter3D combine(const Scatter3D& a, const Scatter3D& b) { Scatter3D rtn = a; rtn.combineWith(b); return rtn; } inline Scatter3D combine(const std::vector& scatters) { Scatter3D rtn; rtn.combineWith(scatters); return rtn; } //@} ////////////////////////////////// /// @name Conversion functions from other data types //@{ /// Make a Scatter3D representation of a Histo2D /// /// Optional @c usefocus argument can be used to position the point at the bin /// focus rather than geometric midpoint. - Scatter3D mkScatter(const Histo2D& h, bool usefocus=false); + Scatter3D mkScatter(const Histo2D& h, bool usefocus=false, bool binareadiv=true); /// Make a Scatter3D representation of a Profile2D /// /// Optional @c usefocus argument can be used to position the point at the bin /// focus rather than geometric midpoint. Optional @c usestddev argument can /// be used to draw the distribution sigma rather than the standard error on /// the mean as the z-error bar size. Scatter3D mkScatter(const Profile2D& p, bool usefocus=false, bool usestddev=false); /// Make a Scatter3D representation of... erm, a Scatter3D! /// @note Mainly exists to allow mkScatter to be called on any AnalysisObject type inline Scatter3D mkScatter(const Scatter3D& s) { return Scatter3D(s); } // /// @note The usefocus arg is just for consistency and has no effect for Scatter -> Scatter //inline Scatter3D mkScatter(const Scatter3D& s, bool) { return mkScatter(s); } //@} ///////////////////////////////// /// @name Transforming operations on Scatter3D //@{ /// @brief Apply transformation fx(x) to all values and error positions (operates in-place on @a s) /// /// fx should be a function which takes double x -> double newx template inline void transformX(Scatter3D& s, FNX fx) { for (size_t i = 0; i < s.numPoints(); ++i) { Point3D& p = s.point(i); const double newx = fx(p.x()); const double fx_xmin = fx(p.xMin()); const double fx_xmax = fx(p.xMax()); // Deal with possible inversions of min/max ordering under the transformation const double newxmin = std::min(fx_xmin, fx_xmax); const double newxmax = std::max(fx_xmin, fx_xmax); // Set new point x values p.setX(newx); /// @todo Be careful about transforms which could switch around min and max errors, or send both in the same direction! p.setXErrMinus(newx - newxmin); p.setXErrPlus(newxmax - newx); } } /// @brief Apply transformation fy(y) to all values and error positions (operates in-place on @a s) /// /// fy should be a function which takes double y -> double newy template inline void transformY(Scatter3D& s, FNY fy) { for (size_t i = 0; i < s.numPoints(); ++i) { Point3D& p = s.point(i); const double newy = fy(p.y()); const double fy_ymin = fy(p.yMin()); const double fy_ymax = fy(p.yMax()); // Deal with possible inversions of min/max ordering under the transformation const double newymin = std::min(fy_ymin, fy_ymax); const double newymax = std::max(fy_ymin, fy_ymax); // Set new point y values p.setY(newy); /// @todo Be careful about transforms which could switch around min and max errors, or send both in the same direction! p.setYErrMinus(newy - newymin); p.setYErrPlus(newymax - newy); } } /// @brief Apply transformation fz(z) to all values and error positions (operates in-place on @a s) /// /// fz should be a function which takes double z -> double newz template inline void transformZ(Scatter3D& s, FNZ fz) { for (size_t i = 0; i < s.numPoints(); ++i) { Point3D& p = s.point(i); const double newz = fz(p.z()); const double fz_zmin = fz(p.zMin()); const double fz_zmax = fz(p.zMax()); // Deal with possible inversions of min/max ordering under the transformation const double newzmin = std::min(fz_zmin, fz_zmax); const double newzmax = std::max(fz_zmin, fz_zmax); // Set new point z values p.setZ(newz); /// @todo Be careful about transforms which could switch around min and max errors, or send both in the same direction! p.setZErrMinus(newz - newzmin); p.setZErrPlus(newzmax - newz); } } /// @todo Add external scale, scaleX, scaleY, scaleZ functions //@} - + } #endif diff --git a/src/Scatter2D.cc b/src/Scatter2D.cc --- a/src/Scatter2D.cc +++ b/src/Scatter2D.cc @@ -1,166 +1,164 @@ #include "YODA/Scatter2D.h" #include "YODA/Histo1D.h" #include "YODA/Profile1D.h" #include #include "yaml-cpp/yaml.h" #ifdef YAML_NAMESPACE #define YAML YAML_NAMESPACE #endif namespace YODA { /// Make a Scatter2D representation of a Histo1D - Scatter2D mkScatter(const Histo1D& h, bool usefocus) { + Scatter2D mkScatter(const Histo1D& h, bool usefocus, bool binwidthdiv) { Scatter2D rtn; - for (const std::string& a : h.annotations()) - rtn.setAnnotation(a, h.annotation(a)); + for (const std::string& a : h.annotations()) rtn.setAnnotation(a, h.annotation(a)); rtn.setAnnotation("Type", h.type()); // might override the copied ones + for (const HistoBin1D& b : h.bins()) { const double x = usefocus ? b.xFocus() : b.xMid(); const double ex_m = x - b.xMin(); const double ex_p = b.xMax() - x; double y; try { - y = b.height(); + y = b.sumW(); } catch (const Exception&) { // LowStatsError or WeightError y = std::numeric_limits::quiet_NaN(); } - double ey; - try { - ey = b.heightErr(); - } catch (const Exception&) { // LowStatsError or WeightError - ey = std::numeric_limits::quiet_NaN(); - } + if (binwidthdiv) y /= b.xWidth(); + const double ey = b.relErr() * y; + // Attach the point to its parent Point2D pt(x, y, ex_m, ex_p, ey, ey); pt.setParentAO(&rtn); rtn.addPoint(pt); } + assert(h.numBins() == rtn.numPoints()); return rtn; } /// Make a Scatter2D representation of a Profile1D Scatter2D mkScatter(const Profile1D& p, bool usefocus, bool usestddev) { Scatter2D rtn; for (const std::string& a : p.annotations()) rtn.setAnnotation(a, p.annotation(a)); rtn.setAnnotation("Type", p.type()); for (const ProfileBin1D& b : p.bins()) { const double x = usefocus ? b.xFocus() : b.xMid(); const double ex_m = x - b.xMin(); const double ex_p = b.xMax() - x; double y; try { y = b.mean(); } catch (const Exception&) { // LowStatsError or WeightError y = std::numeric_limits::quiet_NaN(); } double ey; try { ey = usestddev ? b.stdDev() : b.stdErr(); ///< Control y-error scheme via usestddev arg } catch (const Exception&) { // LowStatsError or WeightError ey = std::numeric_limits::quiet_NaN(); } //const Point2D pt(x, y, ex_m, ex_p, ey, ey); Point2D pt(x, y, ex_m, ex_p, ey, ey); pt.setParentAO(&rtn); rtn.addPoint(pt); } assert(p.numBins() == rtn.numPoints()); return rtn; } - + // retrieve variations from annoation, parse them as YAML, and update the points void Scatter2D::parseVariations() { if (this-> _variationsParsed) { return; } if (!(this->hasAnnotation("ErrorBreakdown"))) { return; } YAML::Node errorBreakdown; errorBreakdown = YAML::Load(this->annotation("ErrorBreakdown")); if (errorBreakdown.size()) { for (unsigned int thisPointIndex=0 ; thisPointIndex< this->numPoints() ; ++thisPointIndex){ Point2D &thispoint = this->_points[thisPointIndex]; YAML::Node variations = errorBreakdown[thisPointIndex]; for (const auto& variation : variations) { const std::string variationName = variation.first.as(); double eyp = variation.second["up"].as(); double eym = variation.second["dn"].as(); thispoint.setYErrs(eym,eyp,variationName); } } this-> _variationsParsed =true; } } const std::vector Scatter2D::variations() const { std::vector vecVariations; for (auto &point : this->_points){ for (auto &it : point.errMap()){ //if the variation is not already in the vector, add it ! if (std::find(vecVariations.begin(), vecVariations.end(), it.first) == vecVariations.end()){ vecVariations.push_back(it.first); } } } return vecVariations; } std::vector > Scatter2D::covarianceMatrix( bool ignoreOffDiagonalTerms) { int nPoints= this->numPoints(); //double covM[nPoints][nPoints] ={}; std::vector > covM; // initialose cov matrix to be the right shape! for (int i=0; i row; row.resize(nPoints); covM.push_back(row); } // case where only have nominal, ie total uncertainty, labelled "" (empty string) - if (this->variations().size()==1) { + if (this->variations().size()==1) { for (int i=0; i_points[i].yErrs().first+this->_points[i].yErrs().second)/2),2); if (covM[i][i]==0 ) covM[i][i]=1; } return covM; } //more interesting case where we actually have some uncertainty breakdown! auto systList= this->variations(); for (auto sname : systList){ if (sname.length()==0) continue; - std::vector< double> systErrs; + std::vector< double> systErrs; systErrs.resize(nPoints); for (int i=0; i_points[i]; try { auto variations=point.errMap().at(sname); systErrs[i]=(fabs(variations.first)+fabs(variations.second))*0.5 ;//up/dn are symmetrized since this method can't handle asymmetric errors } catch (const std::exception e) { // Missing bin. systErrs[i]=0.0; } } if (ignoreOffDiagonalTerms || sname.find("stat") != std::string::npos || sname.find("uncor") != std::string::npos){ for (int i=0; i #include "yaml-cpp/yaml.h" #ifdef YAML_NAMESPACE #define YAML YAML_NAMESPACE #endif namespace YODA { - Scatter3D mkScatter(const Histo2D& h, bool usefocus) { + Scatter3D mkScatter(const Histo2D& h, bool usefocus, bool binareadiv) { Scatter3D rtn; - for (const std::string& a : h.annotations()) - rtn.setAnnotation(a, h.annotation(a)); + for (const std::string& a : h.annotations()) rtn.setAnnotation(a, h.annotation(a)); rtn.setAnnotation("Type", h.type()); + for (size_t i = 0; i < h.numBins(); ++i) { const HistoBin2D& b = h.bin(i); /// SAME FOR ALL 2D BINS double x = b.xMid(); if (usefocus) { try { x = b.xFocus(); } catch (const LowStatsError& lse) { x = b.xMid(); } } const double exminus = x - b.xMin(); const double explus = b.xMax() - x; double y = b.yMid(); if (usefocus) { try { y = b.yFocus(); } catch (const LowStatsError& lse) { y = b.yMid(); } } const double eyminus = y - b.yMin(); const double eyplus = b.yMax() - y; /// END SAME FOR ALL 2D BINS - const double z = b.height(); - const double ez = b.heightErr(); + double z; + try { + z = b.sumW(); + } catch (const Exception&) { // LowStatsError or WeightError + z = std::numeric_limits::quiet_NaN(); + } + if (binareadiv) z /= b.xWidth()*b.yWidth(); + const double ez = b.relErr() * z; + /// @todo Set up parent link cf. Scatter2D rtn.addPoint(x, y, z, exminus, explus, eyminus, eyplus, ez, ez); } + assert(h.numBins() == rtn.numPoints()); return rtn; } Scatter3D mkScatter(const Profile2D& h, bool usefocus, bool usestddev) { Scatter3D rtn; for (const std::string& a : h.annotations()) rtn.setAnnotation(a, h.annotation(a)); rtn.setAnnotation("Type", h.type()); for (size_t i = 0; i < h.numBins(); ++i) { const ProfileBin2D& b = h.bin(i); /// SAME FOR ALL 2D BINS double x = b.xMid(); if (usefocus) { try { x = b.xFocus(); } catch (const LowStatsError& lse) { x = b.xMid(); } } const double exminus = x - b.xMin(); const double explus = b.xMax() - x; double y = b.yMid(); if (usefocus) { try { y = b.yFocus(); } catch (const LowStatsError& lse) { y = b.yMid(); } } const double eyminus = y - b.yMin(); const double eyplus = b.yMax() - y; /// END SAME FOR ALL 2D BINS double z; try { z = b.mean(); } catch (const LowStatsError& lse) { z = std::numeric_limits::quiet_NaN(); } double ez; try { ez = usestddev ? b.stdDev() : b.stdErr(); ///< Control z-error scheme via usestddev arg } catch (const LowStatsError& lse) { ez = std::numeric_limits::quiet_NaN(); } rtn.addPoint(x, y, z, exminus, explus, eyminus, eyplus, ez, ez); } return rtn; } - + void Scatter3D::parseVariations() { if (this-> _variationsParsed) { return; } if (!(this->hasAnnotation("ErrorBreakdown"))) { return;} YAML::Node errorBreakdown; errorBreakdown = YAML::Load(this->annotation("ErrorBreakdown")); if (errorBreakdown.size()) { for (unsigned int thisPointIndex=0 ; thisPointIndex< this->numPoints() ; ++thisPointIndex){ Point3D &thispoint = this->_points[thisPointIndex]; YAML::Node variations = errorBreakdown[thisPointIndex]; for (const auto& variation : variations) { const std::string variationName = variation.first.as(); double eyp = variation.second["up"].as(); double eym = variation.second["dn"].as(); thispoint.setZErrs(eym,eyp,variationName); } } this-> _variationsParsed =true; } } - - + + const std::vector Scatter3D::variations() const { std::vector vecvariations; for (auto &point : this->_points){ for (auto &it : point.errMap()){ //if the variation is not already in the vector, add it ! if (std::find(vecvariations.begin(), vecvariations.end(), it.first) == vecvariations.end()){ vecvariations.push_back(it.first); } } } return vecvariations; } }