You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/advanced/customLanguages.rst
+11-8Lines changed: 11 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,9 @@ Python Custom Models
19
19
.. note::
20
20
Before you use Python from your MATLAB session, please ensure that Python is `configured correctly on your system. <https://uk.mathworks.com/help/matlab/matlab_external/create-object-from-python-class.html>`_
21
21
22
+
.. warning::
23
+
The value of contrast and domain number will always start from 1 (not 0) so be careful if contrast/domain number is used for array indexing.
24
+
You will need to subtract one from contrast e.g :code:`bulk_in[contrast - 1]` to avoid code failure.
22
25
23
26
Custom models in Python and MATLAB are very similar in structure as shown below:
24
27
@@ -156,13 +159,13 @@ Custom models in Python and MATLAB are very similar in structure as shown below:
Copy file name to clipboardExpand all lines: source/api.rst
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -376,7 +376,7 @@ Controls Class
376
376
==============
377
377
378
378
ControlsClass is all about control. It is necessary in determine the way RAT works. It deals with how the user interacts with the software. From type of parallelization
379
-
to whether the users wants to calculate SLD during fit and even how many iteration an algorithm should do ..etc.
379
+
to how many iterations an algorithm should do etc.
380
380
381
381
382
382
There are 5 different `controlsClass.procedures` that can be used with RAT. They are:
@@ -397,9 +397,9 @@ if yes, what to parallelize on. (Points or Contrasts or all)
397
397
:caption: Sample usage of controlsClass.
398
398
399
399
controls = controlsClass();
400
-
controls.calcSldDuringFit = false;
401
-
controls.nsimu = 7000;
402
-
controls.repeats = 3;
400
+
controls.procedure = 'dream';
401
+
controls.nSamples = 6000;
402
+
controls.nChains = 10;
403
403
controls.parallel = 'contrasts';
404
404
405
405
.. code-block:: MATLAB
@@ -429,12 +429,12 @@ After the user has defined the projectClass and controlsClass, the user can run
429
429
[problem,results] = RAT(problem,controls);
430
430
431
431
432
-
When the RAT function is called, the classes are passed into internal functions like `RatParseClassToStructs_new` which takes the classes and breaks them down into cells,
432
+
When the RAT function is called, the classes are passed into internal functions like `parseClassToStructs` which takes the classes and breaks them down into cells,
433
433
limits,prior and more importantly converts the project class to struct.
434
434
435
435
Then, the `RATMain` function redirects the control flow based on what procedure is selected in controlsClass. One of the redirecting functions will call the reflectivityCalculation
436
436
which starts the reflectivity calculation.
437
437
438
438
439
439
Some interesting data type changes are needed because of how things work with coder. Coder wont accept variable sized cell arrays contains variable sized arrays (strings for eg)
440
-
in a field of a struct. So, look at `RatParseClassToStructs_new` function to understand how the data is converted.
440
+
in a field of a struct. So, look at `parseClassToStructs` function to understand how the data is converted.
0 commit comments