Skip to content
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

Move permanent part of fkutils here #12

Merged
merged 37 commits into from
Mar 29, 2022
Merged

Move permanent part of fkutils here #12

merged 37 commits into from
Mar 29, 2022

Conversation

felixhekhorn
Copy link
Contributor

@felixhekhorn felixhekhorn commented Mar 1, 2022

This PR should have really started at 6d93747

  • log time taken for each expensive operation

@felixhekhorn felixhekhorn added the enhancement New feature or request label Mar 1, 2022
Copy link
Member

@alecandido alecandido left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improve CLI, please :)

src/pineko/cli/theory_ekos.py Outdated Show resolved Hide resolved
src/pineko/cli/theory_fks.py Outdated Show resolved Hide resolved
src/pineko/cli/theory_opcards.py Outdated Show resolved Hide resolved
src/pineko/configs.py Outdated Show resolved Hide resolved
@felixhekhorn
Copy link
Contributor Author

I wonder whether to change here:
https://github.com/N3PDF/pineko/blob/784dee8e4a016fc033461fe9ac4e21d1ead67294/src/pineko/configs.py#L79-L83

and add a else after the if, because otherwise you get something like this:

$ pineko -c /home/a.toml theory opcards 213 LHCB_Z_13TEV_DIELECTRON
Configurations loaded from '/home/a.toml'
Analyze LHCB_Z_13TEV_DIELECTRON
Success: Wrote card with 1 Q2 points to 
/home/felix/Physik/N3PDF/FK/pineko/data/operator_cards/LHCB_DY_13TEV_DIELECTRON.yaml

where /home/a.toml never existed and the config truely used the default one

@alecandido
Copy link
Member

Don't change detect: if you don't like this behavior, you should change load

https://github.com/N3PDF/pineko/blob/784dee8e4a016fc033461fe9ac4e21d1ead67294/src/pineko/configs.py#L101-L102

or even change where it's used:

https://github.com/N3PDF/pineko/blob/784dee8e4a016fc033461fe9ac4e21d1ead67294/src/pineko/cli/_base.py#L20-L24

Indeed, detect is already passing all the information: since it no one existed, it's even raising an error, that is later caught by load. So, detect has done its job.

I'd suggest not to call detect directly inside load, but to pass the detect result as load argument.
Consequently, the exception management should not be done inside load, but inside command, and so you can decide to print a different message, or even to just fail, and keep propagating the exception.

@felixhekhorn
Copy link
Contributor Author

I attempted an improvement on configs in 3a53e56 , but there are still things with which I'm not happy:

  • what is add_scope supposed to do?
  • with the changes there, the script at least is no longer lying, i.e. it is telling the file it really used - but it is only doing so if one explicitly used the -c flag; that seems inconsistent ...
  • furthermore the -c flag is not doing, what is promising: "Explicitly specify config file (it has to be a valid TOML file)."
    • first, it does not need to be a file, also a path would go through
    • and it should really do what it says, which it isn't: i.e. if you specify this flag you should read exactly that file (which would correspond to the else I mentioned) - the current implementation is rather adding another possibility
  • I dropped the return {"paths": {"root": pathlib.Path.cwd()}} because it would result in a ValueError right after as I have some mandatory configs
  • (also (now called) enhance_paths was inconsistent as it was modifying inplace and returning ...)
  • (finally I also added more docs)

@alecandido
Copy link
Member

  • what is add_scope supposed to do?

It's a function I'm using in runcardsrunner corresponding instance, to add defaults for an entire section, but preserving values that have explicitly been specified.

(which would correspond to the else I mentioned)

This is false: the else would correspond to the case in which no path is specified. In that case either you return an error or you adopt some defaults. What is happening there is that you attempt a few sensible defaults, and if even those are not working, then raise.

  • first, it does not need to be a file, also a path would go through

What's the difference between a path and a file? On CLI you can only write strings, i.e. paths...

  • I dropped the return {"paths": {"root": pathlib.Path.cwd()}} because it would result in a ValueError right after as I have some mandatory configs

This is fine, I've defaults for everything in runcardsrunner, but it's more of a choice.

  • (finally I also added more docs)

Always a good idea.

src/pineko/theory.py Outdated Show resolved Hide resolved
@felixhekhorn
Copy link
Contributor Author

@alecandido @scarlehoff @cschwan @andreab1997

Dear all,

@cschwan
Copy link
Contributor

cschwan commented Mar 16, 2022

@felixhekhorn cheers, I already had a quick look at the README, see my comments and edits there.

@felixhekhorn
Copy link
Contributor Author

@enocera of course I should have tagged you as well - apologies ;-) please feel free to take a look

Copy link
Member

@alecandido alecandido left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still have to dig pineko.evolve and pineko.theory, but everything else it's good enough.

I left a few comments, mainly about code I suppose to be not needed, and I suggest to just drop.

.pylintrc Outdated Show resolved Hide resolved
_run.py Outdated Show resolved Hide resolved
data/grids/load.sh Show resolved Hide resolved
src/pineko/__main__.py Outdated Show resolved Hide resolved
src/pineko/parser.py Outdated Show resolved Hide resolved
@scarlehoff
Copy link
Member

Once this is merged and a package created I can try and use it in vp.

This was linked to issues Mar 24, 2022
@alecandido alecandido mentioned this pull request Mar 24, 2022
@scarlehoff
Copy link
Member

I'm going to merge this if nobody complains.

@felixhekhorn
Copy link
Contributor Author

I opened #13 and #14 for the remaining problems (SV is tracked in #6)

@scarlehoff
Copy link
Member

Then I can merge, right? As soon as we merge we can tackle the different issues one by one.

@felixhekhorn
Copy link
Contributor Author

For future reference: a bin-by-bin-evolution (as needed for jets) is still possible if needed after NNPDF/eko#105 , but this time I would rather hack outside pineko then inside: we could define a bunch of fake-datasets: CMS_1JET_8TEV-bin00000 containing exactly one member which itself contains exactly one bin /cc @cschwan

@scarlehoff scarlehoff merged commit 6cc0adc into main Mar 29, 2022
@cschwan
Copy link
Contributor

cschwan commented Mar 29, 2022

@felixhekhorn would it make sense to support this as a 'mode' in Pineko? It would exactly do what you descibe: 1) chop the grid into single bins, 2) evolve each bin and finally 3) merge all evolved bins together again.

@alecandido alecandido deleted the fkutils-move branch March 30, 2022 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dump FK Table comparison Configuration database(s)
4 participants