Giter Club home page Giter Club logo

Comments (8)

andrzejnovak avatar andrzejnovak commented on June 4, 2024

I'm open to renamings, but I would want to avoid overlap with pyplot namespace in case we ever switch to monkeyclassing

from mplhep.

HDembinski avatar HDembinski commented on June 4, 2024

You should not try to avoid name clashes. We have namespaces to resolve the ambiguity. That's the reason everyone writes plt.hist instead of just hist, so that this package can also have a hist.

from mplhep.

HDembinski avatar HDembinski commented on June 4, 2024

Look at cupy, jax, etc, these re-implement the numpy interface with the exact same names and calling conventions under a different namespace, precisely so that you can do

# import numpy as np
from jax import numpy as np

# do numpy stuff

from mplhep.

andrzejnovak avatar andrzejnovak commented on June 4, 2024

from mplhep.

HDembinski avatar HDembinski commented on June 4, 2024

Ok, you are right, it is not exactly the same situation. If I understand correctly, you are already preparing for a possible merging of mplhep into pyplot. I think this is not going to happen very soon, and even when it is, the names will be debated again anyway. You cannot anticipate how that merging will go. The matplotlib guys could decide to place this in mpl_toolkit, then you would have an extra namespace anyway.

For now, we should use names that are easy to type. I like the idea of imitating the pyplot.hist and hist2d interface, so that it is easy to switch over and you do not have to relearn another interface, that is great. However, the following should work

mplhep.hist(*np.histogram(data))

from mplhep.

andrzejnovak avatar andrzejnovak commented on June 4, 2024

@HDembinski Would you find it a reasonable solution to alias the two for now? hist = histplot, hist2d = hist2dplot ?

from mplhep.

HDembinski avatar HDembinski commented on June 4, 2024

Yes, and to deprecate histplot and hist2dplot.

from mplhep.

HDembinski avatar HDembinski commented on June 4, 2024

This is the deprecation decorator I use in iminuit, feel free to copy this or allow me to make a PR with the change.
https://github.com/scikit-hep/iminuit/blob/develop/iminuit/_deprecated.py

from mplhep.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.