Hardcode theories needed for scale variations#664
Conversation
…th scale variations
RosalynLP
left a comment
There was a problem hiding this comment.
This looks good, when we merge we should update the docs with the new runcard layout and point prescription flags.
wilsonmr
left a comment
There was a problem hiding this comment.
looks good to me, just update the docs as Rosalyn mentioned
|
I think the relation that needs to be stored is which theory is a scale variation of which other rather than how to do the point prescription for a specific theory. The format could be something like scale_variations_for:
- theoryid: 163
variations:
- scales: {"muF": '0.5', "muR": "1'"}
theoryid: <some id> #This is likely wrongGiven the above, one can compute e.g. point prescriptions for any theory that has the required variations without having to write a hard to debug code like the one in this PR. It would be nice if the specification was in a yaml file, a bit like it is done in the filters. Alternatively it could be a bunch of tables in the theorydb, but at some point we said we will move away from that due to it being unfriendly to git (but then didn't act on it...). |
|
I don't understand the benefit of your suggestion. Why would the user want to have multiple point prescriptions for a given theory and scale choice? At the end of the day, the user will want to use some specific point prescription for a certain theory set-up (hence the central theoryid). Surely then specifying only the point prescription and the central theory is the simplest thing to do? Also, I don't see how this would prevent the code being hard to debug - right now the code depends on you giving the theoryids in a particular order, but that would be the case with your suggestion too, no? |
If we lived in an universe where NNLO scale variations would ever happen, you would have to specify which are the scale variations for theory 53 (or whatever), which is straight forward and easily machine checked. You can also reuse the same specifications for things that are not point prescriptions, such as mcscales.
You don't have to find meaning in the formula of point prescriptions every time. You can write it once in terms of scale multipliers and have that work for arbitrary theories. Instead it is easy enough to check that a given scale varied theory has the right multipliers. |
|
I'm confused. Can you please write |
|
Surely there can be both? So if I understand Zahari correctly: we currently only have full scale varies theories for NLO right? So in that sense 5 point does mean: However what would be great is first of all if we have some base theory - in this case theory 163 we have all of the associated scale varied theories stored in a yaml file somewhere sensible EDIT: clearly this is nothing to do with point prescription but is just a useful way of associating other theories with 163 so on so on... Then one could even also store point presciptions, but in word format: or whatever they are. Then it's easier to see qualitatively what the point prescription was supposed to be combining and if there is a mistake then it was in the labelling of the theory. Also it extends to the future when you have: I don't know if I have misunderstood but it seems like both your ideas could be beneficial and not mutual exclusive.. |
|
Yeah, it is exactly what @wilsonmr says. I don't have a strong opinion as to whether there should be a yaml file specifing the point prescriptions or these should be directly hardcoded in python in a way that they work for any set of scale variations. In any case, it will be much easier for someone to discover what the point prescriptions do if they are expressed in terms of the variations rather than some convention of indexes in a list. |
|
@scarrazza Yes, it's on my to do list |
|
Where would be the best place to store the yaml file the hardcodes the theory-scales correspondence? Are you happy with validphys/theorycovariance for the moment? |
|
Also, @wilsonmr why did you suggest having the point prescription-scales correspondence in text rather than yaml? |
|
@voisey the yaml setup should be modelled after the filters. See in particular https://github.com/NNPDF/nnpdf/tree/master/validphys2/src/validphys/cuts nnpdf/validphys2/src/validphys/filters.py Line 10 in 172748c nnpdf/validphys2/src/validphys/filters.py Line 38 in 172748c |
No no it's still a yaml file, I mean word format as opposed to a list of numbers |
|
Yep, understood! |
…and point prescription-scale variation correspondence
…red point prescription instead of defining them in the production rule
|
does this definitely install the new files you added? I seem to remember that when you add new files in a new directory you might have to update setup.py around this part: Line 42 in 7eb1089 because you're using a development installation, the code is looking at your git repo and finding these files, but when the corresponding conda package is installed, setup doesn't know that it needs to copy these files across unless you explicitly tell it to there. |
|
@wilsonmr Thanks for pointing that out too! I've implemented the changes you wanted |
|
This looks fine. It could use some documentation at this point. |
|
@Zaharid, regarding #664 (comment), what does "use this somewhere" mean? And by the latter bit, do you mean we should have a test that the yaml files I created exist/can be opened? |
| @@ -0,0 +1,15 @@ | |||
| # IMPORTANT: scale combinations must be listed according to (muF, muR) in the following order: | |||
| # (1,1), (2,1), (0.5,1), (1,2), (1,0.5), (2,2), (0.5,0.5), (2,0.5), (0.5,2) | |||
There was a problem hiding this comment.
Could we get away without requiring this? We should have enough information with the scales dictionary.
There was a problem hiding this comment.
@Zaharid @RosalynLP Let me know what you think about this comment. As I understand it, with all runcards involving the theory covmat in the past, one would have to specify a list of theoryids in a particular order, otherwise one would get nonsense results. All this PR does is to hardcode the mapping between point prescriptions and scale combinations, and then scale combinations and theoryids, such that the user can specify a central theoryid and point prescription and get a list of theoryids in the correct order returned. The correct order is set in one of the yaml files (pointprescriptions.yaml), in which things are hardcoded. I would argue that this isn't too bad, considering it's not everyday that someone will define a new point prescription, so I don't think that file will be touched very much
| variations = [ | ||
| i['variations'] for i in scalevarsfor_list if i['theoryid'] == int(th) | ||
| ][0] | ||
| thids = [j['theoryid'] for i in scales for j in variations if i == j['scales']] |
There was a problem hiding this comment.
Also here, it seems it would be quite a bit clearer to build a dict indexed by a tuple of two scale multipliers and index with that.
Furthermore we probably want an error message if we are missing a certain theory in scalevariationtheoryids.yaml that is required for some point prescription. E.g. we may have only those theory for 3 point for a while.
There was a problem hiding this comment.
FYI I've now tried to address both of these points
|
Never mind. I found my question answered! |
…ault 7 point are the same as for the original version
… incorporate this in config.py
…ke variations a dictionary rather than a list in scalevariationtheoryids.yaml, and update config.yaml accordingly
…ted for a given central theoryid and the users wants to use one that is not implemented. Also, change notation of scale multipliers from muF and muR to k_F and k_R.
|
It looks like the build is failing because it can't find yaml... https://travis-ci.com/github/NNPDF/nnpdf/jobs/320040651#L43119 |
| import numbers | ||
| import copy | ||
| import os | ||
| import yaml |
There was a problem hiding this comment.
I think you should do from reportengine.compat import yaml no?
There was a problem hiding this comment.
Thanks Mikey! Didn't realise this
There was a problem hiding this comment.
yeah I'm not sure it's documented anywhere or if that solves the problem but everywhere else in the code does it like that :P
|
This now passes on Linux but not on Mac because of a timeout (quelle surprise). What's our official policy on this now? Is this okay? |
|
Having merged #725 both builds now pass |
|
@voisey I took a look at this again and think it looks good and that we do need to keep the order of the scale variations as specified because this ensures that when we collect |
|
Thanks for checking this @RosalynLP. Are you happy with this @Zaharid? |
Aims to close #454.
This is still a WIP because among other things the docs need to be updated, but I'll do this once we have settled on the code.
A runcard that worked with the old set up is this:
whereas now we can have something like this:
where you get an error if you try to use a point_prescription without 163 as the
theoryidand there are five allowed point_prescriptions: '3 point', '5 point', '5bar point', '7 point', '7 point (original)' and '9 point'. Also, note that the first runcard will still work with the new set up.Let me know what you think. I was also wondering whether it would it be sensible for us to change it so the user no longer has to explicitly define what the
default_theoryis, but rather this is hardcoded too?