RATapi 0.0.0.dev0__cp39-cp39-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. RATapi/__init__.py +8 -0
  2. RATapi/classlist.py +387 -0
  3. RATapi/controls.py +143 -0
  4. RATapi/eventManager.dll +0 -0
  5. RATapi/events.py +70 -0
  6. RATapi/examples/__init__.py +0 -0
  7. RATapi/examples/absorption/__init__.py +0 -0
  8. RATapi/examples/absorption/absorption.py +148 -0
  9. RATapi/examples/absorption/volume_thiol_bilayer.py +138 -0
  10. RATapi/examples/data/D2O_spin_down.dat +100 -0
  11. RATapi/examples/data/D2O_spin_up.dat +101 -0
  12. RATapi/examples/data/DSPC_D2O.dat +82 -0
  13. RATapi/examples/data/DSPC_SMW.dat +82 -0
  14. RATapi/examples/data/H2O_spin_down.dat +102 -0
  15. RATapi/examples/data/H2O_spin_up.dat +102 -0
  16. RATapi/examples/data/__init__.py +0 -0
  17. RATapi/examples/data/c_PLP0016596.dat +146 -0
  18. RATapi/examples/data/c_PLP0016601.dat +97 -0
  19. RATapi/examples/data/c_PLP0016607.dat +104 -0
  20. RATapi/examples/domains/__init__.py +0 -0
  21. RATapi/examples/domains/alloy_domains.py +26 -0
  22. RATapi/examples/domains/domains_XY_model.py +70 -0
  23. RATapi/examples/domains/domains_custom_XY.py +69 -0
  24. RATapi/examples/domains/domains_custom_layers.py +46 -0
  25. RATapi/examples/domains/domains_standard_layers.py +75 -0
  26. RATapi/examples/languages/__init__.py +0 -0
  27. RATapi/examples/languages/custom_bilayer.py +66 -0
  28. RATapi/examples/languages/run_custom_file_languages.py +41 -0
  29. RATapi/examples/languages/setup_problem.py +130 -0
  30. RATapi/examples/non_polarised/DSPC_custom_XY.py +140 -0
  31. RATapi/examples/non_polarised/DSPC_custom_layers.py +121 -0
  32. RATapi/examples/non_polarised/DSPC_standard_layers.py +358 -0
  33. RATapi/examples/non_polarised/__init__.py +0 -0
  34. RATapi/examples/non_polarised/custom_XY_DSPC.py +137 -0
  35. RATapi/examples/non_polarised/custom_bilayer_DSPC.py +85 -0
  36. RATapi/inputs.py +471 -0
  37. RATapi/models.py +288 -0
  38. RATapi/outputs.py +218 -0
  39. RATapi/project.py +659 -0
  40. RATapi/rat_core.cp39-win_amd64.pyd +0 -0
  41. RATapi/run.py +35 -0
  42. RATapi/utils/__init__.py +0 -0
  43. RATapi/utils/custom_errors.py +42 -0
  44. RATapi/utils/enums.py +101 -0
  45. RATapi/utils/plotting.py +211 -0
  46. RATapi/wrappers.py +115 -0
  47. RATapi-0.0.0.dev0.dist-info/METADATA +57 -0
  48. RATapi-0.0.0.dev0.dist-info/RECORD +64 -0
  49. RATapi-0.0.0.dev0.dist-info/WHEEL +5 -0
  50. RATapi-0.0.0.dev0.dist-info/top_level.txt +2 -0
  51. tests/__init__.py +0 -0
  52. tests/conftest.py +4728 -0
  53. tests/test_classlist.py +882 -0
  54. tests/test_controls.py +863 -0
  55. tests/test_custom_errors.py +49 -0
  56. tests/test_events.py +61 -0
  57. tests/test_inputs.py +908 -0
  58. tests/test_models.py +308 -0
  59. tests/test_outputs.py +31 -0
  60. tests/test_plotting.py +167 -0
  61. tests/test_project.py +1387 -0
  62. tests/test_run.py +570 -0
  63. tests/test_wrappers.py +57 -0
  64. tests/utils.py +171 -0
RATapi/models.py ADDED
@@ -0,0 +1,288 @@
1
+ """The models module. Contains the pydantic models used by RAT to store project parameters."""
2
+
3
+ import pathlib
4
+ from typing import Any, Union
5
+
6
+ import numpy as np
7
+ import prettytable
8
+ from pydantic import BaseModel, Field, ValidationInfo, field_validator, model_validator
9
+
10
+ from RATapi.utils.enums import BackgroundActions, Hydration, Languages, Priors, TypeOptions
11
+
12
+ try:
13
+ from enum import StrEnum
14
+ except ImportError:
15
+ from strenum import StrEnum
16
+
17
+
18
+ def int_sequence():
19
+ """Iterate through integers for use as model counters."""
20
+ num = 1
21
+ while True:
22
+ yield str(num)
23
+ num += 1
24
+
25
+
26
+ # Create a counter for each model
27
+ background_number = int_sequence()
28
+ contrast_number = int_sequence()
29
+ custom_file_number = int_sequence()
30
+ data_number = int_sequence()
31
+ domain_contrast_number = int_sequence()
32
+ layer_number = int_sequence()
33
+ parameter_number = int_sequence()
34
+ resolution_number = int_sequence()
35
+
36
+
37
+ class RATModel(BaseModel, validate_assignment=True, extra="forbid"):
38
+ """A BaseModel where enums are represented by their value."""
39
+
40
+ def __repr__(self):
41
+ fields_repr = ", ".join(
42
+ repr(v) if a is None else f"{a}={v.value!r}" if isinstance(v, StrEnum) else f"{a}={v!r}"
43
+ for a, v in self.__repr_args__()
44
+ )
45
+ return f"{self.__repr_name__()}({fields_repr})"
46
+
47
+ def __str__(self):
48
+ table = prettytable.PrettyTable()
49
+ table.field_names = [key.replace("_", " ") for key in self.__dict__]
50
+ table.add_row(list(self.__dict__.values()))
51
+ return table.get_string()
52
+
53
+
54
+ class Background(RATModel):
55
+ """Defines the Backgrounds in RAT."""
56
+
57
+ name: str = Field(default_factory=lambda: "New Background " + next(background_number), min_length=1)
58
+ type: TypeOptions = TypeOptions.Constant
59
+ value_1: str = ""
60
+ value_2: str = ""
61
+ value_3: str = ""
62
+ value_4: str = ""
63
+ value_5: str = ""
64
+
65
+
66
+ class Contrast(RATModel):
67
+ """Groups together all of the components of the model."""
68
+
69
+ name: str = Field(default_factory=lambda: "New Contrast " + next(contrast_number), min_length=1)
70
+ data: str = ""
71
+ background: str = ""
72
+ background_action: BackgroundActions = BackgroundActions.Add
73
+ bulk_in: str = ""
74
+ bulk_out: str = ""
75
+ scalefactor: str = ""
76
+ resolution: str = ""
77
+ resample: bool = False
78
+ model: list[str] = []
79
+
80
+
81
+ class ContrastWithRatio(RATModel):
82
+ """Groups together all of the components of the model including domain terms."""
83
+
84
+ name: str = Field(default_factory=lambda: "New Contrast " + next(contrast_number), min_length=1)
85
+ data: str = ""
86
+ background: str = ""
87
+ background_action: BackgroundActions = BackgroundActions.Add
88
+ bulk_in: str = ""
89
+ bulk_out: str = ""
90
+ scalefactor: str = ""
91
+ resolution: str = ""
92
+ resample: bool = False
93
+ domain_ratio: str = ""
94
+ model: list[str] = []
95
+
96
+
97
+ class CustomFile(RATModel):
98
+ """Defines the files containing functions to run when using custom models."""
99
+
100
+ name: str = Field(default_factory=lambda: "New Custom File " + next(custom_file_number), min_length=1)
101
+ filename: str = ""
102
+ function_name: str = ""
103
+ language: Languages = Languages.Python
104
+ path: Union[str, pathlib.Path] = ""
105
+
106
+ def model_post_init(self, __context: Any) -> None:
107
+ """If a "filename" is supplied but the "function_name" field is not set, the "function_name" should be set to
108
+ the file name without the extension.
109
+ """
110
+ if "filename" in self.model_fields_set and "function_name" not in self.model_fields_set:
111
+ self.function_name = pathlib.Path(self.filename).stem
112
+
113
+ @model_validator(mode="after")
114
+ def set_matlab_function_name(self):
115
+ """If we have a matlab custom function, the "function_name" should be set to the filename without the
116
+ extension.
117
+ """
118
+ if self.language == Languages.Matlab and self.function_name != pathlib.Path(self.filename).stem:
119
+ self.function_name = pathlib.Path(self.filename).stem
120
+
121
+ return self
122
+
123
+
124
+ class Data(RATModel, arbitrary_types_allowed=True):
125
+ """Defines the dataset required for each contrast."""
126
+
127
+ name: str = Field(default_factory=lambda: "New Data " + next(data_number), min_length=1)
128
+ data: np.ndarray[np.float64] = np.empty([0, 3])
129
+ data_range: list[float] = Field(default=[], min_length=2, max_length=2)
130
+ simulation_range: list[float] = Field(default=[], min_length=2, max_length=2)
131
+
132
+ @field_validator("data")
133
+ @classmethod
134
+ def check_data_dimension(cls, data: np.ndarray[float]) -> np.ndarray[float]:
135
+ """The data must be a two-dimensional array containing at least three columns."""
136
+ try:
137
+ data.shape[1]
138
+ except IndexError:
139
+ raise ValueError('"data" must have at least two dimensions') from None
140
+ else:
141
+ if data.shape[1] < 3:
142
+ raise ValueError('"data" must have at least three columns') from None
143
+ return data
144
+
145
+ @field_validator("data_range", "simulation_range")
146
+ @classmethod
147
+ def check_min_max(cls, limits: list[float], info: ValidationInfo) -> list[float]:
148
+ """The data range and simulation range maximum must be greater than the minimum."""
149
+ if limits[0] > limits[1]:
150
+ raise ValueError(f'{info.field_name} "min" value is greater than the "max" value')
151
+ return limits
152
+
153
+ def model_post_init(self, __context: Any) -> None:
154
+ """If the "data_range" and "simulation_range" fields are not set, but "data" is supplied, the ranges should be
155
+ set to the min and max values of the first column (assumed to be q) of the supplied data.
156
+ """
157
+ if self.data.shape[0] > 0:
158
+ data_min = float(np.min(self.data[:, 0]))
159
+ data_max = float(np.max(self.data[:, 0]))
160
+ for field in ["data_range", "simulation_range"]:
161
+ if field not in self.model_fields_set:
162
+ getattr(self, field).extend([data_min, data_max])
163
+
164
+ @model_validator(mode="after")
165
+ def check_ranges(self) -> "Data":
166
+ """The limits of the "data_range" field must lie within the range of the supplied data, whilst the limits
167
+ of the "simulation_range" field must lie outside the range of the supplied data.
168
+ """
169
+ if self.data.shape[0] > 0:
170
+ data_min = np.min(self.data[:, 0])
171
+ data_max = np.max(self.data[:, 0])
172
+ if "data_range" in self.model_fields_set and (
173
+ self.data_range[0] < data_min or self.data_range[1] > data_max
174
+ ):
175
+ raise ValueError(
176
+ f"The data_range value of: {self.data_range} must lie within the min/max values of "
177
+ f"the data: [{data_min}, {data_max}]",
178
+ )
179
+ if "simulation_range" in self.model_fields_set and (
180
+ self.simulation_range[0] > data_min or self.simulation_range[1] < data_max
181
+ ):
182
+ raise ValueError(
183
+ f"The simulation_range value of: {self.simulation_range} must lie outside of the "
184
+ f"min/max values of the data: [{data_min}, {data_max}]",
185
+ )
186
+ return self
187
+
188
+ def __eq__(self, other: object) -> bool:
189
+ if isinstance(other, BaseModel):
190
+ # When comparing instances of generic types for equality, as long as all field values are equal,
191
+ # only require their generic origin types to be equal, rather than exact type equality.
192
+ # This prevents headaches like MyGeneric(x=1) != MyGeneric[Any](x=1).
193
+ self_type = self.__pydantic_generic_metadata__["origin"] or self.__class__
194
+ other_type = other.__pydantic_generic_metadata__["origin"] or other.__class__
195
+
196
+ return (
197
+ self_type == other_type
198
+ and self.name == other.name
199
+ and (self.data == other.data).all()
200
+ and self.data_range == other.data_range
201
+ and self.simulation_range == other.simulation_range
202
+ and self.__pydantic_private__ == other.__pydantic_private__
203
+ and self.__pydantic_extra__ == other.__pydantic_extra__
204
+ )
205
+ else:
206
+ return NotImplemented # delegate to the other item in the comparison
207
+
208
+ def __str__(self):
209
+ table = prettytable.PrettyTable()
210
+ table.field_names = [key.replace("_", " ") for key in self.__dict__]
211
+ array_entry = f"{'Data array: ['+' x '.join(str(i) for i in self.data.shape) if self.data.size > 0 else '['}]"
212
+ table.add_row([self.name, array_entry, self.data_range, self.simulation_range])
213
+ return table.get_string()
214
+
215
+
216
+ class DomainContrast(RATModel):
217
+ """Groups together the layers required for each domain."""
218
+
219
+ name: str = Field(default_factory=lambda: "New Domain Contrast " + next(domain_contrast_number), min_length=1)
220
+ model: list[str] = []
221
+
222
+
223
+ class Layer(RATModel, populate_by_name=True):
224
+ """Combines parameters into defined layers."""
225
+
226
+ name: str = Field(default_factory=lambda: "New Layer " + next(layer_number), min_length=1)
227
+ thickness: str
228
+ SLD: str = Field(validation_alias="SLD_real")
229
+ roughness: str
230
+ hydration: str = ""
231
+ hydrate_with: Hydration = Hydration.BulkOut
232
+
233
+
234
+ class AbsorptionLayer(RATModel, populate_by_name=True):
235
+ """Combines parameters into defined layers including absorption terms."""
236
+
237
+ name: str = Field(default_factory=lambda: "New Layer " + next(layer_number), min_length=1)
238
+ thickness: str
239
+ SLD_real: str = Field(validation_alias="SLD")
240
+ SLD_imaginary: str = ""
241
+ roughness: str
242
+ hydration: str = ""
243
+ hydrate_with: Hydration = Hydration.BulkOut
244
+
245
+
246
+ class Parameter(RATModel):
247
+ """Defines parameters needed to specify the model."""
248
+
249
+ name: str = Field(default_factory=lambda: "New Parameter " + next(parameter_number), min_length=1)
250
+ min: float = 0.0
251
+ value: float = 0.0
252
+ max: float = 0.0
253
+ fit: bool = False
254
+ prior_type: Priors = Priors.Uniform
255
+ mu: float = 0.0
256
+ sigma: float = np.inf
257
+
258
+ @model_validator(mode="after")
259
+ def check_min_max(self) -> "Parameter":
260
+ """The maximum value of a parameter must be greater than the minimum."""
261
+ if self.min > self.max:
262
+ raise ValueError(f"The maximum value {self.max} must be greater than the minimum value {self.min}")
263
+ return self
264
+
265
+ @model_validator(mode="after")
266
+ def check_value_in_range(self) -> "Parameter":
267
+ """The value of a parameter must lie within its defined bounds."""
268
+ if self.value < self.min or self.value > self.max:
269
+ raise ValueError(f"value {self.value} is not within the defined range: {self.min} <= value <= {self.max}")
270
+ return self
271
+
272
+
273
+ class ProtectedParameter(Parameter):
274
+ """A Parameter with a fixed name."""
275
+
276
+ name: str = Field(frozen=True, min_length=1)
277
+
278
+
279
+ class Resolution(RATModel):
280
+ """Defines Resolutions in RAT."""
281
+
282
+ name: str = Field(default_factory=lambda: "New Resolution " + next(resolution_number), min_length=1)
283
+ type: TypeOptions = TypeOptions.Constant
284
+ value_1: str = ""
285
+ value_2: str = ""
286
+ value_3: str = ""
287
+ value_4: str = ""
288
+ value_5: str = ""
RATapi/outputs.py ADDED
@@ -0,0 +1,218 @@
1
+ """Converts outputs from the compiled RAT code to python dataclasses"""
2
+
3
+ from dataclasses import dataclass
4
+ from typing import Optional, Union
5
+
6
+ import numpy as np
7
+
8
+ import RATapi.rat_core
9
+ from RATapi.utils.enums import Procedures
10
+
11
+
12
+ @dataclass
13
+ class CalculationResults:
14
+ chiValues: np.ndarray
15
+ sumChi: float
16
+
17
+
18
+ @dataclass
19
+ class ContrastParams:
20
+ backgroundParams: np.ndarray
21
+ scalefactors: np.ndarray
22
+ bulkIn: np.ndarray
23
+ bulkOut: np.ndarray
24
+ resolutionParams: np.ndarray
25
+ subRoughs: np.ndarray
26
+ resample: np.ndarray
27
+
28
+
29
+ @dataclass
30
+ class Results:
31
+ reflectivity: list
32
+ simulation: list
33
+ shiftedData: list
34
+ layerSlds: list
35
+ sldProfiles: list
36
+ resampledLayers: list
37
+ calculationResults: CalculationResults
38
+ contrastParams: ContrastParams
39
+ fitParams: np.ndarray
40
+ fitNames: list[str]
41
+
42
+
43
+ @dataclass
44
+ class PredictionIntervals:
45
+ reflectivity: list
46
+ sld: list
47
+ reflectivityXData: list
48
+ sldXData: list
49
+ sampleChi: np.ndarray
50
+
51
+
52
+ @dataclass
53
+ class ConfidenceIntervals:
54
+ percentile95: np.ndarray
55
+ percentile65: np.ndarray
56
+ mean: np.ndarray
57
+
58
+
59
+ @dataclass
60
+ class DreamParams:
61
+ nParams: float
62
+ nChains: float
63
+ nGenerations: float
64
+ parallel: bool
65
+ CPU: float
66
+ jumpProbability: float
67
+ pUnitGamma: float
68
+ nCR: float
69
+ delta: float
70
+ steps: float
71
+ zeta: float
72
+ outlier: str
73
+ adaptPCR: bool
74
+ thinning: float
75
+ epsilon: float
76
+ ABC: bool
77
+ IO: bool
78
+ storeOutput: bool
79
+ R: np.ndarray
80
+
81
+
82
+ @dataclass
83
+ class DreamOutput:
84
+ allChains: np.ndarray
85
+ outlierChains: np.ndarray
86
+ runtime: float
87
+ iteration: float
88
+ modelOutput: float
89
+ AR: np.ndarray
90
+ R_stat: np.ndarray
91
+ CR: np.ndarray
92
+
93
+
94
+ @dataclass
95
+ class NestedSamplerOutput:
96
+ logZ: float
97
+ nestSamples: np.ndarray
98
+ postSamples: np.ndarray
99
+
100
+
101
+ @dataclass
102
+ class BayesResults(Results):
103
+ predictionIntervals: PredictionIntervals
104
+ confidenceIntervals: ConfidenceIntervals
105
+ dreamParams: DreamParams
106
+ dreamOutput: DreamOutput
107
+ nestedSamplerOutput: NestedSamplerOutput
108
+ chain: np.ndarray
109
+
110
+
111
+ def make_results(
112
+ procedure: Procedures,
113
+ output_results: RATapi.rat_core.OutputResult,
114
+ bayes_results: Optional[RATapi.rat_core.BayesResults] = None,
115
+ ) -> Union[Results, BayesResults]:
116
+ """Initialise a python Results or BayesResults object using the outputs from a RAT calculation."""
117
+ calculation_results = CalculationResults(
118
+ chiValues=output_results.calculationResults.chiValues,
119
+ sumChi=output_results.calculationResults.sumChi,
120
+ )
121
+ contrast_params = ContrastParams(
122
+ backgroundParams=output_results.contrastParams.backgroundParams,
123
+ scalefactors=output_results.contrastParams.scalefactors,
124
+ bulkIn=output_results.contrastParams.bulkIn,
125
+ bulkOut=output_results.contrastParams.bulkOut,
126
+ resolutionParams=output_results.contrastParams.resolutionParams,
127
+ subRoughs=output_results.contrastParams.subRoughs,
128
+ resample=output_results.contrastParams.resample,
129
+ )
130
+
131
+ if procedure in [Procedures.NS, Procedures.Dream]:
132
+ prediction_intervals = PredictionIntervals(
133
+ reflectivity=bayes_results.predictionIntervals.reflectivity,
134
+ sld=bayes_results.predictionIntervals.sld,
135
+ reflectivityXData=bayes_results.predictionIntervals.reflectivityXData,
136
+ sldXData=bayes_results.predictionIntervals.sldXData,
137
+ sampleChi=bayes_results.predictionIntervals.sampleChi,
138
+ )
139
+
140
+ confidence_intervals = ConfidenceIntervals(
141
+ percentile95=bayes_results.confidenceIntervals.percentile95,
142
+ percentile65=bayes_results.confidenceIntervals.percentile65,
143
+ mean=bayes_results.confidenceIntervals.mean,
144
+ )
145
+
146
+ dream_params = DreamParams(
147
+ nParams=bayes_results.dreamParams.nParams,
148
+ nChains=bayes_results.dreamParams.nChains,
149
+ nGenerations=bayes_results.dreamParams.nGenerations,
150
+ parallel=bool(bayes_results.dreamParams.parallel),
151
+ CPU=bayes_results.dreamParams.CPU,
152
+ jumpProbability=bayes_results.dreamParams.jumpProbability,
153
+ pUnitGamma=bayes_results.dreamParams.pUnitGamma,
154
+ nCR=bayes_results.dreamParams.nCR,
155
+ delta=bayes_results.dreamParams.delta,
156
+ steps=bayes_results.dreamParams.steps,
157
+ zeta=bayes_results.dreamParams.zeta,
158
+ outlier=bayes_results.dreamParams.outlier,
159
+ adaptPCR=bool(bayes_results.dreamParams.adaptPCR),
160
+ thinning=bayes_results.dreamParams.thinning,
161
+ epsilon=bayes_results.dreamParams.epsilon,
162
+ ABC=bool(bayes_results.dreamParams.ABC),
163
+ IO=bool(bayes_results.dreamParams.IO),
164
+ storeOutput=bool(bayes_results.dreamParams.storeOutput),
165
+ R=bayes_results.dreamParams.R,
166
+ )
167
+
168
+ dream_output = DreamOutput(
169
+ allChains=bayes_results.dreamOutput.allChains,
170
+ outlierChains=bayes_results.dreamOutput.outlierChains,
171
+ runtime=bayes_results.dreamOutput.runtime,
172
+ iteration=bayes_results.dreamOutput.iteration,
173
+ modelOutput=bayes_results.dreamOutput.modelOutput,
174
+ AR=bayes_results.dreamOutput.AR,
175
+ R_stat=bayes_results.dreamOutput.R_stat,
176
+ CR=bayes_results.dreamOutput.CR,
177
+ )
178
+
179
+ nested_sampler_output = NestedSamplerOutput(
180
+ logZ=bayes_results.nestedSamplerOutput.logZ,
181
+ nestSamples=bayes_results.nestedSamplerOutput.nestSamples,
182
+ postSamples=bayes_results.nestedSamplerOutput.postSamples,
183
+ )
184
+
185
+ results = BayesResults(
186
+ reflectivity=output_results.reflectivity,
187
+ simulation=output_results.simulation,
188
+ shiftedData=output_results.shiftedData,
189
+ layerSlds=output_results.layerSlds,
190
+ sldProfiles=output_results.sldProfiles,
191
+ resampledLayers=output_results.resampledLayers,
192
+ calculationResults=calculation_results,
193
+ contrastParams=contrast_params,
194
+ fitParams=output_results.fitParams,
195
+ fitNames=output_results.fitNames,
196
+ predictionIntervals=prediction_intervals,
197
+ confidenceIntervals=confidence_intervals,
198
+ dreamParams=dream_params,
199
+ dreamOutput=dream_output,
200
+ nestedSamplerOutput=nested_sampler_output,
201
+ chain=bayes_results.chain,
202
+ )
203
+
204
+ else:
205
+ results = Results(
206
+ reflectivity=output_results.reflectivity,
207
+ simulation=output_results.simulation,
208
+ shiftedData=output_results.shiftedData,
209
+ layerSlds=output_results.layerSlds,
210
+ sldProfiles=output_results.sldProfiles,
211
+ resampledLayers=output_results.resampledLayers,
212
+ calculationResults=calculation_results,
213
+ contrastParams=contrast_params,
214
+ fitParams=output_results.fitParams,
215
+ fitNames=output_results.fitNames,
216
+ )
217
+
218
+ return results