Skip to content

Commit bc126bc

Browse files
committed
review fixes
1 parent 8120a5e commit bc126bc

File tree

2 files changed

+15
-21
lines changed

2 files changed

+15
-21
lines changed

RATapi/controls.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import prettytable
77
from pydantic import (
88
BaseModel,
9-
ConfigDict,
109
Field,
1110
ValidationError,
1211
ValidatorFunctionWrapHandler,
@@ -37,11 +36,9 @@
3736
}
3837

3938

40-
class Controls(BaseModel, validate_assignment=True, extra="forbid"):
39+
class Controls(BaseModel, validate_assignment=True, extra="forbid", use_attribute_docstrings=True):
4140
"""The full set of controls parameters for all five procedures that are required for the compiled RAT code."""
4241

43-
model_config = ConfigDict(use_attribute_docstrings=True)
44-
4542
# All Procedures
4643
procedure: Procedures = Procedures.Calculate
4744
"""Which procedure RAT should execute. Can be 'calculate', 'simplex', 'de', 'ns', or 'dream'."""
@@ -53,7 +50,7 @@ class Controls(BaseModel, validate_assignment=True, extra="forbid"):
5350
"""Whether SLD will be calculated during fit (for live plotting etc.)"""
5451

5552
resampleMinAngle: float = Field(0.9, le=1, gt=0)
56-
"""The upper threshold on the angle between three sampled points for resampling, in radians over pi."""
53+
"""The upper threshold on the angle between three sampled points for resampling, in units of radians over pi."""
5754

5855
resampleNPoints: int = Field(50, gt=0)
5956
"""The number of initial points to use for resampling."""
@@ -76,10 +73,10 @@ class Controls(BaseModel, validate_assignment=True, extra="forbid"):
7673

7774
# Simplex and DE
7875
updateFreq: int = 1
79-
"""[SIMPLEX, DE] How often to print out progress to the terminal, in iterations."""
76+
"""[SIMPLEX, DE] Number of iterations between printing progress updates to the terminal."""
8077

8178
updatePlotFreq: int = 20
82-
"""[SIMPLEX, DE] How often the live plot should be updated if using."""
79+
"""[SIMPLEX, DE] Number of iterations between updates to live plots."""
8380

8481
# DE
8582
populationSize: int = Field(20, ge=1)

RATapi/project.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import numpy as np
1212
from pydantic import (
1313
BaseModel,
14-
ConfigDict,
1514
Discriminator,
1615
Field,
1716
Tag,
@@ -124,15 +123,13 @@ def discriminate_contrasts(contrast_input):
124123
]
125124

126125

127-
class Project(BaseModel, validate_assignment=True, extra="forbid"):
126+
class Project(BaseModel, validate_assignment=True, extra="forbid", use_attribute_docstrings=True):
128127
"""Defines the input data for a reflectivity calculation in RAT.
129128
130129
This class combines the data defined in each of the pydantic models included in "models.py" into the full set of
131130
inputs required for a reflectivity calculation.
132131
"""
133132

134-
model_config = ConfigDict(use_attribute_docstrings=True)
135-
136133
name: str = ""
137134
"""The name of the project."""
138135

@@ -146,7 +143,7 @@ class Project(BaseModel, validate_assignment=True, extra="forbid"):
146143
"""What geometry should be used. Can be 'air/substrate' or 'substrate/liquid'"""
147144

148145
absorption: bool = False
149-
"""Whether imaginary (absorption) SLD should be accounted for."""
146+
"""Whether imaginary SLD (absorption) should be accounted for."""
150147

151148
parameters: ClassList[RATapi.models.Parameter] = ClassList()
152149
"""The list of parameters used in the layers of a model."""
@@ -163,7 +160,7 @@ class Project(BaseModel, validate_assignment=True, extra="forbid"):
163160
sigma=np.inf,
164161
),
165162
)
166-
"""The parameters for SLD of the entry interfaces of a model."""
163+
"""The list of parameters for SLD of the entry interfaces of a model."""
167164

168165
bulk_out: ClassList[RATapi.models.Parameter] = ClassList(
169166
RATapi.models.Parameter(
@@ -177,7 +174,7 @@ class Project(BaseModel, validate_assignment=True, extra="forbid"):
177174
sigma=np.inf,
178175
),
179176
)
180-
"""The parameters for SLD of the exit interfaces of a model."""
177+
"""The list of parameters for SLD of the exit interfaces of a model."""
181178

182179
scalefactors: ClassList[RATapi.models.Parameter] = ClassList(
183180
RATapi.models.Parameter(
@@ -191,7 +188,7 @@ class Project(BaseModel, validate_assignment=True, extra="forbid"):
191188
sigma=np.inf,
192189
),
193190
)
194-
"""The parameters for scale factors to handle systematic error in model data."""
191+
"""The list of parameters for scale factors to handle systematic error in model data."""
195192

196193
domain_ratios: ClassList[RATapi.models.Parameter] = ClassList(
197194
RATapi.models.Parameter(
@@ -205,7 +202,7 @@ class Project(BaseModel, validate_assignment=True, extra="forbid"):
205202
sigma=np.inf,
206203
),
207204
)
208-
"""The parameters for weighting between domains of a domains model."""
205+
"""The list of parameters for weighting between domains of a domains model."""
209206

210207
background_parameters: ClassList[RATapi.models.Parameter] = ClassList(
211208
RATapi.models.Parameter(
@@ -219,12 +216,12 @@ class Project(BaseModel, validate_assignment=True, extra="forbid"):
219216
sigma=np.inf,
220217
),
221218
)
222-
"""The parameters for models of backgrounds."""
219+
"""The list of parameters for models of backgrounds."""
223220

224221
backgrounds: ClassList[RATapi.models.Background] = ClassList(
225222
RATapi.models.Background(name="Background 1", type=TypeOptions.Constant, source="Background Param 1"),
226223
)
227-
"""The models for background noise in the project."""
224+
"""The list of models for background noise in the project."""
228225

229226
resolution_parameters: ClassList[RATapi.models.Parameter] = ClassList(
230227
RATapi.models.Parameter(
@@ -238,18 +235,18 @@ class Project(BaseModel, validate_assignment=True, extra="forbid"):
238235
sigma=np.inf,
239236
),
240237
)
241-
"""The parameters for models of resolutions."""
238+
"""The list of parameters for models of resolutions."""
242239

243240
resolutions: ClassList[RATapi.models.Resolution] = ClassList(
244241
RATapi.models.Resolution(name="Resolution 1", type=TypeOptions.Constant, source="Resolution Param 1"),
245242
)
246-
"""The models for instrument resolution in the project."""
243+
"""The list of models for instrument resolution in the project."""
247244

248245
custom_files: ClassList[RATapi.models.CustomFile] = ClassList()
249246
"""Handles for custom files used by the project."""
250247

251248
data: ClassList[RATapi.models.Data] = ClassList()
252-
"""Arrays of experimental data corresponding to a model."""
249+
"""Experimental data for a model."""
253250

254251
layers: Union[
255252
Annotated[ClassList[RATapi.models.Layer], Tag("no_abs")],

0 commit comments

Comments
 (0)