Skip to content

Remove need for _template.yaml#223

Open
evagroenendijk wants to merge 20 commits into
mainfrom
remove_template
Open

Remove need for _template.yaml#223
evagroenendijk wants to merge 20 commits into
mainfrom
remove_template

Conversation

@evagroenendijk
Copy link
Copy Markdown
Contributor

@evagroenendijk evagroenendijk commented May 23, 2025

Remove the need for _template.yaml as in issue #202

@evagroenendijk evagroenendijk self-assigned this May 23, 2025
@evagroenendijk evagroenendijk linked an issue May 23, 2025 that may be closed by this pull request
@felixhekhorn felixhekhorn added the enhancement New feature or request label May 26, 2025
@evagroenendijk
Copy link
Copy Markdown
Contributor Author

https://github.com/NNPDF/pineko/blob/f4097f29dec964e8b2c17818b502575ffa3444f0/tests/test_evolve.py#L55C1-L55C43

@scarlehoff Could I maybe just remove this test? I could make it check that the theory cards' Q0 is the same as the default one, but to me it seems a bit superfluous

@scarlehoff
Copy link
Copy Markdown
Member

Sure, shuffling around the _template and the operators might change which tests are needed.

Copy link
Copy Markdown
Contributor

@felixhekhorn felixhekhorn left a comment

Choose a reason for hiding this comment

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

some quick things I noticed last week

Comment thread src/pineko/template.py Outdated
Comment thread src/pineko/template.py Outdated
@scarlehoff scarlehoff self-requested a review May 19, 2026 12:34
@scarlehoff scarlehoff marked this pull request as ready for review May 19, 2026 12:35
import pytest
from eko.interpolation import XGrid
from eko.io.runcards import OperatorCard
from pineko.evolve import write_operator_card
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is not needed?

Comment thread src/pineko/template.py
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we use a more specific name please? in particular something that has "operator card" or any abbreviation thereof

Comment thread src/pineko/evolve.py
Comment on lines +205 to +217
operators_card["configs"]["ev_op_max_order"] = template.CONSTANTS["configs"][
"ev_op_max_order"
]
operators_card["configs"]["inversion_method"] = template.CONSTANTS["configs"][
"inversion_method"
]
operators_card["configs"]["interpolation_polynomial_degree"] = template.CONSTANTS[
"configs"
]["interpolation_polynomial_degree"]
operators_card["configs"]["interpolation_is_log"] = template.CONSTANTS["configs"][
"interpolation_is_log"
]
operators_card["configs"]["n_integration_cores"] = template.CONSTANTS["configs"]["n_integration_cores"]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

for k in ["ev_op_max_order", "inversion_method"]: # etc
   op_c["c"][k] = t.c["c"][k]

and similar for debug

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your comments @felixhekhorn, I'll change them!

@evagroenendijk
Copy link
Copy Markdown
Contributor Author

@felixhekhorn The regression benchmark comparing convolved predictions failed, but the maximal relative difference is 0.03497747. Would you say it's close enough?

@scarlehoff
Copy link
Copy Markdown
Member

scarlehoff commented May 20, 2026

The template name should be removed from here:

"operator_card_template_name",

also the NEEDED_FILE (and then needs to be removed from scaffold.py)

Copy link
Copy Markdown
Member

@scarlehoff scarlehoff left a comment

Choose a reason for hiding this comment

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

This small of a relative difference is ok I'd say.

Comment thread src/pineko/template.py
Comment on lines +59 to +61
"ev_op_iterations": 60,
"evolution_method": "iterate-exact",
"inversion_method": "expanded",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These should be sourced from the theory card and only from there.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is the inversion method also set in the theory card? I can't find it in the current theory cards

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@felixhekhorn what about the inversion method?
I think for the evolution of the PDF we simply fix

truncated -> expanded
iterate-exact -> exact

Should we fix the same here? Or is this not relevant and we can use expanded in both cases?

Comment thread src/pineko/template.py
"ev_op_max_order": [10, 0],
"interpolation_polynomial_degree": 4,
"interpolation_is_log": True,
"n_integration_cores": 1,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

And this one should come from the command line interface. Different datasets might need different number of cores.

Copy link
Copy Markdown
Member

@scarlehoff scarlehoff left a comment

Choose a reason for hiding this comment

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

I meant to request changes 😅

@felixhekhorn
Copy link
Copy Markdown
Contributor

@felixhekhorn The regression benchmark comparing convolved predictions failed, but the maximal relative difference is 0.03497747. Would you say it's close enough?

I'm quite worried by this

Your theory has a different evolution method than the default(iterate-exact vs truncated).The evolution method will be set to the default value iterate-exact, check if this is what you want
Warning! The number of iteration in the theory and template is different, (60 vs 1).The number of iterations will be set to default value 60, check if this is what you want

this sounds like we can no longer run actually truncated - i.e. we can no longer reproduce 4.0. If that would be true that must be changed. This might well explain the difference we observe. We want to enforce consistent settings, i.e. "if method=truncated then iterations=1", but we don't want to enforce method=exact everywhere.

@scarlehoff
Copy link
Copy Markdown
Member

This has to do with the comment I left. We just want to ensure that the evolution settings are coming from the theory not from a constant setting.

@evagroenendijk
Copy link
Copy Markdown
Contributor Author

@felixhekhorn The regression benchmark comparing convolved predictions failed, but the maximal relative difference is 0.03497747. Would you say it's close enough?

I'm quite worried by this

Your theory has a different evolution method than the default(iterate-exact vs truncated).The evolution method will be set to the default value iterate-exact, check if this is what you want
Warning! The number of iteration in the theory and template is different, (60 vs 1).The number of iterations will be set to default value 60, check if this is what you want

this sounds like we can no longer run actually truncated - i.e. we can no longer reproduce 4.0. If that would be true that must be changed. This might well explain the difference we observe. We want to enforce consistent settings, i.e. "if method=truncated then iterations=1", but we don't want to enforce method=exact everywhere.

You're right! I think here I ran the benchmark while using iterate-exact (which I hardcoded into template.py). But as Juan suggested I will now let the evolution method be totally determined by the theory card. Then it would also do truncated evolution

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.

Remove operator_cards (and _template.yaml)

3 participants