From b4aa877f4e12a62e4d2cce85e7ccab5d2e505638 Mon Sep 17 00:00:00 2001 From: Paul Sharp <44529197+DrPaulSharp@users.noreply.github.com> Date: Thu, 27 Jun 2024 10:36:02 +0100 Subject: [PATCH 1/2] Updates DREAM defaults --- RATpy/controls.py | 12 ++++++------ tests/test_controls.py | 14 ++++++++------ tests/test_inputs.py | 10 ++++++---- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/RATpy/controls.py b/RATpy/controls.py index be54ab89..64e94ca8 100644 --- a/RATpy/controls.py +++ b/RATpy/controls.py @@ -38,12 +38,12 @@ class Controls: propScale: float = 0.1 nsTolerance: float = 0.1 # Dream - nSamples: int = 50000 + nSamples: int = 2000 nChains: int = 10 jumpProbability: float = 0.5 pUnitGamma: float = 0.2 - boundHandling: BoundHandling = BoundHandling.Fold - adaptPCR: bool = False + boundHandling: BoundHandling = BoundHandling.Reflect + adaptPCR: bool = True class Calculate(BaseModel, validate_assignment=True, extra="forbid"): @@ -109,12 +109,12 @@ class Dream(Calculate): """Defines the additional fields for the Dream procedure.""" procedure: Literal[Procedures.Dream] = Procedures.Dream - nSamples: int = Field(50000, ge=0) + nSamples: int = Field(2000, ge=0) nChains: int = Field(10, gt=0) jumpProbability: float = Field(0.5, gt=0.0, lt=1.0) pUnitGamma: float = Field(0.2, gt=0.0, lt=1.0) - boundHandling: BoundHandling = BoundHandling.Fold - adaptPCR: bool = False + boundHandling: BoundHandling = BoundHandling.Reflect + adaptPCR: bool = True def set_controls( diff --git a/tests/test_controls.py b/tests/test_controls.py index 0f806374..42783244 100644 --- a/tests/test_controls.py +++ b/tests/test_controls.py @@ -479,11 +479,12 @@ def setup_class(self): ("resampleParams", [0.9, 50]), ("display", Display.Iter), ("procedure", Procedures.Dream), - ("nSamples", 50000), + ("nSamples", 2000), ("nChains", 10), ("jumpProbability", 0.5), ("pUnitGamma", 0.2), - ("boundHandling", BoundHandling.Fold), + ("boundHandling", BoundHandling.Reflect), + ("adaptPCR", True), ], ) def test_dream_property_values(self, control_property: str, value: Any) -> None: @@ -501,7 +502,8 @@ def test_dream_property_values(self, control_property: str, value: Any) -> None: ("nChains", 1000), ("jumpProbability", 0.7), ("pUnitGamma", 0.3), - ("boundHandling", BoundHandling.Reflect), + ("boundHandling", BoundHandling.Fold), + ("adaptPCR", False), ], ) def test_dream_property_setters(self, control_property: str, value: Any) -> None: @@ -568,12 +570,12 @@ def test_control_class_dream_repr(self) -> None: "| calcSldDuringFit | False |\n" "| resampleParams | [0.9, 50] |\n" "| display | iter |\n" - "| nSamples | 50000 |\n" + "| nSamples | 2000 |\n" "| nChains | 10 |\n" "| jumpProbability | 0.5 |\n" "| pUnitGamma | 0.2 |\n" - "| boundHandling | fold |\n" - "| adaptPCR | False |\n" + "| boundHandling | reflect |\n" + "| adaptPCR | True |\n" "+------------------+-----------+" ) diff --git a/tests/test_inputs.py b/tests/test_inputs.py index 100af9a0..3f7117c6 100644 --- a/tests/test_inputs.py +++ b/tests/test_inputs.py @@ -488,11 +488,12 @@ def standard_layers_controls(): controls.nMCMC = 0.0 controls.propScale = 0.1 controls.nsTolerance = 0.1 - controls.nSamples = 50000 + controls.nSamples = 2000 controls.nChains = 10 controls.jumpProbability = 0.5 controls.pUnitGamma = 0.2 - controls.boundHandling = BoundHandling.Fold + controls.boundHandling = BoundHandling.Reflect + controls.adaptPCR = True controls.checks.fitParam = [1, 0, 0, 0] controls.checks.fitBackgroundParam = [0] controls.checks.fitQzshift = [] @@ -532,11 +533,12 @@ def custom_xy_controls(): controls.nMCMC = 0.0 controls.propScale = 0.1 controls.nsTolerance = 0.1 - controls.nSamples = 50000 + controls.nSamples = 2000 controls.nChains = 10 controls.jumpProbability = 0.5 controls.pUnitGamma = 0.2 - controls.boundHandling = BoundHandling.Fold + controls.boundHandling = BoundHandling.Reflect + controls.adaptPCR = True controls.checks.fitParam = [1, 0, 0, 0] controls.checks.fitBackgroundParam = [0] controls.checks.fitQzshift = [] From dc85a80874d049a35bbf7b5c82a4104c47d6d991 Mon Sep 17 00:00:00 2001 From: Paul Sharp <44529197+DrPaulSharp@users.noreply.github.com> Date: Thu, 27 Jun 2024 14:51:59 +0100 Subject: [PATCH 2/2] Corrects nSamples --- RATpy/controls.py | 4 ++-- tests/test_controls.py | 4 ++-- tests/test_inputs.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/RATpy/controls.py b/RATpy/controls.py index 64e94ca8..d5785f6a 100644 --- a/RATpy/controls.py +++ b/RATpy/controls.py @@ -38,7 +38,7 @@ class Controls: propScale: float = 0.1 nsTolerance: float = 0.1 # Dream - nSamples: int = 2000 + nSamples: int = 20000 nChains: int = 10 jumpProbability: float = 0.5 pUnitGamma: float = 0.2 @@ -109,7 +109,7 @@ class Dream(Calculate): """Defines the additional fields for the Dream procedure.""" procedure: Literal[Procedures.Dream] = Procedures.Dream - nSamples: int = Field(2000, ge=0) + nSamples: int = Field(20000, ge=0) nChains: int = Field(10, gt=0) jumpProbability: float = Field(0.5, gt=0.0, lt=1.0) pUnitGamma: float = Field(0.2, gt=0.0, lt=1.0) diff --git a/tests/test_controls.py b/tests/test_controls.py index 42783244..7a030985 100644 --- a/tests/test_controls.py +++ b/tests/test_controls.py @@ -479,7 +479,7 @@ def setup_class(self): ("resampleParams", [0.9, 50]), ("display", Display.Iter), ("procedure", Procedures.Dream), - ("nSamples", 2000), + ("nSamples", 20000), ("nChains", 10), ("jumpProbability", 0.5), ("pUnitGamma", 0.2), @@ -570,7 +570,7 @@ def test_control_class_dream_repr(self) -> None: "| calcSldDuringFit | False |\n" "| resampleParams | [0.9, 50] |\n" "| display | iter |\n" - "| nSamples | 2000 |\n" + "| nSamples | 20000 |\n" "| nChains | 10 |\n" "| jumpProbability | 0.5 |\n" "| pUnitGamma | 0.2 |\n" diff --git a/tests/test_inputs.py b/tests/test_inputs.py index 3f7117c6..dd415f26 100644 --- a/tests/test_inputs.py +++ b/tests/test_inputs.py @@ -488,7 +488,7 @@ def standard_layers_controls(): controls.nMCMC = 0.0 controls.propScale = 0.1 controls.nsTolerance = 0.1 - controls.nSamples = 2000 + controls.nSamples = 20000 controls.nChains = 10 controls.jumpProbability = 0.5 controls.pUnitGamma = 0.2 @@ -533,7 +533,7 @@ def custom_xy_controls(): controls.nMCMC = 0.0 controls.propScale = 0.1 controls.nsTolerance = 0.1 - controls.nSamples = 2000 + controls.nSamples = 20000 controls.nChains = 10 controls.jumpProbability = 0.5 controls.pUnitGamma = 0.2