NNPDF / eko

Evolution Kernel Operators
https://eko.readthedocs.io
GNU General Public License v3.0
6 stars 2 forks source link

Undocumented usage of banana in the tutorial #169

Closed lukeronger closed 1 year ago

lukeronger commented 1 year ago

I tried to use the EKO package for some tests.

However, these is an issue, which I could not understand, which is shown below:

    from banana.data.theories import default_card as th_card
ModuleNotFoundError: No module named 'banana.data'

Actually I have installed banana successfully, with pip3 install banana. Thanks a lot!

My simple code is shown below:

import eko

from banana.data.theories import default_card as th_card
from ekomark.data.operators import default_card as op_card

# here we replace the grid with a very minimal one, to speed up the example
op_card["interpolation_xgrid"] = [1e-4, 2e-4, 4e-4, 8e-4, 1e-3, 2e-3, 4e-3, 8e-3, 1e-2, 2e-2, 4e-2, 8e-2, 1e-1, 2e-1, 4e-1, 8e-1, 1.]
# let's compute two operators: one reaching up to Q2=100 GeV^2 and a second reaching up to Q2=10000 GeV^2
op_card["Q2grid"] = [10., 100., 1000., 10000.]

evolution_operator = eko.run_dglap(th_card, op_card)

from banana import toy
pdf = toy.mkPDF("", 0)

from ekomark.apply import apply_pdf
evolved_pdfs = apply_pdf(evolution_operator, pdf)

print("key  ",  evolved_pdfs.keys())
#dict_keys([100.0, 10000.0])
print("gluon  ", evolved_pdfs[100.0]["pdfs"][21])
alecandido commented 1 year ago

Follows the reply originally sent by email.


Dear Rong Wang,

I'm very pleased you tried to use our program, and I'm sorry it didn't work out of the box.

Unfortunately, we are still work in progress on some new developments, since we noticed that computing very big operators can rapidly fill your memory. For this reason, I'd suggest to you to use an EKO version in the range 0.8.5 (the one used for the paper) - 0.10.2 (last one not affected by more recent developments). We hope to have a new big release with new features in the next few months (and probably it will be 1.0.0).

Concerning your issue: banana is not required in general to run EKO, since it is the tool we use for internal benchmarking. Nevertheless, EKO requires you to provide complete runcards, no default is applied. In case you're just familiarizing with it, banana has some sensible defaults to get started, even though you should not use as "recommended settings". In case you're in doubt for some parameters values, get in touch with us, and we can suggest the most appropriate to your use case.

Unfortunately, the package banana on PyPI already existed, and not being central for our users we adopted a not so well-known feature of Python packages, and we split the two names. Indeed, Python ecosystem has some "distribution packages", those you find on PyPI and install with pip, and they are different from and may contain multiple "import packages", that are those you import with Python:

https://packaging.python.org/en/latest/overview/#python-source-distributions

So, the distribution package for banana is actually called banana-hep:

https://pypi.org/project/banana-hep/

despite the "import package" being actually called banana.

What you saw in the error was actually generated by Python, that trying to import banana did not find it installed (or maybe found the other one, thus missing some modules, and with different content in general).

I'm sorry for the inconvenient, but in case you want to use banana I suggest to install the specific eko distribution package "extra" (pip slang) dedicated to user interface, called box, by doing:

pip install 'eko[box]'

This will install banana for you :)

In general, I'd suggest to you to open an Issue on our repo to get in touch with us, such that the other developers can reply as well, and it will be useful for other users having similar troubles:

https://github.com/NNPDF/eko/issues

In case you don't feel comfortable with an actual issue, you can get in touch in a slightly more informal way through discussions:

https://github.com/NNPDF/eko/discussions

If you don't mind, I would ask to post this very same issue on the repo (even by simply posting the relevant part of your email), such that I can put the reply there. I believe you won't be the last one, until we fix the documentation.

Best regards, Alessandro Candido


P.S.: Sorry, I edited a bit your post just for formatting.

alecandido commented 1 year ago

@NNPDF/theory the tutorial should be better explained, and if we want to use banana the installation of banana-hep (or equivalently ekobox) should be part of the explanation.

felixhekhorn commented 1 year ago

see #155 - shall we consider this as a duplicate?

alecandido commented 1 year ago

Yes, but this one has a more complete explanation of the issue. Moreover, I would avoid recommending the installation of ekomark to any user, and instead encourage ekobox.

In practice, they are the same set of deps at the moment, but it is important to keep the focus on the UI.

If you agree, I would close #155 as "superseded", event though you are right that this is the actual duplicate.

felixhekhorn commented 1 year ago

@AleCandido as said here banana is mostly gone from the tutorials and where needed it is explicitly mentioned: https://eko.readthedocs.io/en/develop/overview/tutorials/pdf.html (though not correctly formatted) - should we close this?

alecandido commented 1 year ago

I agree.

I expect no one, but in case of further issues, we can reopen this one or a new one.

alecandido commented 1 year ago

@felixhekhorn just a tiny point: the code block is not rendered as such

image

felixhekhorn commented 1 year ago

@felixhekhorn just a tiny point: the code block is not rendered as such

as I said :upside_down_face:

though not correctly formatted

fixed in https://github.com/NNPDF/eko/commit/2bd57b8be58aec219443227c1c22f622d5b5412e