From 99fcc039ef1248fc2cde44bdb3c142b784348c4a Mon Sep 17 00:00:00 2001 From: Cameron Voisey Date: Tue, 25 Feb 2020 12:39:36 +0000 Subject: [PATCH 01/20] Add production rule to return list of theoryids needed for working with scale variations --- validphys2/src/validphys/config.py | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/validphys2/src/validphys/config.py b/validphys2/src/validphys/config.py index 05242c22e5..a6fc5c230c 100644 --- a/validphys2/src/validphys/config.py +++ b/validphys2/src/validphys/config.py @@ -960,6 +960,39 @@ def produce_defaults(self, q2min=None, w2min=None, filter_defaults={}): return filter_defaults + # To do: this should be updated once we have lock files + def produce_scale_variation_theories(self, theoryid, point_prescription): + """Produces a list of theoryids given a theoryid at central scales and a point + prescription. The options for the latter are '3 point', '5 point', '5bar point', '7 point', + '7 point (original)' and '9 point'. Note that these are defined in arXiv:1906.10698. This + hard codes the theories needed for each prescription to avoid user error.""" + from reportengine.namespaces import NSList + pp = point_prescription + if theoryid.id != '163': + raise ConfigError("Scale variations are not currently defined for this central " + + "theoryid. It is currently only possible to use theoryid 163 as the central " + + "theory. Please use this instead if you wish to include theory uncertainties here.") + theoryids = [] + if pp == '3 point': + thids = [163, 180, 173] + elif pp == '5 point': + thids = [163, 177, 176, 179, 174] + elif pp == '5bar point': + thids = [163, 180, 173, 175, 178] + elif pp == '7 point' or pp == '7 point (original)': + thids = [163, 177, 176, 179, 174, 180, 173] + elif pp == '9 point': + thids = [163, 177, 176, 179, 174, 180, 173, 175, 178] + else: + raise ConfigError("Scale variations are not currently defined for this point " + + "prescription. This configuration only works when 'point prescription' is equal " + + "to one of '3 point', '5 point', '5bar point', '7 point' or '9 point'. Please " + + "use of of these instead if you wish to include theory uncertainties here.") + for thid in thids: + theoryids.append(self.loader.check_theoryID(thid)) + # NSList needs to be used for theoryids to be recognised as a namespace + return {'theoryids': NSList(theoryids, nskey='theoryid')} + class Config(report.Config, CoreConfig, ParamfitsConfig): """The effective configuration parser class.""" From a2a4f846855c5fd3041ab9295deaa4d557967c9d Mon Sep 17 00:00:00 2001 From: voisey Date: Tue, 25 Feb 2020 14:32:29 +0000 Subject: [PATCH 02/20] Import NSList at top of file --- validphys2/src/validphys/config.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/validphys2/src/validphys/config.py b/validphys2/src/validphys/config.py index a6fc5c230c..960163d3e7 100644 --- a/validphys2/src/validphys/config.py +++ b/validphys2/src/validphys/config.py @@ -19,6 +19,7 @@ from reportengine.environment import Environment, EnvironmentError_ from reportengine.configparser import ConfigError, element_of, _parse_func from reportengine.helputils import get_parser_type +from reportengine.namespaces import NSList from reportengine import report from validphys.core import (ExperimentSpec, DataSetInput, ExperimentInput, @@ -821,7 +822,6 @@ def produce_fit_data_groupby_experiment(self, fit): key in the plotting info file. """ #TODO: consider this an implimentation detail - from reportengine.namespaces import NSList with self.set_context(ns=self._curr_ns.new_child({'fit':fit})): _, experiments = self.parse_from_('fit', 'experiments', write=False) @@ -966,7 +966,6 @@ def produce_scale_variation_theories(self, theoryid, point_prescription): prescription. The options for the latter are '3 point', '5 point', '5bar point', '7 point', '7 point (original)' and '9 point'. Note that these are defined in arXiv:1906.10698. This hard codes the theories needed for each prescription to avoid user error.""" - from reportengine.namespaces import NSList pp = point_prescription if theoryid.id != '163': raise ConfigError("Scale variations are not currently defined for this central " From 54fba157f676e5b590817f8c986e34f1abfadd35 Mon Sep 17 00:00:00 2001 From: Cameron Voisey Date: Thu, 2 Apr 2020 12:26:04 +0100 Subject: [PATCH 03/20] Add files containing info on scale variation-theoryid correspondence and point prescription-scale variation correspondence --- .../src/validphys/scalevariations/__init__.py | 0 .../scalevariations/pointprescriptions.yaml | 13 ++++++++++++ .../scalevariationtheoryids.yaml | 21 +++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 validphys2/src/validphys/scalevariations/__init__.py create mode 100644 validphys2/src/validphys/scalevariations/pointprescriptions.yaml create mode 100644 validphys2/src/validphys/scalevariations/scalevariationtheoryids.yaml diff --git a/validphys2/src/validphys/scalevariations/__init__.py b/validphys2/src/validphys/scalevariations/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/validphys2/src/validphys/scalevariations/pointprescriptions.yaml b/validphys2/src/validphys/scalevariations/pointprescriptions.yaml new file mode 100644 index 0000000000..c409df7f98 --- /dev/null +++ b/validphys2/src/validphys/scalevariations/pointprescriptions.yaml @@ -0,0 +1,13 @@ +point_prescriptions: + - name: '3 point' + scales: [{'muF': '1', 'muR': '1'}, {'muF': '2', 'muR': '2'}, {'muF': '0.5', 'muR': '0.5'}] + - name: '5 point' + scales: [{'muF': '1', 'muR': '1'}, {'muF': '2', 'muR': '1'}, {'muF': '0.5', 'muR': '1'}, {'muF': '1', 'muR': '2'}, {'muF': '1', 'muR': '0.5'}] + - name: '5bar point' + scales: [{'muF': '1', 'muR': '1'}, {'muF': '2', 'muR': '2'}, {'muF': '0.5', 'muR': '0.5'}, {'muF': '2', 'muR': '0.5'}, {'muF': '0.5', 'muR': '2'}] + - name: '7 point' + scales: [{'muF': '1', 'muR': '1'}, {'muF': '2', 'muR': '1'}, {'muF': '0.5', 'muR': '1'}, {'muF': '1', 'muR': '2'}, {'muF': '1', 'muR': '0.5'}, {'muF': '2', 'muR': '2'}, {'muF': '0.5', 'muR': '0.5'}] + - name: '7 point (original)' + scales: [{'muF': '1', 'muR': '1'}, {'muF': '2', 'muR': '1'}, {'muF': '0.5', 'muR': '1'}, {'muF': '1', 'muR': '2'}, {'muF': '1', 'muR': '0.5'}, {'muF': '2', 'muR': '2'}, {'muF': '0.5', 'muR': '0.5'}] + - name: '9 point' + scales: [{'muF': '1', 'muR': '1'}, {'muF': '2', 'muR': '1'}, {'muF': '0.5', 'muR': '1'}, {'muF': '1', 'muR': '2'}, {'muF': '1', 'muR': '0.5'}, {'muF': '2', 'muR': '2'}, {'muF': '0.5', 'muR': '0.5'}, {'muF': '2', 'muR': '0.5'}, {'muF': '0.5', 'muR': '2'}] diff --git a/validphys2/src/validphys/scalevariations/scalevariationtheoryids.yaml b/validphys2/src/validphys/scalevariations/scalevariationtheoryids.yaml new file mode 100644 index 0000000000..87d44730c6 --- /dev/null +++ b/validphys2/src/validphys/scalevariations/scalevariationtheoryids.yaml @@ -0,0 +1,21 @@ +scale_variations_for: + - theoryid: 163 + variations: + - scales: {'muF': '0.5', 'muR': '0.5'} + theoryid: 173 + - scales: {'muF': '0.5', 'muR': '1'} + theoryid: 176 + - scales: {'muF': '0.5', 'muR': '2'} + theoryid: 178 + - scales: {'muF': '1', 'muR': '0.5'} + theoryid: 174 + - scales: {'muF': '1', 'muR': '1'} + theoryid: 163 + - scales: {'muF': '1', 'muR': '2'} + theoryid: 179 + - scales: {'muF': '2', 'muR': '0.5'} + theoryid: 175 + - scales: {'muF': '2', 'muR': '1'} + theoryid: 177 + - scales: {'muF': '2', 'muR': '2'} + theoryid: 180 From a7693f9b2318a3c477663507a9202080dadd540b Mon Sep 17 00:00:00 2001 From: Cameron Voisey Date: Thu, 2 Apr 2020 13:16:45 +0100 Subject: [PATCH 04/20] Use hard coded yaml files to find theoryids corresponding to the desired point prescription instead of defining them in the production rule --- validphys2/src/validphys/config.py | 63 +++++++++++++++++++----------- 1 file changed, 40 insertions(+), 23 deletions(-) diff --git a/validphys2/src/validphys/config.py b/validphys2/src/validphys/config.py index 960163d3e7..75da1b81c0 100644 --- a/validphys2/src/validphys/config.py +++ b/validphys2/src/validphys/config.py @@ -11,6 +11,8 @@ import numbers import copy import os +import yaml +from importlib.resources import read_text from collections import ChainMap from collections.abc import Mapping, Sequence @@ -33,6 +35,8 @@ from validphys.theorycovariance.theorycovarianceutils import process_lookup from validphys.plotoptions import get_info +import validphys.scalevariations + log = logging.getLogger(__name__) class Environment(Environment): @@ -960,35 +964,48 @@ def produce_defaults(self, q2min=None, w2min=None, filter_defaults={}): return filter_defaults - # To do: this should be updated once we have lock files def produce_scale_variation_theories(self, theoryid, point_prescription): """Produces a list of theoryids given a theoryid at central scales and a point prescription. The options for the latter are '3 point', '5 point', '5bar point', '7 point', '7 point (original)' and '9 point'. Note that these are defined in arXiv:1906.10698. This hard codes the theories needed for each prescription to avoid user error.""" pp = point_prescription - if theoryid.id != '163': - raise ConfigError("Scale variations are not currently defined for this central " - + "theoryid. It is currently only possible to use theoryid 163 as the central " - + "theory. Please use this instead if you wish to include theory uncertainties here.") - theoryids = [] - if pp == '3 point': - thids = [163, 180, 173] - elif pp == '5 point': - thids = [163, 177, 176, 179, 174] - elif pp == '5bar point': - thids = [163, 180, 173, 175, 178] - elif pp == '7 point' or pp == '7 point (original)': - thids = [163, 177, 176, 179, 174, 180, 173] - elif pp == '9 point': - thids = [163, 177, 176, 179, 174, 180, 173, 175, 178] - else: - raise ConfigError("Scale variations are not currently defined for this point " - + "prescription. This configuration only works when 'point prescription' is equal " - + "to one of '3 point', '5 point', '5bar point', '7 point' or '9 point'. Please " - + "use of of these instead if you wish to include theory uncertainties here.") - for thid in thids: - theoryids.append(self.loader.check_theoryID(thid)) + th = theoryid.id + if th != '163': + raise ConfigError( + "Scale variations are not currently defined for this central theoryid. It is " + + "currently only possible to use theoryid 163 as the central theory. Please use " + + "this instead if you wish to include theory uncertainties here." + ) + + # Find scales that correspond to this point prescription + lpp = yaml.safe_load( + read_text(validphys.scalevariations, "pointprescriptions.yaml") + ) + pp_scales_list = lpp['point_prescriptions'] + try: + scales = [i['scales'] for i in pp_scales_list if i['name'] == pp][0] + except: + raise ConfigError( + "Scale variations are not currently defined for this point prescription. This " + + "configuration only works when 'point_prescription' is equal to one of " + + "'3 point', '5 point', '5bar point', '7 point', '7 point (original)' or " + + "'9 point'. Please use one of these instead if you wish to include theory " + + "uncertainties here." + ) + + # Find theoryids for given point prescription for given central theoryid + lsv = yaml.safe_load( + read_text(validphys.scalevariations, "scalevariationtheoryids.yaml") + ) + scalevarsfor_list = lsv['scale_variations_for'] + 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']] + + # Check each theory is loaded + theoryids = [self.loader.check_theoryID(thid) for thid in thids] # NSList needs to be used for theoryids to be recognised as a namespace return {'theoryids': NSList(theoryids, nskey='theoryid')} From 91f7f1391df54c0eaa2549f30c79488a19dcf44b Mon Sep 17 00:00:00 2001 From: Cameron Voisey Date: Thu, 2 Apr 2020 16:24:12 +0100 Subject: [PATCH 05/20] Except IndexError --- validphys2/src/validphys/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validphys2/src/validphys/config.py b/validphys2/src/validphys/config.py index 75da1b81c0..9472636f8a 100644 --- a/validphys2/src/validphys/config.py +++ b/validphys2/src/validphys/config.py @@ -985,7 +985,7 @@ def produce_scale_variation_theories(self, theoryid, point_prescription): pp_scales_list = lpp['point_prescriptions'] try: scales = [i['scales'] for i in pp_scales_list if i['name'] == pp][0] - except: + except IndexError: raise ConfigError( "Scale variations are not currently defined for this point prescription. This " + "configuration only works when 'point_prescription' is equal to one of " From 0ec708265e17d31d714405a2fa23e94fa50c9dc0 Mon Sep 17 00:00:00 2001 From: Cameron Voisey Date: Thu, 2 Apr 2020 16:36:19 +0100 Subject: [PATCH 06/20] Add new files to setup.py --- validphys2/setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/validphys2/setup.py b/validphys2/setup.py index f33be9d74b..35d94bf55b 100644 --- a/validphys2/setup.py +++ b/validphys2/setup.py @@ -39,6 +39,7 @@ 'comparefit': ['*'], 'tests/baseline': ['*'], 'cuts': ['*'], + 'scalevariations': ['*'], }, zip_safe = False, classifiers=[ From 1fa10d286e926074e9b2b42c84e6c8eca06d6b0f Mon Sep 17 00:00:00 2001 From: Cameron Voisey Date: Wed, 8 Apr 2020 10:23:38 +0100 Subject: [PATCH 07/20] Add comment about defining new point prescriptions --- .../src/validphys/scalevariations/pointprescriptions.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/validphys2/src/validphys/scalevariations/pointprescriptions.yaml b/validphys2/src/validphys/scalevariations/pointprescriptions.yaml index c409df7f98..0c24b28383 100644 --- a/validphys2/src/validphys/scalevariations/pointprescriptions.yaml +++ b/validphys2/src/validphys/scalevariations/pointprescriptions.yaml @@ -1,3 +1,5 @@ +# 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) point_prescriptions: - name: '3 point' scales: [{'muF': '1', 'muR': '1'}, {'muF': '2', 'muR': '2'}, {'muF': '0.5', 'muR': '0.5'}] From c7bdbf2732517a0237ebe63e3a7147416548367b Mon Sep 17 00:00:00 2001 From: Cameron Voisey Date: Wed, 8 Apr 2020 14:24:45 +0100 Subject: [PATCH 08/20] Update theorycovariance docs --- doc/sphinx/source/vp/theorycov/examples.rst | 31 +++++++------------ .../source/vp/theorycov/point_prescrip.rst | 11 ------- .../source/vp/theorycov/runcard_layout.rst | 14 --------- doc/sphinx/source/vp/theorycov/summary.rst | 14 ++++++--- 4 files changed, 21 insertions(+), 49 deletions(-) diff --git a/doc/sphinx/source/vp/theorycov/examples.rst b/doc/sphinx/source/vp/theorycov/examples.rst index 387d23ed67..61471b8512 100644 --- a/doc/sphinx/source/vp/theorycov/examples.rst +++ b/doc/sphinx/source/vp/theorycov/examples.rst @@ -11,8 +11,7 @@ at NLO. You need to provide the central theory under the ``default_theory`` flag, corresponding to :math:`(\mu_F, \mu_R) = (0,0)`, -which for NLO is theory 163. Under ``theoryids`` you need to provide all the -relevant theories, as outlined above. +which for NLO is theory 163. ``dataspecs`` associates a chosen label (``speclabel``) with each of the theory choices. This details what scale variation the theory corresponds to. @@ -33,10 +32,11 @@ relevant c-factors. default_theory: - theoryid: 163 + theoryid: 163 + point_prescription: '3 point' + theoryids: - - 163 - - 180 - - 173 + from_: scale_variation_theories dataspecs: - theoryid: 163 @@ -203,9 +203,7 @@ matrix against the NNLO-NLO shift. In this case the 5 point prescription is chos and Drell-Yan experiments only are considered. Note that as we are dealing with 5 theories, we need to set the ``fivetheories`` -flag, which in this case is set to ``nobar``. This must be used in conjunction -with the correct ``theoryids`` and ordering of ``theoryids`` in order not to throw -an error. +flag, which in this case is set to ``nobar``. The flag ``orthonormalisation`` corresponds to the method used to orthonormalise the basis vectors of the theory covariance matrix. There are three choices: @@ -401,14 +399,11 @@ For each dataspec we can give the ``_experiments_list_nlo``. theoryconfig: - theoryids: - - 163 - - 177 - - 176 - - 179 - - 174 - theoryid: 163 + point_prescription: '5-point' + + theoryids: + from_: scale_variation_theories use_cuts: fromfit fit: 190315_ern_nlo_central_163_global @@ -433,7 +428,7 @@ For each dataspec we can give the ``_experiments_list_nlo``. speclabel: $(\xi_F,\xi_R)=(1,0.5)$ experiments: *experiments_list_nlo - template: ../../template_test.md + template: template_test.md dataset_report: meta: Null @@ -450,7 +445,7 @@ capturing the NNLO-NLO shift. .. code-block:: md :linenos: - % Theory shift validation test: 9 pts + % Theory shift validation test: 5 pt Non-zero eigenvalues -------------------- @@ -496,5 +491,3 @@ capturing the NNLO-NLO shift. -------------------- {@deltamiss_plot@} - -. diff --git a/doc/sphinx/source/vp/theorycov/point_prescrip.rst b/doc/sphinx/source/vp/theorycov/point_prescrip.rst index cb58e86248..bf994251e8 100644 --- a/doc/sphinx/source/vp/theorycov/point_prescrip.rst +++ b/doc/sphinx/source/vp/theorycov/point_prescrip.rst @@ -7,8 +7,6 @@ appear in ``validphys2``. 3 points -------- -theoryids: 163, 180, 173 - .. math:: s_{11} = \frac{1}{2}\bigg\{ \Delta_1(+,+)^2 + \Delta_1(-,-)^2 \bigg\} .. math:: s_{12} = \frac{1}{4}\bigg\{\bigg(\Delta_1(+,+) + \Delta_1(-,-) \bigg) \bigg(\Delta_2(+,+) + \Delta_2(-,-) \bigg) \bigg\} @@ -17,8 +15,6 @@ theoryids: 163, 180, 173 5 points --------- -theoryids: 163, 177, 176, 179, 174 - .. math:: s_{11} = \frac{1}{2}\bigg\{ \Delta_1(+,0)^2 + \Delta_1(-,0)^2 + \Delta_1(0,+)^2 + \Delta_1(0,-)^2 \bigg\} .. math:: @@ -31,8 +27,6 @@ theoryids: 163, 177, 176, 179, 174 :math:`\mathbf{\overline{5}}` points ------------------------------------ -theoryids: 163, 180, 173, 175, 178 - .. math:: s_{11} = \frac{1}{2}\bigg\{ \Delta_1(+,+)^2 + \Delta_1(-,-)^2 + \Delta_1(+,-)^2 + \Delta_1(-,+)^2 \bigg\} .. math:: @@ -46,7 +40,6 @@ theoryids: 163, 180, 173, 175, 178 ------------------- | Specify in the runcard ``seventheories: original`` -| theoryids: 163, 177, 176, 179, 174, 180, 173 .. math:: @@ -65,8 +58,6 @@ theoryids: 163, 180, 173, 175, 178 7 points - Gavin (default) -------------------------- -theoryids: 163, 177, 176, 179, 174, 180, 173 - .. math:: \begin{split} @@ -86,8 +77,6 @@ theoryids: 163, 177, 176, 179, 174, 180, 173 9 points -------- -theoryids: 163, 177, 176, 179, 174, 180, 173, 175, 178 - .. math:: \begin{split} diff --git a/doc/sphinx/source/vp/theorycov/runcard_layout.rst b/doc/sphinx/source/vp/theorycov/runcard_layout.rst index 8d760da303..706461e9cb 100644 --- a/doc/sphinx/source/vp/theorycov/runcard_layout.rst +++ b/doc/sphinx/source/vp/theorycov/runcard_layout.rst @@ -1,20 +1,6 @@ Important information about runcard layout ========================================== -- **IMPORTANT:** In runcards, theories must be listed according to - points :math:`(\mu_0, \mu_i)` in the following order: :math:`(0,0)`, - :math:`(+,0)`, :math:`(-,0)`, :math:`(0,+)`, :math:`(0,-)`, - :math:`(+,+)`, :math:`(-,-)`, :math:`(+,-)`, :math:`(-,+)`. Here "+" - refers to doubled scale, "-" to halved scale and "0" to central - scale. - -- In terms of ``theoryids``, at NLO this corresponds to: 163, 177, 176, - 179, 174, 180, 173, 175, 178. This ensures that the prescriptions - will be implemented correctly. The ``theoryids`` to input for each - prescription are listed explicitly in the section on point - prescriptions below. If an incorrect configuration of ``theoryids`` - is given, you should receive an error message. - - The flag ``fivetheories`` specifies the choice of 5 or :math:`\bar{5}` prescription for the case of 5 input theories. You must assign a value ``nobar`` or ``bar`` correspondingly. If you do diff --git a/doc/sphinx/source/vp/theorycov/summary.rst b/doc/sphinx/source/vp/theorycov/summary.rst index 00c23ebfa0..22aab83591 100644 --- a/doc/sphinx/source/vp/theorycov/summary.rst +++ b/doc/sphinx/source/vp/theorycov/summary.rst @@ -31,13 +31,17 @@ See the `short - Theoretical covariance matrices are built according to the various prescriptions. -- As input you need theories at the relevant scale combinations which - correspond to the prescription. +- As input you need theories for the relevant scale combinations which + correspond to the prescription. This information is taken from the + ``scalevariations`` module, which consists of two files: -- These must be ordered in a specific way in the runcard. + #. ``pointprescriptions.yaml``: correspondence between each point prescription + and the scale combinations that are used to construct it -- The prescription is chosen based on the number of input theories, - which must be one of :math:`\{3,5,7,9\}`. + #. ``scalevariationtheoryids.yaml``: correspondence between each scale combination + and a theoryid, for a given central theoryid + +- The prescription must be one of :math:`\{3,5,7,9\}`. - In the case of 5 theories, you must further specify whether the 5 or :math:`\bar{5}` prescription is required. You can do this by From a4a92fc6cdf0ffb02607a47ba74d1e66e166ad39 Mon Sep 17 00:00:00 2001 From: Cameron Voisey Date: Wed, 8 Apr 2020 14:35:36 +0100 Subject: [PATCH 09/20] Add info to docs on the 7-point flag --- doc/sphinx/source/vp/theorycov/runcard_layout.rst | 4 ++++ doc/sphinx/source/vp/theorycov/summary.rst | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/sphinx/source/vp/theorycov/runcard_layout.rst b/doc/sphinx/source/vp/theorycov/runcard_layout.rst index 706461e9cb..35bcd7f8b9 100644 --- a/doc/sphinx/source/vp/theorycov/runcard_layout.rst +++ b/doc/sphinx/source/vp/theorycov/runcard_layout.rst @@ -6,6 +6,10 @@ Important information about runcard layout must assign a value ``nobar`` or ``bar`` correspondingly. If you do not do this, ``validphys`` will give an error. +- The default behaviour for the 7-point prescription is to use Gavin + Salam's modification to it. To use the original 7-point prescription + instead, the ``seventheories`` flag must be set to ``original``. + - As a fit you must provide the fit for central scales at the relevant order. diff --git a/doc/sphinx/source/vp/theorycov/summary.rst b/doc/sphinx/source/vp/theorycov/summary.rst index 22aab83591..72802f4686 100644 --- a/doc/sphinx/source/vp/theorycov/summary.rst +++ b/doc/sphinx/source/vp/theorycov/summary.rst @@ -39,7 +39,7 @@ See the `short and the scale combinations that are used to construct it #. ``scalevariationtheoryids.yaml``: correspondence between each scale combination - and a theoryid, for a given central theoryid + and a theoryid for a given central theoryid - The prescription must be one of :math:`\{3,5,7,9\}`. @@ -48,6 +48,10 @@ See the `short allocating the flag ``fivetheories`` to ``nobar`` or ``bar`` in the runcard. +- In the case of 7 theories, there are two options. The default is the + modified prescription that Gavin Salam proposed. To use the original + prescription instead, specify ``seventheories: original`` in the runcard. + - Currently the renormalisation scales are correlated within each process type. These process types are categorised as {DIS CC, DIS NC, Drell-Yan, Jets, Top}. From 7556f07117733990c5120e06c7836339f43e003d Mon Sep 17 00:00:00 2001 From: Cameron Voisey Date: Tue, 14 Apr 2020 17:00:45 +0100 Subject: [PATCH 10/20] Take allowed central theories from hardcoded yaml file --- validphys2/src/validphys/config.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/validphys2/src/validphys/config.py b/validphys2/src/validphys/config.py index a3111de6cf..5a48366fd2 100644 --- a/validphys2/src/validphys/config.py +++ b/validphys2/src/validphys/config.py @@ -995,7 +995,15 @@ def produce_scale_variation_theories(self, theoryid, point_prescription): hard codes the theories needed for each prescription to avoid user error.""" pp = point_prescription th = theoryid.id - if th != '163': + + lsv = yaml.safe_load( + read_text(validphys.scalevariations, "scalevariationtheoryids.yaml") + ) + scalevarsfor_list = lsv['scale_variations_for'] + # Allowed central theoryids + cent_thids = [i['theoryid'] for i in scalevarsfor_list] + + if th in cent_thids: raise ConfigError( "Scale variations are not currently defined for this central theoryid. It is " + "currently only possible to use theoryid 163 as the central theory. Please use " @@ -1019,10 +1027,6 @@ def produce_scale_variation_theories(self, theoryid, point_prescription): ) # Find theoryids for given point prescription for given central theoryid - lsv = yaml.safe_load( - read_text(validphys.scalevariations, "scalevariationtheoryids.yaml") - ) - scalevarsfor_list = lsv['scale_variations_for'] variations = [ i['variations'] for i in scalevarsfor_list if i['theoryid'] == int(th) ][0] From 2d5e712d2167b32474e2abeeb9a44bf405fd06ee Mon Sep 17 00:00:00 2001 From: Cameron Voisey Date: Wed, 15 Apr 2020 09:27:19 +0100 Subject: [PATCH 11/20] Remove mention of 7 point (original) because the theories for the default 7 point are the same as for the original version --- validphys2/src/validphys/config.py | 11 +++++------ .../validphys/scalevariations/pointprescriptions.yaml | 2 -- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/validphys2/src/validphys/config.py b/validphys2/src/validphys/config.py index 5a48366fd2..8c8e473ab2 100644 --- a/validphys2/src/validphys/config.py +++ b/validphys2/src/validphys/config.py @@ -990,9 +990,9 @@ def produce_defaults(self, q2min=None, w2min=None, filter_defaults={}): def produce_scale_variation_theories(self, theoryid, point_prescription): """Produces a list of theoryids given a theoryid at central scales and a point - prescription. The options for the latter are '3 point', '5 point', '5bar point', '7 point', - '7 point (original)' and '9 point'. Note that these are defined in arXiv:1906.10698. This - hard codes the theories needed for each prescription to avoid user error.""" + prescription. The options for the latter are '3 point', '5 point', '5bar point', '7 point' + and '9 point'. Note that these are defined in arXiv:1906.10698. This hard codes the + theories needed for each prescription to avoid user error.""" pp = point_prescription th = theoryid.id @@ -1021,9 +1021,8 @@ def produce_scale_variation_theories(self, theoryid, point_prescription): raise ConfigError( "Scale variations are not currently defined for this point prescription. This " + "configuration only works when 'point_prescription' is equal to one of " - + "'3 point', '5 point', '5bar point', '7 point', '7 point (original)' or " - + "'9 point'. Please use one of these instead if you wish to include theory " - + "uncertainties here." + + "'3 point', '5 point', '5bar point', '7 point' or '9 point'. Please use one " + + "of these instead if you wish to include theory uncertainties here." ) # Find theoryids for given point prescription for given central theoryid diff --git a/validphys2/src/validphys/scalevariations/pointprescriptions.yaml b/validphys2/src/validphys/scalevariations/pointprescriptions.yaml index 0c24b28383..bf94000ec0 100644 --- a/validphys2/src/validphys/scalevariations/pointprescriptions.yaml +++ b/validphys2/src/validphys/scalevariations/pointprescriptions.yaml @@ -9,7 +9,5 @@ point_prescriptions: scales: [{'muF': '1', 'muR': '1'}, {'muF': '2', 'muR': '2'}, {'muF': '0.5', 'muR': '0.5'}, {'muF': '2', 'muR': '0.5'}, {'muF': '0.5', 'muR': '2'}] - name: '7 point' scales: [{'muF': '1', 'muR': '1'}, {'muF': '2', 'muR': '1'}, {'muF': '0.5', 'muR': '1'}, {'muF': '1', 'muR': '2'}, {'muF': '1', 'muR': '0.5'}, {'muF': '2', 'muR': '2'}, {'muF': '0.5', 'muR': '0.5'}] - - name: '7 point (original)' - scales: [{'muF': '1', 'muR': '1'}, {'muF': '2', 'muR': '1'}, {'muF': '0.5', 'muR': '1'}, {'muF': '1', 'muR': '2'}, {'muF': '1', 'muR': '0.5'}, {'muF': '2', 'muR': '2'}, {'muF': '0.5', 'muR': '0.5'}] - name: '9 point' scales: [{'muF': '1', 'muR': '1'}, {'muF': '2', 'muR': '1'}, {'muF': '0.5', 'muR': '1'}, {'muF': '1', 'muR': '2'}, {'muF': '1', 'muR': '0.5'}, {'muF': '2', 'muR': '2'}, {'muF': '0.5', 'muR': '0.5'}, {'muF': '2', 'muR': '0.5'}, {'muF': '0.5', 'muR': '2'}] From caf1312136b44a4da87ce12b03083cde41463644 Mon Sep 17 00:00:00 2001 From: Cameron Voisey Date: Wed, 15 Apr 2020 10:02:09 +0100 Subject: [PATCH 12/20] Fix config error --- validphys2/src/validphys/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/validphys2/src/validphys/config.py b/validphys2/src/validphys/config.py index 8c8e473ab2..9825a16ab5 100644 --- a/validphys2/src/validphys/config.py +++ b/validphys2/src/validphys/config.py @@ -1001,9 +1001,9 @@ def produce_scale_variation_theories(self, theoryid, point_prescription): ) scalevarsfor_list = lsv['scale_variations_for'] # Allowed central theoryids - cent_thids = [i['theoryid'] for i in scalevarsfor_list] + cent_thids = [str(i['theoryid']) for i in scalevarsfor_list] - if th in cent_thids: + if th not in cent_thids: raise ConfigError( "Scale variations are not currently defined for this central theoryid. It is " + "currently only possible to use theoryid 163 as the central theory. Please use " From 05b784d038a1873f57f2a70e87e93a75f9626219 Mon Sep 17 00:00:00 2001 From: Cameron Voisey Date: Wed, 15 Apr 2020 11:23:33 +0100 Subject: [PATCH 13/20] Make pointprescriptions.yaml into a dictionary rather than a list and incorporate this in config.py --- validphys2/src/validphys/config.py | 8 ++++---- .../scalevariations/pointprescriptions.yaml | 17 ++++++----------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/validphys2/src/validphys/config.py b/validphys2/src/validphys/config.py index 9825a16ab5..301cb8be7b 100644 --- a/validphys2/src/validphys/config.py +++ b/validphys2/src/validphys/config.py @@ -1011,13 +1011,13 @@ def produce_scale_variation_theories(self, theoryid, point_prescription): ) # Find scales that correspond to this point prescription - lpp = yaml.safe_load( + pp_scales_dict = yaml.safe_load( read_text(validphys.scalevariations, "pointprescriptions.yaml") ) - pp_scales_list = lpp['point_prescriptions'] + try: - scales = [i['scales'] for i in pp_scales_list if i['name'] == pp][0] - except IndexError: + scales = pp_scales_dict[pp] + except KeyError: raise ConfigError( "Scale variations are not currently defined for this point prescription. This " + "configuration only works when 'point_prescription' is equal to one of " diff --git a/validphys2/src/validphys/scalevariations/pointprescriptions.yaml b/validphys2/src/validphys/scalevariations/pointprescriptions.yaml index bf94000ec0..d7fe5eeb21 100644 --- a/validphys2/src/validphys/scalevariations/pointprescriptions.yaml +++ b/validphys2/src/validphys/scalevariations/pointprescriptions.yaml @@ -1,13 +1,8 @@ +# Mapping between a point prescription and the scale combinations that form it # 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) -point_prescriptions: - - name: '3 point' - scales: [{'muF': '1', 'muR': '1'}, {'muF': '2', 'muR': '2'}, {'muF': '0.5', 'muR': '0.5'}] - - name: '5 point' - scales: [{'muF': '1', 'muR': '1'}, {'muF': '2', 'muR': '1'}, {'muF': '0.5', 'muR': '1'}, {'muF': '1', 'muR': '2'}, {'muF': '1', 'muR': '0.5'}] - - name: '5bar point' - scales: [{'muF': '1', 'muR': '1'}, {'muF': '2', 'muR': '2'}, {'muF': '0.5', 'muR': '0.5'}, {'muF': '2', 'muR': '0.5'}, {'muF': '0.5', 'muR': '2'}] - - name: '7 point' - scales: [{'muF': '1', 'muR': '1'}, {'muF': '2', 'muR': '1'}, {'muF': '0.5', 'muR': '1'}, {'muF': '1', 'muR': '2'}, {'muF': '1', 'muR': '0.5'}, {'muF': '2', 'muR': '2'}, {'muF': '0.5', 'muR': '0.5'}] - - name: '9 point' - scales: [{'muF': '1', 'muR': '1'}, {'muF': '2', 'muR': '1'}, {'muF': '0.5', 'muR': '1'}, {'muF': '1', 'muR': '2'}, {'muF': '1', 'muR': '0.5'}, {'muF': '2', 'muR': '2'}, {'muF': '0.5', 'muR': '0.5'}, {'muF': '2', 'muR': '0.5'}, {'muF': '0.5', 'muR': '2'}] +'3 point': [{'muF': '1', 'muR': '1'}, {'muF': '2', 'muR': '2'}, {'muF': '0.5', 'muR': '0.5'}] +'5 point': [{'muF': '1', 'muR': '1'}, {'muF': '2', 'muR': '1'}, {'muF': '0.5', 'muR': '1'}, {'muF': '1', 'muR': '2'}, {'muF': '1', 'muR': '0.5'}] +'5bar point': [{'muF': '1', 'muR': '1'}, {'muF': '2', 'muR': '2'}, {'muF': '0.5', 'muR': '0.5'}, {'muF': '2', 'muR': '0.5'}, {'muF': '0.5', 'muR': '2'}] +'7 point': [{'muF': '1', 'muR': '1'}, {'muF': '2', 'muR': '1'}, {'muF': '0.5', 'muR': '1'}, {'muF': '1', 'muR': '2'}, {'muF': '1', 'muR': '0.5'}, {'muF': '2', 'muR': '2'}, {'muF': '0.5', 'muR': '0.5'}] +'9 point': [{'muF': '1', 'muR': '1'}, {'muF': '2', 'muR': '1'}, {'muF': '0.5', 'muR': '1'}, {'muF': '1', 'muR': '2'}, {'muF': '1', 'muR': '0.5'}, {'muF': '2', 'muR': '2'}, {'muF': '0.5', 'muR': '0.5'}, {'muF': '2', 'muR': '0.5'}, {'muF': '0.5', 'muR': '2'}] From 2bd0cf82808e944e89bcbca3d84b6a53bb8ff8b0 Mon Sep 17 00:00:00 2001 From: Cameron Voisey Date: Wed, 15 Apr 2020 12:48:58 +0100 Subject: [PATCH 14/20] Use tuples in scalevariations yaml files rather than dictionaries, make variations a dictionary rather than a list in scalevariationtheoryids.yaml, and update config.yaml accordingly --- validphys2/src/validphys/config.py | 7 ++--- .../scalevariations/pointprescriptions.yaml | 10 +++---- .../scalevariationtheoryids.yaml | 28 +++++++------------ 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/validphys2/src/validphys/config.py b/validphys2/src/validphys/config.py index 301cb8be7b..74ae6eeb50 100644 --- a/validphys2/src/validphys/config.py +++ b/validphys2/src/validphys/config.py @@ -999,6 +999,7 @@ def produce_scale_variation_theories(self, theoryid, point_prescription): lsv = yaml.safe_load( read_text(validphys.scalevariations, "scalevariationtheoryids.yaml") ) + scalevarsfor_list = lsv['scale_variations_for'] # Allowed central theoryids cent_thids = [str(i['theoryid']) for i in scalevarsfor_list] @@ -1026,10 +1027,8 @@ def produce_scale_variation_theories(self, theoryid, point_prescription): ) # Find theoryids for given point prescription for given central theoryid - 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']] + variations = scalevarsfor_list['theoryid' == int(th)]['variations'] + thids = [variations[i] for i in scales] # Check each theory is loaded theoryids = [self.loader.check_theoryID(thid) for thid in thids] diff --git a/validphys2/src/validphys/scalevariations/pointprescriptions.yaml b/validphys2/src/validphys/scalevariations/pointprescriptions.yaml index d7fe5eeb21..a322498c9c 100644 --- a/validphys2/src/validphys/scalevariations/pointprescriptions.yaml +++ b/validphys2/src/validphys/scalevariations/pointprescriptions.yaml @@ -1,8 +1,8 @@ # Mapping between a point prescription and the scale combinations that form it # 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) -'3 point': [{'muF': '1', 'muR': '1'}, {'muF': '2', 'muR': '2'}, {'muF': '0.5', 'muR': '0.5'}] -'5 point': [{'muF': '1', 'muR': '1'}, {'muF': '2', 'muR': '1'}, {'muF': '0.5', 'muR': '1'}, {'muF': '1', 'muR': '2'}, {'muF': '1', 'muR': '0.5'}] -'5bar point': [{'muF': '1', 'muR': '1'}, {'muF': '2', 'muR': '2'}, {'muF': '0.5', 'muR': '0.5'}, {'muF': '2', 'muR': '0.5'}, {'muF': '0.5', 'muR': '2'}] -'7 point': [{'muF': '1', 'muR': '1'}, {'muF': '2', 'muR': '1'}, {'muF': '0.5', 'muR': '1'}, {'muF': '1', 'muR': '2'}, {'muF': '1', 'muR': '0.5'}, {'muF': '2', 'muR': '2'}, {'muF': '0.5', 'muR': '0.5'}] -'9 point': [{'muF': '1', 'muR': '1'}, {'muF': '2', 'muR': '1'}, {'muF': '0.5', 'muR': '1'}, {'muF': '1', 'muR': '2'}, {'muF': '1', 'muR': '0.5'}, {'muF': '2', 'muR': '2'}, {'muF': '0.5', 'muR': '0.5'}, {'muF': '2', 'muR': '0.5'}, {'muF': '0.5', 'muR': '2'}] +'3 point': ['(1, 1)', '(2, 2)', '(0.5, 0.5)'] +'5 point': ['(1, 1)', '(2, 1)', '(0.5, 1)', '(1, 2)', '(1, 0.5)'] +'5bar point': ['(1, 1)', '(2, 2)', '(0.5, 0.5)', '(2, 0.5)', '(0.5, 2)'] +'7 point': ['(1, 1)', '(2, 1)', '(0.5, 1)', '(1, 2)', '(1, 0.5)', '(2, 2)', '(0.5, 0.5)'] +'9 point': ['(1, 1)', '(2, 1)', '(0.5, 1)', '(1, 2)', '(1, 0.5)', '(2, 2)', '(0.5, 0.5)', '(2, 0.5)', '(0.5, 2)'] diff --git a/validphys2/src/validphys/scalevariations/scalevariationtheoryids.yaml b/validphys2/src/validphys/scalevariations/scalevariationtheoryids.yaml index 87d44730c6..1864db2070 100644 --- a/validphys2/src/validphys/scalevariations/scalevariationtheoryids.yaml +++ b/validphys2/src/validphys/scalevariations/scalevariationtheoryids.yaml @@ -1,21 +1,13 @@ +# Format is (muF, muR) scale_variations_for: - theoryid: 163 variations: - - scales: {'muF': '0.5', 'muR': '0.5'} - theoryid: 173 - - scales: {'muF': '0.5', 'muR': '1'} - theoryid: 176 - - scales: {'muF': '0.5', 'muR': '2'} - theoryid: 178 - - scales: {'muF': '1', 'muR': '0.5'} - theoryid: 174 - - scales: {'muF': '1', 'muR': '1'} - theoryid: 163 - - scales: {'muF': '1', 'muR': '2'} - theoryid: 179 - - scales: {'muF': '2', 'muR': '0.5'} - theoryid: 175 - - scales: {'muF': '2', 'muR': '1'} - theoryid: 177 - - scales: {'muF': '2', 'muR': '2'} - theoryid: 180 + (0.5, 0.5): 173 + (0.5, 1): 176 + (0.5, 2): 178 + (1, 0.5): 174 + (1, 1): 163 + (1, 2): 179 + (2, 0.5): 175 + (2, 1): 177 + (2, 2): 180 From 9f93203cceeb47eb6c81683f6bedede89abcf4fb Mon Sep 17 00:00:00 2001 From: Cameron Voisey Date: Wed, 15 Apr 2020 14:11:48 +0100 Subject: [PATCH 15/20] Use f-string in config error --- validphys2/src/validphys/config.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/validphys2/src/validphys/config.py b/validphys2/src/validphys/config.py index 74ae6eeb50..9954779d19 100644 --- a/validphys2/src/validphys/config.py +++ b/validphys2/src/validphys/config.py @@ -1005,10 +1005,11 @@ def produce_scale_variation_theories(self, theoryid, point_prescription): cent_thids = [str(i['theoryid']) for i in scalevarsfor_list] if th not in cent_thids: + valid_thids = ", ".join(cent_thids) raise ConfigError( "Scale variations are not currently defined for this central theoryid. It is " - + "currently only possible to use theoryid 163 as the central theory. Please use " - + "this instead if you wish to include theory uncertainties here." + + f"currently only possible to use one of the following as the central theory: {valid_thids}. " + + "Please use one of these instead if you wish to include theory uncertainties here." ) # Find scales that correspond to this point prescription From b9f477dfd55fe5088e63bd701b7050a7cc99dcb7 Mon Sep 17 00:00:00 2001 From: Cameron Voisey Date: Wed, 15 Apr 2020 14:21:05 +0100 Subject: [PATCH 16/20] Use f-string for point prescriptions --- validphys2/src/validphys/config.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/validphys2/src/validphys/config.py b/validphys2/src/validphys/config.py index 9954779d19..bbe9c4b73d 100644 --- a/validphys2/src/validphys/config.py +++ b/validphys2/src/validphys/config.py @@ -1020,11 +1020,12 @@ def produce_scale_variation_theories(self, theoryid, point_prescription): try: scales = pp_scales_dict[pp] except KeyError: + valid_pps = ", ".join(pp_scales_dict.keys()) raise ConfigError( "Scale variations are not currently defined for this point prescription. This " - + "configuration only works when 'point_prescription' is equal to one of " - + "'3 point', '5 point', '5bar point', '7 point' or '9 point'. Please use one " - + "of these instead if you wish to include theory uncertainties here." + + "configuration only works when 'point_prescription' is equal to one of the " + + f"following: {valid_pps}. Please use one of these instead if you wish to " + + "include theory uncertainties here." ) # Find theoryids for given point prescription for given central theoryid From 3d57330faa28e45de8173590d8a354bd15e5e392 Mon Sep 17 00:00:00 2001 From: Cameron Voisey Date: Wed, 15 Apr 2020 15:38:10 +0100 Subject: [PATCH 17/20] Add an error if only a subset of the point prescriptions are implemented 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. --- validphys2/src/validphys/config.py | 25 ++++++++++++++++--- .../scalevariations/pointprescriptions.yaml | 4 +-- .../scalevariationtheoryids.yaml | 2 +- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/validphys2/src/validphys/config.py b/validphys2/src/validphys/config.py index bbe9c4b73d..c7cb14d1e3 100644 --- a/validphys2/src/validphys/config.py +++ b/validphys2/src/validphys/config.py @@ -1002,7 +1002,7 @@ def produce_scale_variation_theories(self, theoryid, point_prescription): scalevarsfor_list = lsv['scale_variations_for'] # Allowed central theoryids - cent_thids = [str(i['theoryid']) for i in scalevarsfor_list] + cent_thids = [str(scalevarsfor_dict['theoryid']) for scalevarsfor_dict in scalevarsfor_list] if th not in cent_thids: valid_thids = ", ".join(cent_thids) @@ -1028,9 +1028,28 @@ def produce_scale_variation_theories(self, theoryid, point_prescription): + "include theory uncertainties here." ) + # Get dictionary containing theoryid and variations for central theory from runcard + for scalevarsfor_dict in scalevarsfor_list: + if scalevarsfor_dict['theoryid'] == int(th): + theoryid_variations = scalevarsfor_dict + # Find theoryids for given point prescription for given central theoryid - variations = scalevarsfor_list['theoryid' == int(th)]['variations'] - thids = [variations[i] for i in scales] + try: + thids = [theoryid_variations['variations'][scale] for scale in scales] + except KeyError: + available_scales = list(theoryid_variations['variations']) + missing_scales = [] + for scale in scales: + if scale not in available_scales: + missing_scales.append(scale) + missing_scales_string = ", ".join(missing_scales) + raise ConfigError( + "For this central theoryid, the requested point prescription is not currently " + + "available. To use this point prescription for this central theoryid, theoryids " + + "that correspond to the following scale choices must be created and added to " + + "validphys2/src/validphys/scalevariations/scalevariationtheoryids.yaml: " + + f"(k_F, k_R) = {missing_scales_string}." + ) # Check each theory is loaded theoryids = [self.loader.check_theoryID(thid) for thid in thids] diff --git a/validphys2/src/validphys/scalevariations/pointprescriptions.yaml b/validphys2/src/validphys/scalevariations/pointprescriptions.yaml index a322498c9c..5abac68042 100644 --- a/validphys2/src/validphys/scalevariations/pointprescriptions.yaml +++ b/validphys2/src/validphys/scalevariations/pointprescriptions.yaml @@ -1,6 +1,6 @@ # Mapping between a point prescription and the scale combinations that form it -# 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) +# IMPORTANT: scale combinations must be listed according to (k_F, k_R) 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) '3 point': ['(1, 1)', '(2, 2)', '(0.5, 0.5)'] '5 point': ['(1, 1)', '(2, 1)', '(0.5, 1)', '(1, 2)', '(1, 0.5)'] '5bar point': ['(1, 1)', '(2, 2)', '(0.5, 0.5)', '(2, 0.5)', '(0.5, 2)'] diff --git a/validphys2/src/validphys/scalevariations/scalevariationtheoryids.yaml b/validphys2/src/validphys/scalevariations/scalevariationtheoryids.yaml index 1864db2070..b535322e41 100644 --- a/validphys2/src/validphys/scalevariations/scalevariationtheoryids.yaml +++ b/validphys2/src/validphys/scalevariations/scalevariationtheoryids.yaml @@ -1,4 +1,4 @@ -# Format is (muF, muR) +# The format of the scale combinations is (k_F, k_R) scale_variations_for: - theoryid: 163 variations: From b7e73e46ffc5b72b5eac844fd1f57eef1cfa6982 Mon Sep 17 00:00:00 2001 From: Cameron Voisey Date: Wed, 15 Apr 2020 15:42:54 +0100 Subject: [PATCH 18/20] Use full names of point prescriptions in theorycovariance docs --- doc/sphinx/source/vp/theorycov/summary.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/sphinx/source/vp/theorycov/summary.rst b/doc/sphinx/source/vp/theorycov/summary.rst index 72802f4686..2df834ef25 100644 --- a/doc/sphinx/source/vp/theorycov/summary.rst +++ b/doc/sphinx/source/vp/theorycov/summary.rst @@ -41,7 +41,7 @@ See the `short #. ``scalevariationtheoryids.yaml``: correspondence between each scale combination and a theoryid for a given central theoryid -- The prescription must be one of :math:`\{3,5,7,9\}`. +- The prescription must be one of 3 point, 5 point, 7 point or 9 point. - In the case of 5 theories, you must further specify whether the 5 or :math:`\bar{5}` prescription is required. You can do this by From 11329b361f5373d49d67e0c1cf625e0bed3712f1 Mon Sep 17 00:00:00 2001 From: Cameron Voisey Date: Thu, 16 Apr 2020 15:07:36 +0100 Subject: [PATCH 19/20] Format with black --- validphys2/src/validphys/config.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/validphys2/src/validphys/config.py b/validphys2/src/validphys/config.py index c7cb14d1e3..ef62d018cc 100644 --- a/validphys2/src/validphys/config.py +++ b/validphys2/src/validphys/config.py @@ -990,9 +990,9 @@ def produce_defaults(self, q2min=None, w2min=None, filter_defaults={}): def produce_scale_variation_theories(self, theoryid, point_prescription): """Produces a list of theoryids given a theoryid at central scales and a point - prescription. The options for the latter are '3 point', '5 point', '5bar point', '7 point' - and '9 point'. Note that these are defined in arXiv:1906.10698. This hard codes the - theories needed for each prescription to avoid user error.""" + prescription. The options for the latter are '3 point', '5 point', '5bar point', '7 point' + and '9 point'. Note that these are defined in arXiv:1906.10698. This hard codes the + theories needed for each prescription to avoid user error.""" pp = point_prescription th = theoryid.id @@ -1000,9 +1000,11 @@ def produce_scale_variation_theories(self, theoryid, point_prescription): read_text(validphys.scalevariations, "scalevariationtheoryids.yaml") ) - scalevarsfor_list = lsv['scale_variations_for'] + scalevarsfor_list = lsv["scale_variations_for"] # Allowed central theoryids - cent_thids = [str(scalevarsfor_dict['theoryid']) for scalevarsfor_dict in scalevarsfor_list] + cent_thids = [ + str(scalevarsfor_dict["theoryid"]) for scalevarsfor_dict in scalevarsfor_list + ] if th not in cent_thids: valid_thids = ", ".join(cent_thids) @@ -1030,14 +1032,14 @@ def produce_scale_variation_theories(self, theoryid, point_prescription): # Get dictionary containing theoryid and variations for central theory from runcard for scalevarsfor_dict in scalevarsfor_list: - if scalevarsfor_dict['theoryid'] == int(th): + if scalevarsfor_dict["theoryid"] == int(th): theoryid_variations = scalevarsfor_dict # Find theoryids for given point prescription for given central theoryid try: - thids = [theoryid_variations['variations'][scale] for scale in scales] + thids = [theoryid_variations["variations"][scale] for scale in scales] except KeyError: - available_scales = list(theoryid_variations['variations']) + available_scales = list(theoryid_variations["variations"]) missing_scales = [] for scale in scales: if scale not in available_scales: @@ -1054,7 +1056,7 @@ def produce_scale_variation_theories(self, theoryid, point_prescription): # Check each theory is loaded theoryids = [self.loader.check_theoryID(thid) for thid in thids] # NSList needs to be used for theoryids to be recognised as a namespace - return {'theoryids': NSList(theoryids, nskey='theoryid')} + return {"theoryids": NSList(theoryids, nskey="theoryid")} class Config(report.Config, CoreConfig, ParamfitsConfig): From 0ee40e82f38f2a46ec831a057f51422c2ce7087b Mon Sep 17 00:00:00 2001 From: Cameron Voisey Date: Thu, 16 Apr 2020 16:08:17 +0100 Subject: [PATCH 20/20] Import yaml from reportengine.compat --- validphys2/src/validphys/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validphys2/src/validphys/config.py b/validphys2/src/validphys/config.py index ef62d018cc..59c2c9b7e7 100644 --- a/validphys2/src/validphys/config.py +++ b/validphys2/src/validphys/config.py @@ -11,7 +11,6 @@ import numbers import copy import os -import yaml from importlib.resources import read_text from collections import ChainMap @@ -23,6 +22,7 @@ from reportengine.helputils import get_parser_type from reportengine.namespaces import NSList from reportengine import report +from reportengine.compat import yaml from validphys.core import (ExperimentSpec, DataSetInput, ExperimentInput, CutsPolicy, MatchedCuts, ThCovMatSpec)