Skip to content

Commit fcdf201

Browse files
committed
Renames parameters to match matlab updates
1 parent 58a96b8 commit fcdf201

10 files changed

Lines changed: 110 additions & 326 deletions

File tree

RAT.egg-info/SOURCES.txt

Lines changed: 3 additions & 223 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ RAT/__init__.py
55
RAT/classlist.py
66
RAT/controls.py
77
RAT/events.py
8+
RAT/inputs.py
89
RAT/misc.py
910
RAT/models.py
1011
RAT/project.py
@@ -16,6 +17,7 @@ RAT.egg-info/requires.txt
1617
RAT.egg-info/top_level.txt
1718
RAT/utils/__init__.py
1819
RAT/utils/custom_errors.py
20+
RAT/utils/dataclasses.py
1921
RAT/utils/enums.py
2022
cpp/rat.cpp
2123
cpp/RAT/CoderTimeAPI.cpp
@@ -241,234 +243,12 @@ cpp/RAT/xzlascl.cpp
241243
cpp/RAT/xztgevc.cpp
242244
cpp/RAT/xzungqr.cpp
243245
cpp/RAT/events/eventManager.cpp
244-
cpp/RAT/CoderTimeAPI.cpp
245-
cpp/RAT/DREAMWrapper.cpp
246-
cpp/RAT/RATMain.cpp
247-
cpp/RAT/RATMain_data.cpp
248-
cpp/RAT/RATMain_initialize.cpp
249-
cpp/RAT/RATMain_rtwutil.cpp
250-
cpp/RAT/RATMain_terminate.cpp
251-
cpp/RAT/SLDFunction.cpp
252-
cpp/RAT/abelesParallelPoints.cpp
253-
cpp/RAT/abelesSingle.cpp
254-
cpp/RAT/abs.cpp
255-
cpp/RAT/acos.cpp
256-
cpp/RAT/adaptPCR.cpp
257-
cpp/RAT/adaptive.cpp
258-
cpp/RAT/all.cpp
259-
cpp/RAT/allOrAny.cpp
260-
cpp/RAT/allocateLayersForContrast.cpp
261-
cpp/RAT/allocateParamsToLayers.cpp
262-
cpp/RAT/anyNonFinite.cpp
263-
cpp/RAT/applyBackgroundCorrection.cpp
264-
cpp/RAT/applyHydrationImag.cpp
265-
cpp/RAT/applyHydrationReal.cpp
266-
cpp/RAT/asinh.cpp
267-
cpp/RAT/asymconvstep.cpp
268-
cpp/RAT/backSort.cpp
269-
cpp/RAT/blockedSummation.cpp
270-
cpp/RAT/boundaryHandling.cpp
271-
cpp/RAT/bsearch.cpp
272-
cpp/RAT/bsxfun.cpp
273-
cpp/RAT/calcDensity.cpp
274-
cpp/RAT/calcEllipsoid.cpp
275-
cpp/RAT/calcProposal.cpp
276-
cpp/RAT/callCppFunction.cpp
277-
cpp/RAT/callReflectivity.cpp
278-
cpp/RAT/chiSquared.cpp
279-
cpp/RAT/coder_posix_time.c
280-
cpp/RAT/coder_setenv.c
281-
cpp/RAT/colon.cpp
282-
cpp/RAT/combineVectorElements.cpp
283-
cpp/RAT/complexTimes.cpp
284-
cpp/RAT/coreLayersCalculation.cpp
285-
cpp/RAT/cov.cpp
286-
cpp/RAT/customLayers.cpp
287-
cpp/RAT/customLayers1.cpp
288-
cpp/RAT/customXY.cpp
289-
cpp/RAT/customXY1.cpp
290-
cpp/RAT/dataResolutionPolly.cpp
291-
cpp/RAT/deopt.cpp
292-
cpp/RAT/det.cpp
293-
cpp/RAT/diag.cpp
294-
cpp/RAT/drawCR.cpp
295-
cpp/RAT/drawEllipsoidPoints.cpp
296-
cpp/RAT/drawMCMC.cpp
297-
cpp/RAT/drawMultiNest.cpp
298-
cpp/RAT/eig.cpp
299-
cpp/RAT/eigHermitianStandard.cpp
300-
cpp/RAT/eml_erfcore.cpp
301-
cpp/RAT/eml_rand_mt19937ar.cpp
302-
cpp/RAT/eml_rand_mt19937ar_stateful.cpp
303-
cpp/RAT/eml_setop.cpp
304-
cpp/RAT/eps.cpp
305-
cpp/RAT/erf.cpp
306-
cpp/RAT/evaluateModel.cpp
307-
cpp/RAT/exp.cpp
308-
cpp/RAT/eye.cpp
309-
cpp/RAT/fMinSearch.cpp
310-
cpp/RAT/find.cpp
311-
cpp/RAT/flip.cpp
312-
cpp/RAT/gamma.cpp
313-
cpp/RAT/gelman.cpp
314-
cpp/RAT/getFittedPriors.cpp
315-
cpp/RAT/getTime.cpp
316-
cpp/RAT/getenv.cpp
317-
cpp/RAT/groupLayersMod.cpp
318-
cpp/RAT/groupLayersModImaginary.cpp
319-
cpp/RAT/histc.cpp
320-
cpp/RAT/ifWhileCond.cpp
321-
cpp/RAT/inEllipsoids.cpp
322-
cpp/RAT/initializeDREAM.cpp
323-
cpp/RAT/interp1.cpp
324-
cpp/RAT/ishermitian.cpp
325-
cpp/RAT/isrow.cpp
326-
cpp/RAT/ixamax.cpp
327-
cpp/RAT/kmeans.cpp
328-
cpp/RAT/leftWin.cpp
329-
cpp/RAT/length.cpp
330-
cpp/RAT/linspace.cpp
331-
cpp/RAT/log.cpp
332-
cpp/RAT/log1p.cpp
333-
cpp/RAT/log2.cpp
334-
cpp/RAT/logPlus.cpp
335-
cpp/RAT/lower.cpp
336-
cpp/RAT/lusolve.cpp
337-
cpp/RAT/makeCell.cpp
338-
cpp/RAT/makeD.cpp
339-
cpp/RAT/makeEmptyBayesResultsStruct.cpp
340-
cpp/RAT/makeEmptyResultStruct.cpp
341-
cpp/RAT/makeSLDProfileXY.cpp
342-
cpp/RAT/makeSLDProfiles.cpp
343-
cpp/RAT/matrix_to_integer_power.cpp
344-
cpp/RAT/mchol.cpp
345-
cpp/RAT/mean.cpp
346-
cpp/RAT/mergesort.cpp
347-
cpp/RAT/metropolisRule.cpp
348-
cpp/RAT/minOrMax.cpp
349-
cpp/RAT/mod.cpp
350-
cpp/RAT/mrdivide_helper.cpp
351-
cpp/RAT/mtimes.cpp
352-
cpp/RAT/multrnd.cpp
353-
cpp/RAT/nest2pos.cpp
354-
cpp/RAT/nestedSampler.cpp
355-
cpp/RAT/nonSingletonDim.cpp
356-
cpp/RAT/norm.cpp
357-
cpp/RAT/nsIntraFun.cpp
358-
cpp/RAT/nullAssignment.cpp
359-
cpp/RAT/optimalEllipsoids.cpp
360-
cpp/RAT/packParams.cpp
361-
cpp/RAT/percentileConfidenceIntervals.cpp
362-
cpp/RAT/pow2.cpp
363-
cpp/RAT/power.cpp
364-
cpp/RAT/prctile.cpp
365-
cpp/RAT/print_processing.cpp
366-
cpp/RAT/processBayes.cpp
367-
cpp/RAT/processCustomFunction.cpp
368-
cpp/RAT/processCustomFunction1.cpp
369-
cpp/RAT/processCustomFunction2.cpp
370-
cpp/RAT/processCustomFunction3.cpp
371-
cpp/RAT/qrsolve.cpp
372-
cpp/RAT/rand.cpp
373-
cpp/RAT/randn.cpp
374-
cpp/RAT/randperm.cpp
375-
cpp/RAT/randsample.cpp
376-
cpp/RAT/ratDREAM.cpp
377-
cpp/RAT/rcond.cpp
378-
cpp/RAT/refPercentileConfidenceIntervals.cpp
379-
cpp/RAT/reflectivityCalculation.cpp
380-
cpp/RAT/reflectivityCalculation1.cpp
381-
cpp/RAT/reflectivityCalculation2.cpp
382-
cpp/RAT/relop.cpp
383-
cpp/RAT/rem.cpp
384-
cpp/RAT/removeOutlier.cpp
385-
cpp/RAT/repmat.cpp
386-
cpp/RAT/resampleLayers.cpp
387-
cpp/RAT/resampleLayersReIm.cpp
388-
cpp/RAT/rescale.cpp
389-
cpp/RAT/rescaleKernel.cpp
390-
cpp/RAT/rescaleParameters.cpp
391-
cpp/RAT/reshapeSizeChecks.cpp
392-
cpp/RAT/resolutionPolly.cpp
393-
cpp/RAT/rng.cpp
394-
cpp/RAT/rtGetInf.cpp
395-
cpp/RAT/rtGetNaN.cpp
396-
cpp/RAT/rt_nonfinite.cpp
397-
cpp/RAT/runDE.cpp
398-
cpp/RAT/runDREAM.cpp
399-
cpp/RAT/runNestedSampler.cpp
400-
cpp/RAT/runSimplex.cpp
401-
cpp/RAT/scaleParameters.cpp
402-
cpp/RAT/scaledGaussPrior.cpp
403-
cpp/RAT/schur.cpp
404-
cpp/RAT/setupDREAM.cpp
405-
cpp/RAT/shiftData.cpp
406-
cpp/RAT/simplexIntrafun.cpp
407-
cpp/RAT/simplexXTransform.cpp
408-
cpp/RAT/sort.cpp
409-
cpp/RAT/sortAscendLE.cpp
410-
cpp/RAT/sortIdx.cpp
411-
cpp/RAT/sortLE.cpp
412-
cpp/RAT/sortrows.cpp
413-
cpp/RAT/splitEllipsoid.cpp
414-
cpp/RAT/sprintf.cpp
415-
cpp/RAT/sqrt.cpp
416-
cpp/RAT/sqrt1.cpp
417-
cpp/RAT/standardLayers.cpp
418-
cpp/RAT/standardLayers1.cpp
419-
cpp/RAT/std.cpp
420-
cpp/RAT/str2double.cpp
421-
cpp/RAT/str2double1.cpp
422-
cpp/RAT/strcmp.cpp
423-
cpp/RAT/structConstructorHelper.cpp
424-
cpp/RAT/sum.cpp
425-
cpp/RAT/tic.cpp
426-
cpp/RAT/timeKeeper.cpp
427-
cpp/RAT/toc.cpp
428-
cpp/RAT/triggerEvent.cpp
429-
cpp/RAT/triu.cpp
430-
cpp/RAT/unpackParams.cpp
431-
cpp/RAT/useConstantDim.cpp
432-
cpp/RAT/vAllOrAny.cpp
433-
cpp/RAT/var.cpp
434-
cpp/RAT/varstd.cpp
435-
cpp/RAT/xdhseqr.cpp
436-
cpp/RAT/xdlanv2.cpp
437-
cpp/RAT/xgehrd.cpp
438-
cpp/RAT/xgemm.cpp
439-
cpp/RAT/xgemv.cpp
440-
cpp/RAT/xgeqp3.cpp
441-
cpp/RAT/xgerc.cpp
442-
cpp/RAT/xgeru.cpp
443-
cpp/RAT/xgetrf.cpp
444-
cpp/RAT/xnrm2.cpp
445-
cpp/RAT/xrot.cpp
446-
cpp/RAT/xswap.cpp
447-
cpp/RAT/xtrsm.cpp
448-
cpp/RAT/xtrsv.cpp
449-
cpp/RAT/xungorghr.cpp
450-
cpp/RAT/xunormqr.cpp
451-
cpp/RAT/xzgeev.cpp
452-
cpp/RAT/xzgeqp3.cpp
453-
cpp/RAT/xzggbak.cpp
454-
cpp/RAT/xzggbal.cpp
455-
cpp/RAT/xzggev.cpp
456-
cpp/RAT/xzgghrd.cpp
457-
cpp/RAT/xzhgeqz.cpp
458-
cpp/RAT/xzlangeM.cpp
459-
cpp/RAT/xzlanhs.cpp
460-
cpp/RAT/xzlarf.cpp
461-
cpp/RAT/xzlarfg.cpp
462-
cpp/RAT/xzlartg.cpp
463-
cpp/RAT/xzlascl.cpp
464-
cpp/RAT/xztgevc.cpp
465-
cpp/RAT/xzungqr.cpp
466-
cpp/RAT/events/eventManager.cpp
467246
tests/__init__.py
468247
tests/test_classlist.py
469248
tests/test_controls.py
470249
tests/test_custom_errors.py
471250
tests/test_events.py
251+
tests/test_inputs.py
472252
tests/test_models.py
473253
tests/test_project.py
474254
tests/test_wrappers.py

RAT/controls.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ class Calculate(BaseModel, validate_assignment=True, extra='forbid'):
1111
procedure: Literal[Procedures.Calculate] = Procedures.Calculate
1212
parallel: Parallel = Parallel.Single
1313
calcSldDuringFit: bool = False
14-
resamPars: list[float] = Field([0.9, 50], min_length=2, max_length=2)
14+
resampleParams: list[float] = Field([0.9, 50], min_length=2, max_length=2)
1515
display: Display = Display.Iter
1616

17-
@field_validator("resamPars")
17+
@field_validator("resampleParams")
1818
@classmethod
19-
def check_resamPars(cls, resamPars):
20-
if not 0 < resamPars[0] < 1:
21-
raise ValueError('resamPars[0] must be between 0 and 1')
22-
if resamPars[1] < 0:
23-
raise ValueError('resamPars[1] must be greater than or equal to 0')
24-
return resamPars
19+
def check_resample_params(cls, resampleParams):
20+
if not 0 < resampleParams[0] < 1:
21+
raise ValueError('resampleParams[0] must be between 0 and 1')
22+
if resampleParams[1] < 0:
23+
raise ValueError('resampleParams[1] must be greater than or equal to 0')
24+
return resampleParams
2525

2626
def __repr__(self) -> str:
2727
table = prettytable.PrettyTable()
@@ -33,10 +33,10 @@ def __repr__(self) -> str:
3333
class Simplex(Calculate):
3434
"""Defines the additional fields for the simplex procedure."""
3535
procedure: Literal[Procedures.Simplex] = Procedures.Simplex
36-
tolX: float = Field(1.0e-6, gt=0.0)
37-
tolFun: float = Field(1.0e-6, gt=0.0)
38-
maxFunEvals: int = Field(10000, gt=0)
39-
maxIter: int = Field(1000, gt=0)
36+
xTolerance: float = Field(1.0e-6, gt=0.0)
37+
funcTolerance: float = Field(1.0e-6, gt=0.0)
38+
maxFuncEvals: int = Field(10000, gt=0)
39+
maxIterations: int = Field(1000, gt=0)
4040
updateFreq: int = -1
4141
updatePlotFreq: int = 1
4242

@@ -55,8 +55,8 @@ class DE(Calculate):
5555
class NS(Calculate):
5656
"""Defines the additional fields for the Nested Sampler procedure."""
5757
procedure: Literal[Procedures.NS] = Procedures.NS
58-
Nlive: int = Field(150, ge=1)
59-
Nmcmc: float = Field(0.0, ge=0.0)
58+
nLive: int = Field(150, ge=1)
59+
nMCMC: float = Field(0.0, ge=0.0)
6060
propScale: float = Field(0.1, gt=0.0, lt=1.0)
6161
nsTolerance: float = Field(0.1, ge=0.0)
6262

RAT/events.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def notify(event_type: EventTypes, data: Union[str, PlotEventData, ProgressEvent
1818
for callback in callbacks:
1919
callback(data)
2020

21+
2122
def get_event_callback(event_type: EventTypes) -> List[Callable[[Union[str, PlotEventData, ProgressEventData]], None]]:
2223
"""Returns all callbacks registered for the given event type.
2324

RAT/inputs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def make_problem(project: RAT.Project) -> RAT.utils.dataclasses.Problem:
127127
contrastDomainRatios=[project.domain_ratios.index(contrast.domain_ratio, 1)
128128
if hasattr(contrast, 'domain_ratio') else 0 for contrast in project.contrasts],
129129
contrastBackgrounds=[project.backgrounds.index(contrast.background, 1) for contrast in project.contrasts],
130-
contrastBackgroundsType=[1] * len(project.contrasts),
130+
contrastBackgroundsActions=[1] * len(project.contrasts),
131131
contrastResolutions=[project.resolutions.index(contrast.resolution, 1) for contrast in project.contrasts],
132132
contrastCustomFiles=contrast_custom_files,
133133
resample=[contrast.resample for contrast in project.contrasts],

RAT/misc.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,16 @@ def getHandle(self)\
3939
"""
4040
def handle(params, bulk_in, bulk_out, contrast, domain=-1):
4141
if domain == -1:
42-
output, sub_rough = getattr(self.engine, self.function_name)(np.array(params, 'float'),
43-
np.array(bulk_in, 'float'),
44-
np.array(bulk_out, 'float'),
45-
float(contrast + 1), nargout=2)
42+
output, sub_rough = getattr(self.engine, self.function_name)(np.array(params, 'float'),
43+
np.array(bulk_in, 'float'),
44+
np.array(bulk_out, 'float'),
45+
float(contrast + 1), nargout=2)
4646
else:
47-
output, sub_rough = getattr(self.engine, self.function_name)(np.array(params, 'float'),
48-
np.array(bulk_in, 'float'),
49-
np.array(bulk_out, 'float'),
50-
float(contrast + 1), float(domain + 1), nargout=2)
47+
output, sub_rough = getattr(self.engine, self.function_name)(np.array(params, 'float'),
48+
np.array(bulk_in, 'float'),
49+
np.array(bulk_out, 'float'),
50+
float(contrast + 1), float(domain + 1),
51+
nargout=2)
5152
return output, sub_rough
5253
return handle
5354

@@ -58,7 +59,7 @@ class DylibWrapper:
5859
Parameters
5960
----------
6061
filename : str
61-
The path of the dyanamic library
62+
The path of the dynamic library
6263
function_name : str
6364
The name of the function to call
6465
"""

RAT/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
except ImportError:
1212
from strenum import StrEnum
1313

14+
1415
def int_sequence():
1516
"""Iterate through integers for use as model counters."""
1617
num = 1
@@ -130,7 +131,7 @@ def model_post_init(self, __context: Any) -> None:
130131
@model_validator(mode='after')
131132
def check_ranges(self) -> 'Data':
132133
"""The limits of the "data_range" field must lie within the range of the supplied data, whilst the limits
133-
of the "simulation_range" field must lie outside of the range of the supplied data.
134+
of the "simulation_range" field must lie outside the range of the supplied data.
134135
"""
135136
if len(self.data[:, 0]) > 0:
136137
data_min = np.min(self.data[:, 0])

0 commit comments

Comments
 (0)