Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Jim Pivarski
    @jpivarski
    That's true. This is a superset of what I think would be reasonable.
    ax is definitely good. That's saved me a few times (in Pandas).
    Henry Schreiner
    @henryiii
    We have ax
    Jim Pivarski
    @jpivarski
    Oh, good. When it's not a super-quick plot, I always start with fig, ax = plt.subplots(...).
    Henry Schreiner
    @henryiii
    Yes, as one should. :)
    Hans Dembinski
    @HDembinski
    I think it is really bad to duplicate matplotlib interface
    Wrapping a popular library like matplotlib behind your own interface is doing more harm than good, because now someone has to learn the matplotlib api and this additional api
    Andrzej Novak
    @andrzejnovak
    I agree with Hans here, though given how ubiquitous pandas is having similar shortcuts is not too far out of left field. While I also get a little annoyed by how long matplotlib.pyplot as plt is, duplicating the interface is not the way. For faster access I could see 2 options 1) have a shortcut to pyplot with hist.plt/mplhep.plt2) .plot()returning the ax object. I think Henry is very pro returning the artists, but the tuple with the artists could quite easily contain the ax as well. Then you could do h_obj.plot().ax.semilogy()if you really wanted a one-liner
    Henry Schreiner
    @henryiii
    I thought about that one liner, but it only works exactly once, you can’t make two changes that way (and you can easily get the axis from an artist). Is “pyplot” a required import, though? I seem tho remember that you can actually avoid that import, and just import the parts you need (though I’m prety sure we don’t do that)
    The point of hist.plot is to have a quick way to make a plot. If you want to import stuff, you can make figures/axes with plt, use mplhep.histplot, etc. Just like pandas, “.plot” is intended to be a shortcut for exploration, so mimicking the pandas API for quick-plotting isn’t unreasonable.
    Henry Schreiner
    @henryiii
    But I don’t want this to balloon, either, and skills you learn for matplotlib are composable / work anywhere, including other matplotlib plots, such as from pandas
    Supporing the pandas plot API might be something we could make a bit more formal. Will look into it.
    Matthew Feickert
    @matthewfeickert

    This isn't directly related, but this is reminding me of when I learned about how to use interactive vs. non-interactive matploltlib backends earlier this year and how that relates between using the matplotlib.pyplot.subplots vs. matplotlib.figure.Figure APIs

    https://gist.github.com/matthewfeickert/84245837f09673b2e7afea929c016904

    1 reply
    Henry Schreiner
    @henryiii
    Looks like plothist from mplhep already duplicates / provides a lot of this. I’d think keeping that simple and only having the shortcuts .plot would have been better.
    veprbl
    @veprbl:matrix.org
    [m]
    Hey! I have a question: Is there a file format that allows interop between C++ and python boost-histogram?
    Henry Schreiner
    @henryiii
    It’s planned. I think you can find a dissussion of it little while back in this(?) channel.
    veprbl
    @veprbl:matrix.org
    [m]
    I see. Thanks!
    Henry Schreiner
    @henryiii
    Shiny new versions of boost-histogram and hist are out, just in time for the talk at PyHEP. Watch the talk in 6.5 hours on Zoom or YouTube LiveStream (I think) to see what’s new!
    Angus Hollands
    @agoose77:matrix.org
    [m]
    I misread that as a 6.5 hour talk 😂 looking forward to it!
    Raghav Kansal
    @rkansal47
    Hi, i was wondering if there's a recommended way of keeping track of errors, e.g. when dividing two hists?
    Henry Schreiner
    @henryiii:matrix.org
    [m]
    I think views handle this correctly (and if not, it's likely a bug 😉) - h.view() / h2.view()
    Raghav Kansal
    @rkansal47
    oh sorry i meant errors as in confidence intervals but i think i found what i was looking for https://hist.readthedocs.io/en/latest/reference/hist.html#module-hist.intervals :)
    Henry Schreiner
    @henryiii
    Hist is now Python 3.7+ only following NEP 29 (3.6 users will still get Hist 2.4)
    Andrzej Novak
    @andrzejnovak
    yay
    Matthew Feickert
    @matthewfeickert
    @henryiii @LovelyBuggies If you have a hist.hist.Hist object that someone else made and serialized to give to you, and upon deserializing realize that the name and label field for the axes has information that should have been put in metadata placed in them (e.g., hist_1.axes[0].name gives wjets instead of something like pt) is there a way to update the name and label in a copy of the histogram? name and label are read only in boost-histogram, so is there any way to get around this other then manually making new histogram objects and filling them with the old histogram contents?
    Henry Schreiner
    @henryiii
    Well, label is easy, it's not read-only. Only name is, because we validate that it doesn't get duplicated inside a histogram. You can set it via a secret method (hist_1.axes[0]._ax.metadata, IIRC), but I've intended to allow it to be set in bulk, that is, hist.axes.name = ("name1", "name2"), as that we can validate. I'll open an issue for that.
    Ethan Simpson
    @ethansimpson285
    Hi there, thanks for the great work on PyHEP histogram infrastructure. Apologies in advance, I feel this is a common question concerning bin errors and ratio plots. My main question is if there is a boost-histogram method to access the bin error, something that does the computation np.sqrt(h.values()))automatically? For generating ratio plots I understand I can use the hist.intervalsmodule, is this the current "best practice"?
    Henry Schreiner
    @henryiii
    np.sqrt(h.variances()) is better (though you need to be a tiny bit careful if the variances is None, which can happen for non-weighted storages if you fill with a weight)
    Ethan Simpson
    @ethansimpson285
    np.sqrt(h.variances()) is None when considering a normalised histogram as computed via h/h.sum(), though the errors are then computable using hist.intervals. Not sure if there's any better way to derive such a normalised histogram...
    Nicholas Smith
    @nsmith-
    I would advocate that hist automatically converts any scalar storage to Weight storage upon scaling, to preserve the unweighted count
    Henry Schreiner
    @henryiii
    Please add that to scikit-hep/boost-histogram#601
    Henry Schreiner
    @henryiii
    Didn’t mean you had to recommend it for division, just that the two things are related, once we start changing storages on operations, that’s something it would open up.
    Nicholas Smith
    @nsmith-
    np just being clear
    Henry Schreiner
    @henryiii
    boost-histogram 1.2.0 is out, with Python 3.10 wheels, histogram subtraction, and several important performance improvements (up to 1000x for picking from huge histograms), and important bug fixes for user reported issues. A couple more known issues should be worked out in the near future, so expect a 1.2.1 eventually, but this is a clear imrovement all around over 1.1.0. :)
    Hist is locked against boost-histogram, so expect a hist release in the near future based on 1.2. :)
    Andrzej Novak
    @andrzejnovak
    Nice
    Henry Schreiner
    @henryiii
    Hist 2.5 is out, built on boost-histogram 1.2, and lots of Stacks improvements, bulk axes name setting, better QuickConstruct, and more.
    Matthew Feickert
    @matthewfeickert
    Woo! :)