Remove need for _template.yaml#223
Conversation
|
@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 |
|
Sure, shuffling around the _template and the operators might change which tests are needed. |
felixhekhorn
left a comment
There was a problem hiding this comment.
some quick things I noticed last week
Co-authored-by: Felix Hekhorn <felixhekhorn@users.noreply.github.com>
Co-authored-by: Felix Hekhorn <felixhekhorn@users.noreply.github.com>
|
@felixhekhorn The regression benchmark comparing convolved predictions failed, but the maximal relative difference is 0.03497747. Would you say it's close enough? |
|
The template name should be removed from here: Line 19 in 89304e2 also the |
scarlehoff
left a comment
There was a problem hiding this comment.
This small of a relative difference is ok I'd say.
| "ev_op_iterations": 60, | ||
| "evolution_method": "iterate-exact", | ||
| "inversion_method": "expanded", |
There was a problem hiding this comment.
These should be sourced from the theory card and only from there.
There was a problem hiding this comment.
Is the inversion method also set in the theory card? I can't find it in the current theory cards
There was a problem hiding this comment.
@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?
There was a problem hiding this comment.
For now I put
if "inversion_method" in tcard:
opconf = operators_card["configs"]
opconf["inversion_method"] = tcard["inversion_method"]
else:
opconf["inversion_method"] = opcard_template.CONSTANTS["configs"]["inversion_method"]
logger.warning(
"Inversion method not set in theory card, it's being set to default value "
f"{opcard_template.CONSTANTS['configs']['inversion_method']}. "
"Check if that is what you want."
)
But I can change it
There was a problem hiding this comment.
Let's see what Felix says.
Fwiw, in python this can be shortened to:
opconf["inversion_method"] = tcard.get("inversion_method", opcard_template.CONSTANTS["configs"]["inversion_method"])(also because I think right now you are overwritting the whole of opconf with `operator_card["configs"] I think, is that what you want?)
If the inversion method is irrelevant and can be set constant, I think the warning is not necessary.
There was a problem hiding this comment.
truncated -> expanded
iterate-exact -> exact
this is a choice which seems consistent, but is not necessary. I think we can assume this mapping as default here
There was a problem hiding this comment.
Okay, I'll change it to that then!
scarlehoff
left a comment
There was a problem hiding this comment.
I meant to request changes 😅
I'm quite worried by this
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. |
|
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. |
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 |
| "fktables", | ||
| "ekos", | ||
| ] | ||
| NEEDED_FILES = [] |
There was a problem hiding this comment.
I think this can be removed entirely?
There was a problem hiding this comment.
At first I did that, but then I thought it would be useful to leave it in case at any point there is another adjustment to the code that needs some files. It's what I thought, but let me know if you think differently
There was a problem hiding this comment.
I would remove unnecessary code and then re-add it if needed given past experiences with having a very big graveyard of code
| @@ -266,14 +266,15 @@ | |||
|
|
|||
| # Choose the evolution method according to the theory if the key is included | |||
| if "ModEv" in tcard: | |||
There was a problem hiding this comment.
I'm a friend of early exits in code, since they safe indents - thus I suggests
if "ModEv" not in tcard:
raise ValueError("blub")
# no explicit `else` needed nor the associated indentationsame for "IterEv" I would say
| if ( | ||
| operators_card["configs"]["evolution_method"] == "truncated" | ||
| and operators_card["configs"]["ev_op_iterations"] > 1 | ||
| ): | ||
| logger.warning( | ||
| "Warning! You are setting evolution_method=truncated with ev_op_iterations>1," | ||
| "are you sure that's what you want?" | ||
| ) |
There was a problem hiding this comment.
I think this can never happen now with this structure
| opconf["ev_op_iterations"] = 1 | ||
| operators_card["configs"]["evolution_method"] = "truncated" | ||
| operators_card["configs"]["ev_op_iterations"] = 1 | ||
| operators_card["configs"]["inversion_method"] = "expanded" |
There was a problem hiding this comment.
Can you maybe add a # TODO there saying something like "we impose a default now, but we may at later point allow the user to choose (e.g. via CLI)"
There was a problem hiding this comment.
It's now already possible to determine these from the CLI (when doing "pineko theory opcards ..." and when doing "pineko opcard ... ")
edit: ah no, I'm sorry I was confused and talking about the other settings! I can add the to do
Remove the need for _template.yaml as in issue #202