tpgillam / mt2

Stransverse mass computation, compatible with numpy.
MIT License
4 stars 3 forks source link

A fancy 2D example. #23

Closed kesterlester closed 3 years ago

kesterlester commented 3 years ago

Tom may wish to remove dependence on lester hist and/or re-organise where this sits in the package. out.pdf out

kesterlester commented 3 years ago

Note that if Tom wanted to, this is an example that is ripe for distributing over the 101 chi values I used for each event. If so modified, however, I'd be tempted to suggest that the naive way I've done it here is presented in addition to any fancy numpy ways of doing the same thing, not only instead of it, to accommodate simple users like me!

tpgillam commented 3 years ago

This looks awesome, thanks! I will rewrite in terms of numpy.

I'm against retaining a non-numpy based version though. There are plenty of better resources already available to teach people how to use numpy & why vectorisation is preferable (i.e. avoiding python function calls). The README will show the basic approach without numpy, which IMO is sufficient - what do you think?

tpgillam commented 3 years ago

I'll merge this as-is for now though - will change to use matplotlib and may also change location of image, and include it in README.

kesterlester commented 3 years ago

This looks awesome, thanks! I will rewrite in terms of numpy.

I'm against retaining a non-numpy based version though. There are plenty of better resources already available to teach people how to use numpy & why vectorisation is preferable (i.e. avoiding python function calls). The README will show the basic approach without numpy, which IMO is sufficient - what do you think?

I was not thinking of this example serving to teach people how to use numpy. I completely agree with you that there are better resources for that.I had the reverse in mind: trying to ensure that there are examples which show what MT2 is doing simply. Here, the kink plot was always hard to explain at the best of times (in 2014) and so presenting at least one simple version of it that shows a very boring (but easy to understand) loop of chi values is very easy for a simpleton to understand. So my point was intended to be "keep something simple in there so that someone who is physics focussed (not computing processed) has the lowest impediment to understanding what the kink program is actyally doing, as that is beneficial from a physics educational perspecive". Quite separately to that is another (good) objective, which is showing people that the package works nicely with numpy vectorisation -- so if you wanted to add examples of that, that woudl be good too. But (at least to my mind) it doesn't remove the (different) physics benefits of the former.

tpgillam commented 3 years ago

Ah, I see - my assumption going into this was that an example would be purely to show the computation aspect of MT2, and that your papers would serve as documentation & an introduction to what it meant conceptually.

I'll have a think when I get around to refactoring. Honestly the hope is that with the vectorised version the code should be just as easy to read, just faster.