Skip to content

Commit 8120a5e

Browse files
committed
added newlines
1 parent edc8d07 commit 8120a5e

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

RATapi/controls.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,65 +45,93 @@ class Controls(BaseModel, validate_assignment=True, extra="forbid"):
4545
# All Procedures
4646
procedure: Procedures = Procedures.Calculate
4747
"""Which procedure RAT should execute. Can be 'calculate', 'simplex', 'de', 'ns', or 'dream'."""
48+
4849
parallel: Parallel = Parallel.Single
4950
"""How the calculation should be parallelised. Can be 'single', 'contrasts' or 'points'."""
51+
5052
calcSldDuringFit: bool = False
5153
"""Whether SLD will be calculated during fit (for live plotting etc.)"""
54+
5255
resampleMinAngle: float = Field(0.9, le=1, gt=0)
5356
"""The upper threshold on the angle between three sampled points for resampling, in radians over pi."""
57+
5458
resampleNPoints: int = Field(50, gt=0)
5559
"""The number of initial points to use for resampling."""
60+
5661
display: Display = Display.Iter
5762
"""How much RAT should print to the terminal. Can be 'off', 'iter', 'notify', or 'final'."""
63+
5864
# Simplex
5965
xTolerance: float = Field(1.0e-6, gt=0.0)
6066
"""[SIMPLEX] The termination tolerance for step size."""
67+
6168
funcTolerance: float = Field(1.0e-6, gt=0.0)
6269
"""[SIMPLEX] The termination tolerance for change in chi-squared."""
70+
6371
maxFuncEvals: int = Field(10000, gt=0)
6472
"""[SIMPLEX] The maximum number of function evaluations before the algorithm terminates."""
73+
6574
maxIterations: int = Field(1000, gt=0)
6675
"""[SIMPLEX] The maximum number of iterations before the algorithm terminates."""
76+
6777
# Simplex and DE
6878
updateFreq: int = 1
6979
"""[SIMPLEX, DE] How often to print out progress to the terminal, in iterations."""
80+
7081
updatePlotFreq: int = 20
7182
"""[SIMPLEX, DE] How often the live plot should be updated if using."""
83+
7284
# DE
7385
populationSize: int = Field(20, ge=1)
7486
"""[DE] The number of candidate solutions that exist at any time."""
87+
7588
fWeight: float = 0.5
7689
"""[DE] The step size for how different mutations are to their parents."""
90+
7791
crossoverProbability: float = Field(0.8, gt=0.0, lt=1.0)
7892
"""[DE] The probability of exchange of parameters between individuals at any iteration."""
93+
7994
strategy: Strategies = Strategies.RandomWithPerVectorDither
8095
"""[DE] The algorithm used to generate new candidates."""
96+
8197
targetValue: float = Field(1.0, ge=1.0)
8298
"""[DE] The value of chi-squared at which the algorithm will terminate."""
99+
83100
numGenerations: int = Field(500, ge=1)
84101
"""[DE] The maximum number of iterations before the algorithm terminates."""
102+
85103
# NS
86104
nLive: int = Field(150, ge=1)
87105
"""[NS] The number of points to sample."""
106+
88107
nMCMC: int = Field(0, ge=0)
89108
"""[NS] If non-zero, an MCMC process with ``nMCMC`` chains will be used instead of MultiNest."""
109+
90110
propScale: float = Field(0.1, gt=0.0, lt=1.0)
91111
"""[NS] A scaling factor for the ellipsoid generated by MultiNest."""
112+
92113
nsTolerance: float = Field(0.1, ge=0.0)
93114
"""[NS] The tolerance threshold for when the algorithm should terminate."""
115+
94116
# Dream
95117
nSamples: int = Field(20000, ge=0)
96118
"""[DREAM] The number of samples in the initial population for each chain."""
119+
97120
nChains: int = Field(10, gt=0)
98121
"""[DREAM] The number of Markov chains to use in the algorithm."""
122+
99123
jumpProbability: float = Field(0.5, gt=0.0, lt=1.0)
100124
"""[DREAM] The probability range for the size of jumps in sampling. Larger values mean more variable jumps."""
125+
101126
pUnitGamma: float = Field(0.2, gt=0.0, lt=1.0)
102127
"""[DREAM] The probability that the scaling-down factor of jumps will be ignored and a larger jump will be taken."""
128+
103129
boundHandling: BoundHandling = BoundHandling.Reflect
104130
"""[DREAM] How steps past the space boundaries should be handled. Can be 'off', 'reflect', 'bound', or 'fold'."""
131+
105132
adaptPCR: bool = True
106133
"""[DREAM] Whether the crossover probability for differential evolution should be adapted during the run."""
134+
107135
# Private field for IPC file
108136
_IPCFilePath: str = ""
109137

RATapi/project.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,16 @@ class Project(BaseModel, validate_assignment=True, extra="forbid"):
135135

136136
name: str = ""
137137
"""The name of the project."""
138+
138139
calculation: Calculations = Calculations.Normal
139140
"""What calculation type should be used. Can be 'normal' or 'domains'."""
141+
140142
model: LayerModels = LayerModels.StandardLayers
141143
"""What layer model should be used. Can be 'standard layers', 'custom layers', or 'custom xy'."""
144+
142145
geometry: Geometries = Geometries.AirSubstrate
143146
"""What geometry should be used. Can be 'air/substrate' or 'substrate/liquid'"""
147+
144148
absorption: bool = False
145149
"""Whether imaginary (absorption) SLD should be accounted for."""
146150

@@ -243,8 +247,10 @@ class Project(BaseModel, validate_assignment=True, extra="forbid"):
243247

244248
custom_files: ClassList[RATapi.models.CustomFile] = ClassList()
245249
"""Handles for custom files used by the project."""
250+
246251
data: ClassList[RATapi.models.Data] = ClassList()
247252
"""Arrays of experimental data corresponding to a model."""
253+
248254
layers: Union[
249255
Annotated[ClassList[RATapi.models.Layer], Tag("no_abs")],
250256
Annotated[ClassList[RATapi.models.AbsorptionLayer], Tag("abs")],
@@ -258,8 +264,10 @@ class Project(BaseModel, validate_assignment=True, extra="forbid"):
258264
),
259265
)
260266
"""The layers of a standard layer model."""
267+
261268
domain_contrasts: ClassList[RATapi.models.DomainContrast] = ClassList()
262269
"""The groups of layers required by each domain in a domains model."""
270+
263271
contrasts: Union[
264272
Annotated[ClassList[RATapi.models.Contrast], Tag("no_ratio")],
265273
Annotated[ClassList[RATapi.models.ContrastWithRatio], Tag("ratio")],

0 commit comments

Comments
 (0)