Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates DREAM defaults #39

Merged
merged 2 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions RATpy/controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ class Controls:
propScale: float = 0.1
nsTolerance: float = 0.1
# Dream
nSamples: int = 50000
nSamples: int = 20000
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"):
Expand Down Expand Up @@ -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(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)
boundHandling: BoundHandling = BoundHandling.Fold
adaptPCR: bool = False
boundHandling: BoundHandling = BoundHandling.Reflect
adaptPCR: bool = True


def set_controls(
Expand Down
14 changes: 8 additions & 6 deletions tests/test_controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,11 +479,12 @@ def setup_class(self):
("resampleParams", [0.9, 50]),
("display", Display.Iter),
("procedure", Procedures.Dream),
("nSamples", 50000),
("nSamples", 20000),
("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:
Expand All @@ -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:
Expand Down Expand Up @@ -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 | 20000 |\n"
"| nChains | 10 |\n"
"| jumpProbability | 0.5 |\n"
"| pUnitGamma | 0.2 |\n"
"| boundHandling | fold |\n"
"| adaptPCR | False |\n"
"| boundHandling | reflect |\n"
"| adaptPCR | True |\n"
"+------------------+-----------+"
)

Expand Down
10 changes: 6 additions & 4 deletions tests/test_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = 20000
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 = []
Expand Down Expand Up @@ -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 = 20000
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 = []
Expand Down
Loading