-
Notifications
You must be signed in to change notification settings - Fork 25
Wrapped design #183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrapped design #183
Conversation
Avoid leaking Axis class names Drop underscores infront of _any
ed20a24 to
601f622
Compare
|
Let's go ahead and merge this into develop, and review/changes can be PRs. I need this in so I work on the next set of changes as new branches on the flight to Australia. Anything here can be reverted/modified in develop if needed. |
|
(Actually, @HDembinski, to make it easier to review, I'll leave this open, but build branches off of it on the plane, but will need to merge before proceeding). |
|
Please raise issues if there are parts of the design that could be better! I've already been working off this, and it seems to be working pretty well. |
|
|
||
| #### User changes | ||
|
|
||
| * You can now access the functional regular axis directly, `regular_sqrt` becomes `regular.sqrt`, etc.. [#183][] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No regular.sqrt. The transform should be a passed as a keyword to the regular class.
| else: | ||
| raise KeyError("Unsupported collection of options") | ||
|
|
||
| @classmethod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a change that slipped by me. I think we should not have these class methods, since people should use the transform keyword.
This changes the design to hold an internal object, and users only interact with the Python classes. Closes #180. Proposed by @HDembinski some time ago.
File layout changes
The C++ core is now named
_core, and non-public Python parts are in_internal. Thecppmodule is new (see below). AxesTuple is in now in_internal/axestuple.py,_utilsis now_internal/kwargs.py(the old meta utils are gone, no longer needed).uhi.pyis nowtag.py.Histogram design:
BaseHistogram: Shared interfaceBoostHistogram: Mimics the C++ interface as closely as possible. Even has__call__!Histogram: The default interface, with Pythonizations. Caches the axes tuple.You can convert between the two, or add a new class. If you do:
You will now be working with BoostHistograms instead of Histograms. (closes #155)
Axes design:
There is a base class
Axis, along withRegular, etc. for the 4 types. The axis object is stored in_ax. The function forms are now class methods,regular.sqrtfor example (they are still available asregular_sqrtfor the moment, as well). A helper function internally knows how to convert anaxisobject into the correctAxisclass, and is used when pulling an axis from a histogram.General changes
The underscores on some C++ parts have been removed. An underscore in the C++ bindings indicates that something is different than the C++ code. The C++
_coreobjects have been stripped down a little, and exactly mimic C++ where possible (.rank()is a function, etc). The Pythonisation now happens inHistogram. Axes tuples have functions now too (closes #176), and are finally tested.Also, more docs present, closes #174.