From 664fce2a64b46b81bf2bbcda9cbe393d953a7790 Mon Sep 17 00:00:00 2001 From: Eduardo Rodrigues Date: Thu, 16 Nov 2023 19:41:20 +0100 Subject: [PATCH 01/11] Allow for possibility of model parameters defined as - --- src/decaylanguage/dec/dec.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/decaylanguage/dec/dec.py b/src/decaylanguage/dec/dec.py index 5ca53b87..9da8a90f 100644 --- a/src/decaylanguage/dec/dec.py +++ b/src/decaylanguage/dec/dec.py @@ -1116,8 +1116,16 @@ def _replacement(self, t: Tree) -> None: try: t.children[0].value = float(t.children[0].value) except AttributeError: - if t.value in self.define_defs: - t.value = self.define_defs[t.value] + negative_param = ( + True if t.value[0] == "-" else False + ) # account for uncommon cases such as "MODEL_NAME ... -DEFINE_NAME" + value = t.value if not negative_param else t.value[1:] + if value in self.define_defs: + t.value = ( + self.define_defs[value] + if not negative_param + else -self.define_defs[value] + ) def model_options(self, tree: Tree) -> None: """ From 846af88de2a6700c78ed18d6af965dc01743915e Mon Sep 17 00:00:00 2001 From: Eduardo Rodrigues Date: Thu, 16 Nov 2023 19:41:54 +0100 Subject: [PATCH 02/11] Add a model test with such an example --- tests/data/models/model-BT02PI_CP_ISO.dec | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tests/data/models/model-BT02PI_CP_ISO.dec diff --git a/tests/data/models/model-BT02PI_CP_ISO.dec b/tests/data/models/model-BT02PI_CP_ISO.dec new file mode 100644 index 00000000..f07d8d10 --- /dev/null +++ b/tests/data/models/model-BT02PI_CP_ISO.dec @@ -0,0 +1,12 @@ +# File for testing purposes. Contains a single decay mode with a specific model. + +Define dm 0.507e12 +Define beta 0.39 +Define gamma 1.387 + +Decay B0 +1.0 pi+ pi- BT02PI_CP_ISO beta dm 1.0 gamma 1.0 -gamma + 1.0 gamma 1.0 -gamma; +Enddecay + +End From 94b167d8fee817f5b5e70c150c17d624256dbe2c Mon Sep 17 00:00:00 2001 From: Eduardo Rodrigues Date: Thu, 16 Nov 2023 19:44:00 +0100 Subject: [PATCH 03/11] ... and test this --- tests/dec/test_known_decay_models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/dec/test_known_decay_models.py b/tests/dec/test_known_decay_models.py index c38edc81..9ccefdf9 100644 --- a/tests/dec/test_known_decay_models.py +++ b/tests/dec/test_known_decay_models.py @@ -84,7 +84,7 @@ def test_lark_file_model_list_consistency(): [5.0, 5, 0, 0, 1, 0.000001, 0.8250, 0.22509, 0.1598, 0.3499, 4.5], ), ("BSTOGLLMNT", [5.0, 5, 1, 1, 0.02, 0.88, 0.227, 0.22, 0.34]), - # ("BT02PI_CP_ISO", [0.39, 0.507e12, 1.0, 1.387, 1.0, -1.387, 1.0, 1.387, 1.0, -1.387]), + ("BT02PI_CP_ISO", [0.39, 0.507e12, 1.0, 1.387, 1.0, -1.387, 1.0, 1.387, 1.0, -1.387]), ("BTO3PI_CP", [0.507e12, 1.365]), ("BTODDALITZCPK", [1.22, 2.27, 0.10]), ("BToDiBaryonlnupQCD", [67.7, -280.0, -38.3, -840.0, -10.1, -157.0, 800000]), @@ -384,7 +384,7 @@ def test_lark_file_model_list_consistency(): def test_parsing_of_all_known_models_are_tested(): assert ( - len(parsed_models) == len(known_decay_models) - 5 + len(parsed_models) == len(known_decay_models) - 4 ) # subtract for now the number of models not yet tested + the number of models presently with no test available From d33e04926e4d4f4e5b1ea66cf3b36e2cd016ebb9 Mon Sep 17 00:00:00 2001 From: Eduardo Rodrigues Date: Thu, 16 Nov 2023 19:44:36 +0100 Subject: [PATCH 04/11] Allow for model parameters to have a dot in the names --- src/decaylanguage/data/decfile.lark | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/decaylanguage/data/decfile.lark b/src/decaylanguage/data/decfile.lark index 41a6cec5..bc349acc 100644 --- a/src/decaylanguage/data/decfile.lark +++ b/src/decaylanguage/data/decfile.lark @@ -63,9 +63,6 @@ model_options : (value | LABE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IGEN"|"SVS"|"SVV_CPLH"|"SVV_CP"|"SVV_HELAMP"|"SVV_NONCPEIGEN"|"SVVHELCPMIX"|"TAUHADNU"|"TAULNUNU"|"TAUOLA"|"TAUSCALARNU"|"TAUVECTORNU"|"THREEBODYPHSP"|"TSS"|"TVP"|"TVS_PWAVE"|"VLL"|"VSP_PWAVE"|"VSS_BMIX"|"VSS_MIX"|"VSS"|"VTOSLL"|"VUB"|"VVPIPI"|"VVP"|"VVS_PWAVE"|"XLL"|"YMSTOYNSPIPICLEO"|"YMSTOYNSPIPICLEOBOOST")/\b/ -// model : model_generic -// model_helamp : "HELAMP" (SIGNED_NUMBER SIGNED_NUMBER)+ - // Terminal definitions // To use a fast parser, we need to avoid conflicts @@ -79,7 +76,7 @@ _SEMICOLON: /;/ _COMMA: /,/ _WS: WS_INLINE -LABEL : /[a-zA-Z0-9\/\-+*_()'~]+/ +LABEL : /[a-zA-Z0-9\/\-+*_().'~]+/ COMMENT : /[#][^\n]*/ // We should ignore comments From 484f4327e98af71e5f3298755d0c8d5f643fab04 Mon Sep 17 00:00:00 2001 From: Eduardo Rodrigues Date: Thu, 16 Nov 2023 20:15:45 +0100 Subject: [PATCH 05/11] ... and test it with the GENERIC_DALITZ model --- tests/data/models/model-GENERIC_DALITZ.dec | 8 ++++++++ tests/dec/test_known_decay_models.py | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 tests/data/models/model-GENERIC_DALITZ.dec diff --git a/tests/data/models/model-GENERIC_DALITZ.dec b/tests/data/models/model-GENERIC_DALITZ.dec new file mode 100644 index 00000000..d7cef111 --- /dev/null +++ b/tests/data/models/model-GENERIC_DALITZ.dec @@ -0,0 +1,8 @@ +# File for testing purposes. Contains a single decay mode with a specific model. + +# Generic Dalitz model that uses XML files to configure the resonance amplitude parameters +Decay D+ + 1.0 K- pi+ pi+ GENERIC_DALITZ MyDir/MyDalitzParameters.xml; +Enddecay + +End diff --git a/tests/dec/test_known_decay_models.py b/tests/dec/test_known_decay_models.py index 9ccefdf9..7c87e692 100644 --- a/tests/dec/test_known_decay_models.py +++ b/tests/dec/test_known_decay_models.py @@ -131,7 +131,7 @@ def test_lark_file_model_list_consistency(): ("FLATQ2", [1.0]), ("FLATSQDALITZ", ""), ("FOURBODYPHSP", [1.3, 2.5, 1.3, 2.5]), - # ("GENERIC_DALITZ", ["MyDir/MyDalitzParameters.xml"]), + ("GENERIC_DALITZ", ["MyDir/MyDalitzParameters.xml"]), ("GOITY_ROBERTS", ""), ("HELAMP", [1.0, 0.0, 1.0, 0.0]), ("HQET3", [0.920, 1.205, 1.21, 1.404, 0.854]), @@ -384,7 +384,7 @@ def test_lark_file_model_list_consistency(): def test_parsing_of_all_known_models_are_tested(): assert ( - len(parsed_models) == len(known_decay_models) - 4 + len(parsed_models) == len(known_decay_models) - 3 ) # subtract for now the number of models not yet tested + the number of models presently with no test available From a7b30dbd8905896d1687976dacb459fad3cb22ac Mon Sep 17 00:00:00 2001 From: Eduardo Rodrigues Date: Fri, 17 Nov 2023 09:38:29 +0100 Subject: [PATCH 06/11] Add support for LHCb model RareLbToLll --- src/decaylanguage/data/decfile.lark | 2 +- src/decaylanguage/dec/enums.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/decaylanguage/data/decfile.lark b/src/decaylanguage/data/decfile.lark index bc349acc..9150c498 100644 --- a/src/decaylanguage/data/decfile.lark +++ b/src/decaylanguage/data/decfile.lark @@ -61,7 +61,7 @@ model_options : (value | LABEL | _NEWLINE | _COMMA)+ // Model names must either be followed by at least one whitespace (when they have model parameters) or a semicolon (without model parameters) // We must set priorities here to use lalr - match model name above label, and label above something else -MODEL_NAME.2 : ("BaryonPCR"|"BC_SMN"|"BC_TMN"|"BC_VHAD"|"BC_VMN"|"BCL"|"BGL"|"BLLNUL"|"BNOCB0TO4PICP"|"BNOCBPTO3HPI0"|"BNOCBPTOKSHHH"|"BS_MUMUKK"|"BSTOGLLISRFSR"|"BSTOGLLMNT"|"BT02PI_CP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_CP"|"SSS_CPT"|"STS_CP"|"STS"|"SVP_CP"|"SVP_HELAMP"|"SVP"|"SVS_CP_ISO"|"SVS_CPLH"|"SVS_CP"|"SVS_NONCPEIGEN"|"SVS"|"SVV_CPLH"|"SVV_CP"|"SVV_HELAMP"|"SVV_NONCPEIGEN"|"SVVHELCPMIX"|"TAUHADNU"|"TAULNUNU"|"TAUOLA"|"TAUSCALARNU"|"TAUVECTORNU"|"THREEBODYPHSP"|"TSS"|"TVP"|"TVS_PWAVE"|"VLL"|"VSP_PWAVE"|"VSS_BMIX"|"VSS_MIX"|"VSS"|"VTOSLL"|"VUB"|"VVPIPI"|"VVP"|"VVS_PWAVE"|"XLL"|"YMSTOYNSPIPICLEO"|"YMSTOYNSPIPICLEOBOOST")/\b/ // Terminal definitions // To use a fast parser, we need to avoid conflicts diff --git a/src/decaylanguage/dec/enums.py b/src/decaylanguage/dec/enums.py index dc9ab26a..8e87658c 100644 --- a/src/decaylanguage/dec/enums.py +++ b/src/decaylanguage/dec/enums.py @@ -92,6 +92,7 @@ class PhotosEnum(IntEnum): "PVV_CPLH", "PYCONT", "PYTHIA", + "RareLbToLll", "SLBKPOLE", "SLL", "SLN", From a4276291c742f1592d8b396d795ab0f5ac50e875 Mon Sep 17 00:00:00 2001 From: Eduardo Rodrigues Date: Fri, 17 Nov 2023 09:39:18 +0100 Subject: [PATCH 07/11] Add a model test file + test for it --- tests/data/models/model-RareLbToLll.dec | 7 +++++ tests/data/models/model-SVS_CP_ISO.dec | 15 ++++++++++ tests/dec/test_known_decay_models.py | 37 +++++++++++++++++++++++-- 3 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 tests/data/models/model-RareLbToLll.dec create mode 100644 tests/data/models/model-SVS_CP_ISO.dec diff --git a/tests/data/models/model-RareLbToLll.dec b/tests/data/models/model-RareLbToLll.dec new file mode 100644 index 00000000..272ee230 --- /dev/null +++ b/tests/data/models/model-RareLbToLll.dec @@ -0,0 +1,7 @@ +# File for testing purposes. Contains a single decay mode with a specific model. + +Decay Lambda_b0 + 1.0 Lambda0 mu+ mu- RareLbToLll LQCD; +Enddecay + +End diff --git a/tests/data/models/model-SVS_CP_ISO.dec b/tests/data/models/model-SVS_CP_ISO.dec new file mode 100644 index 00000000..cf239f78 --- /dev/null +++ b/tests/data/models/model-SVS_CP_ISO.dec @@ -0,0 +1,15 @@ +# File for testing purposes. Contains a single decay mode with a specific model. + +Define dm 0.507e12 +Define beta 0.39 +Define gamma 1.387 + +Decay B0 +1.0 a_1- pi+ SVS_CP_ISO beta dm 0.0 1.0 0.0 1.0 0.0 + 1.0 0.0 1.0 0.0 + 1.0 gamma 3.0 -gamma + 3.0 gamma 1.0 -gamma + 0.0 0.0 0.0 0.0; +Enddecay + +End diff --git a/tests/dec/test_known_decay_models.py b/tests/dec/test_known_decay_models.py index 7c87e692..e29f1ff7 100644 --- a/tests/dec/test_known_decay_models.py +++ b/tests/dec/test_known_decay_models.py @@ -84,7 +84,10 @@ def test_lark_file_model_list_consistency(): [5.0, 5, 0, 0, 1, 0.000001, 0.8250, 0.22509, 0.1598, 0.3499, 4.5], ), ("BSTOGLLMNT", [5.0, 5, 1, 1, 0.02, 0.88, 0.227, 0.22, 0.34]), - ("BT02PI_CP_ISO", [0.39, 0.507e12, 1.0, 1.387, 1.0, -1.387, 1.0, 1.387, 1.0, -1.387]), + ( + "BT02PI_CP_ISO", + [0.39, 0.507e12, 1.0, 1.387, 1.0, -1.387, 1.0, 1.387, 1.0, -1.387], + ), ("BTO3PI_CP", [0.507e12, 1.365]), ("BTODDALITZCPK", [1.22, 2.27, 0.10]), ("BToDiBaryonlnupQCD", [67.7, -280.0, -38.3, -840.0, -10.1, -157.0, 800000]), @@ -280,6 +283,7 @@ def test_lark_file_model_list_consistency(): ("PVV_CPLH", [0.02, 1.0, 0.49, 2.50, 0.775, 0.0, 0.4, -0.17]), ("PYCONT", ""), ("PYTHIA", [21]), + ("RareLbToLll", ["LQCD"]), ("SLBKPOLE", [1.0, 0.25, 1.0]), ("SLL", ""), ("SLN", ""), @@ -314,7 +318,34 @@ def test_lark_file_model_list_consistency(): ("SVP_CP", [0.39, 0.507e12, 1, 0.03, 0.0, 0.999, 0.0]), ("SVP_HELAMP", [1.0, 0.0, 1.0, 0.0]), ("SVP", ""), - # ("SVS_CP_ISO", ""), # No dec file available for testing from LHCb or Belle-II + ( + "SVS_CP_ISO", + [ + 0.39, + 0.507e12, + 0.0, + 1.0, + 0.0, + 1.0, + 0.0, + 1.0, + 0.0, + 1.0, + 0.0, + 1.0, + 1.387, + 3.0, + -1.387, + 3.0, + 1.387, + 1.0, + -1.387, + 0.0, + 0.0, + 0.0, + 0.0, + ], + ), ("SVS_CPLH", [0.472e12, 0.1, 1.0, 0.7, 1.0, 0.0, 1.0, 0.0]), ( "SVS_CP", @@ -384,7 +415,7 @@ def test_lark_file_model_list_consistency(): def test_parsing_of_all_known_models_are_tested(): assert ( - len(parsed_models) == len(known_decay_models) - 3 + len(parsed_models) == len(known_decay_models) - 2 ) # subtract for now the number of models not yet tested + the number of models presently with no test available From 2103e923650e08ddea354c55784b817399377dac Mon Sep 17 00:00:00 2001 From: Eduardo Rodrigues Date: Fri, 17 Nov 2023 09:55:09 +0100 Subject: [PATCH 08/11] Remove EvtGen model LQCD wrongly added in PR 336 - it is a model parameter --- src/decaylanguage/data/decfile.lark | 2 +- src/decaylanguage/dec/enums.py | 1 - tests/dec/test_known_decay_models.py | 3 +-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/decaylanguage/data/decfile.lark b/src/decaylanguage/data/decfile.lark index 9150c498..880ef305 100644 --- a/src/decaylanguage/data/decfile.lark +++ b/src/decaylanguage/data/decfile.lark @@ -61,7 +61,7 @@ model_options : (value | LABEL | _NEWLINE | _COMMA)+ // Model names must either be followed by at least one whitespace (when they have model parameters) or a semicolon (without model parameters) // We must set priorities here to use lalr - match model name above label, and label above something else -MODEL_NAME.2 : ("BaryonPCR"|"BC_SMN"|"BC_TMN"|"BC_VHAD"|"BC_VMN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POLE"|"PTO3P"|"PVV_CPLH"|"PYCONT"|"PYTHIA"|"RareLbToLll"|"SLBKPOLE"|"SLL"|"SLN"|"SLPOLE"|"SSD_CP"|"SSD_DirectCP"|"SSS_CP_PNG"|"SSS_CP"|"SSS_CPT"|"STS_CP"|"STS"|"SVP_CP"|"SVP_HELAMP"|"SVP"|"SVS_CP_ISO"|"SVS_CPLH"|"SVS_CP"|"SVS_NONCPEIGEN"|"SVS"|"SVV_CPLH"|"SVV_CP"|"SVV_HELAMP"|"SVV_NONCPEIGEN"|"SVVHELCPMIX"|"TAUHADNU"|"TAULNUNU"|"TAUOLA"|"TAUSCALARNU"|"TAUVECTORNU"|"THREEBODYPHSP"|"TSS"|"TVP"|"TVS_PWAVE"|"VLL"|"VSP_PWAVE"|"VSS_BMIX"|"VSS_MIX"|"VSS"|"VTOSLL"|"VUB"|"VVPIPI"|"VVP"|"VVS_PWAVE"|"XLL"|"YMSTOYNSPIPICLEO"|"YMSTOYNSPIPICLEOBOOST")/\b/ // Terminal definitions // To use a fast parser, we need to avoid conflicts diff --git a/src/decaylanguage/dec/enums.py b/src/decaylanguage/dec/enums.py index 8e87658c..8eaec0a9 100644 --- a/src/decaylanguage/dec/enums.py +++ b/src/decaylanguage/dec/enums.py @@ -78,7 +78,6 @@ class PhotosEnum(IntEnum): "LbAmpGen", "LLSW", "LNUGAMMA", - "LQCD", "MELIKHOV", "OMEGA_DALITZ", "PARTWAVE", diff --git a/tests/dec/test_known_decay_models.py b/tests/dec/test_known_decay_models.py index e29f1ff7..bb3f06e0 100644 --- a/tests/dec/test_known_decay_models.py +++ b/tests/dec/test_known_decay_models.py @@ -149,7 +149,6 @@ def test_lark_file_model_list_consistency(): ("LbAmpGen", ["DtoKpipipi"]), ("LLSW", [0.71, -1.6, -0.5, 2.9]), ("LNUGAMMA", [0.35, 3.0, 5.0, 0.0]), - # ("LQCD", ""), ("MELIKHOV", [1]), ("OMEGA_DALITZ", ""), ("PARTWAVE", [0.0, 0.0, 1.0, 0.0, 0.0, 0.0]), @@ -415,7 +414,7 @@ def test_lark_file_model_list_consistency(): def test_parsing_of_all_known_models_are_tested(): assert ( - len(parsed_models) == len(known_decay_models) - 2 + len(parsed_models) == len(known_decay_models) - 1 ) # subtract for now the number of models not yet tested + the number of models presently with no test available From d1fb1a12239b0235807835242dd037448dbf431c Mon Sep 17 00:00:00 2001 From: Eduardo Rodrigues Date: Fri, 17 Nov 2023 10:04:46 +0100 Subject: [PATCH 09/11] Test model BTOXELNU --- tests/data/models/model-BTOXELNU.dec | 7 +++++++ tests/dec/test_known_decay_models.py | 6 ++---- 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 tests/data/models/model-BTOXELNU.dec diff --git a/tests/data/models/model-BTOXELNU.dec b/tests/data/models/model-BTOXELNU.dec new file mode 100644 index 00000000..8a759d07 --- /dev/null +++ b/tests/data/models/model-BTOXELNU.dec @@ -0,0 +1,7 @@ +# File for testing purposes. Contains a single decay mode with a specific model. + +Decay B+ + 1.0 rho0 mu+ nu_mu PHOTOS BTOXELNU BCL -0.861 1.444 0.266 0.378 0.165 0.291 0.718 0.384 0.331 -0.876 1.907; +Enddecay + +End diff --git a/tests/dec/test_known_decay_models.py b/tests/dec/test_known_decay_models.py index bb3f06e0..7eb96d7f 100644 --- a/tests/dec/test_known_decay_models.py +++ b/tests/dec/test_known_decay_models.py @@ -97,7 +97,7 @@ def test_lark_file_model_list_consistency(): ("BTOSLLMSEXT", [5.0, 5.0, 0.0, 1.0, 0.88, 0.227, 0.22, 0.34, 1.0, 0.0, -1.0, 0.0]), ("BTOVLNUBALL", [0.308, 36.54, -0.054, 0.288, 48.94, 1.484, -1.049, 39.52]), ("BTOXSGAMMA", [2.0]), - # ("BTOXELNU", ""), + ("BTOXELNU", ["BCL", -0.861, 1.444, 0.266, 0.378, 0.165, 0.291, 0.718, 0.384, 0.331, -0.876, 1.907]), ("BTOXSLL", [4.8, 0.2, 0.0, 0.41]), ( "BQTOLLLLHYPERCP", @@ -413,9 +413,7 @@ def test_lark_file_model_list_consistency(): def test_parsing_of_all_known_models_are_tested(): - assert ( - len(parsed_models) == len(known_decay_models) - 1 - ) # subtract for now the number of models not yet tested + the number of models presently with no test available + assert len(parsed_models) == len(known_decay_models) @pytest.mark.parametrize(("decay_model", "expected_model_parameters"), parsed_models) From 0b116d54ead07538f97b1f63d4782a73c1ee2b45 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 17 Nov 2023 09:12:46 +0000 Subject: [PATCH 10/11] style: pre-commit fixes --- tests/data/models/model-BTOXELNU.dec | 2 +- tests/dec/test_known_decay_models.py | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/data/models/model-BTOXELNU.dec b/tests/data/models/model-BTOXELNU.dec index 8a759d07..d474be39 100644 --- a/tests/data/models/model-BTOXELNU.dec +++ b/tests/data/models/model-BTOXELNU.dec @@ -1,7 +1,7 @@ # File for testing purposes. Contains a single decay mode with a specific model. Decay B+ - 1.0 rho0 mu+ nu_mu PHOTOS BTOXELNU BCL -0.861 1.444 0.266 0.378 0.165 0.291 0.718 0.384 0.331 -0.876 1.907; + 1.0 rho0 mu+ nu_mu PHOTOS BTOXELNU BCL -0.861 1.444 0.266 0.378 0.165 0.291 0.718 0.384 0.331 -0.876 1.907; Enddecay End diff --git a/tests/dec/test_known_decay_models.py b/tests/dec/test_known_decay_models.py index 7eb96d7f..1c82dd83 100644 --- a/tests/dec/test_known_decay_models.py +++ b/tests/dec/test_known_decay_models.py @@ -97,7 +97,23 @@ def test_lark_file_model_list_consistency(): ("BTOSLLMSEXT", [5.0, 5.0, 0.0, 1.0, 0.88, 0.227, 0.22, 0.34, 1.0, 0.0, -1.0, 0.0]), ("BTOVLNUBALL", [0.308, 36.54, -0.054, 0.288, 48.94, 1.484, -1.049, 39.52]), ("BTOXSGAMMA", [2.0]), - ("BTOXELNU", ["BCL", -0.861, 1.444, 0.266, 0.378, 0.165, 0.291, 0.718, 0.384, 0.331, -0.876, 1.907]), + ( + "BTOXELNU", + [ + "BCL", + -0.861, + 1.444, + 0.266, + 0.378, + 0.165, + 0.291, + 0.718, + 0.384, + 0.331, + -0.876, + 1.907, + ], + ), ("BTOXSLL", [4.8, 0.2, 0.0, 0.41]), ( "BQTOLLLLHYPERCP", From 1382cf71fb7f4e3602b2afa96a5167d0aaded3fd Mon Sep 17 00:00:00 2001 From: Eduardo Rodrigues Date: Fri, 17 Nov 2023 10:23:24 +0100 Subject: [PATCH 11/11] Simplify logic - thanks ruff --- src/decaylanguage/dec/dec.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/decaylanguage/dec/dec.py b/src/decaylanguage/dec/dec.py index 9da8a90f..474424e3 100644 --- a/src/decaylanguage/dec/dec.py +++ b/src/decaylanguage/dec/dec.py @@ -1117,7 +1117,7 @@ def _replacement(self, t: Tree) -> None: t.children[0].value = float(t.children[0].value) except AttributeError: negative_param = ( - True if t.value[0] == "-" else False + t.value[0] == "-" ) # account for uncommon cases such as "MODEL_NAME ... -DEFINE_NAME" value = t.value if not negative_param else t.value[1:] if value in self.define_defs: