Adds docstrings to controls and project fields by alexhroom · Pull Request #117 · RascalSoftware/python-RAT · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 57 additions & 1 deletion RATapi/controls.py
6 changes: 3 additions & 3 deletions RATapi/examples/non_polarised/DSPC_custom_XY.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


def DSPC_custom_XY():
"""Custom XY Example for Supported DSPC layer.
r"""Custom XY Example for Supported DSPC layer.

In this example, we model the same data (DSPC supported bilayer) as the Custom Layers example, but this time we will
use continuous distributions of the volume fractions of each component to build up the SLD profiles (as described in
Expand All @@ -19,15 +19,15 @@ def DSPC_custom_XY():
We can define our lipid in terms of an Area per Molecule, almost in its entirety, if we recognise that where the
volume is known, the thickness of the layer is simply given by the layer volume / APM:

$d_{\textrm{layer}} =\frac{V_{\textrm{layer}} }{{\textrm{APM}}_{\textrm{layer}}}$.
.. math:: d_{\textrm{layer}} =\frac{V_{\textrm{layer}} }{{\textrm{APM}}_{\textrm{layer}}}.

We can then define the Volume Fraction of this layer with a roughened Heaviside of length dlayer and a height of 1.
Then, the total volume occupied will be given by the sum of the volume fractions across the interface. Of course,
this does not permit any hydration, so to deal with this, we can simply scale the (full occupation) Heaviside
functions by relevant coverage parameters. When this is correctly done, we can obtain the remaining water
distribution as:

$${\textrm{VF}}_{\textrm{wat}} =1-\\sum_n {\textrm{VF}}_n$$
.. math:: {\textrm{VF}}_{\textrm{wat}} =1-\\sum_n {\textrm{VF}}_n

where VFn is the Volume Fraction of the n'th layer.
"""
Expand Down
12 changes: 10 additions & 2 deletions RATapi/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,14 @@ class Background(Signal):
The type of background (constant, function or data)
source : str
The source of the background;

- if type is 'constant', this should be the name of a background parameter.
- if type is 'data', this should be the name of a dataset defined in `Project.data`.
- if type is 'function', this should be the name of a custom function defined in `Project.custom_files`.
value_1, value_2, ..., value_5 : str

value_1, value_2, value_3, value_4, value_5 : str
Values required by the background.

- if type is 'constant', all values will be ignored.
- if type is 'data', value_1 may be the parameter name for an optional offset. Other values are ignored.
- if type is 'function', these values may be the names of up to 5 parameters which are passed to the function.
Expand Down Expand Up @@ -318,6 +321,8 @@ def set_matlab_function_name(self):
class Data(RATModel, arbitrary_types_allowed=True):
"""A dataset required for a contrast.

Parameters
----------
name : str
The name of this dataset.
data : np.ndarray[np.float64]
Expand Down Expand Up @@ -584,12 +589,15 @@ class Resolution(Signal):
The type of resolution: 'constant', 'data', or (NOT YET IMPLEMENTED) 'function'.
source : str
The source data for the resolution;

- if type is 'constant', this should be the name of a background parameter.
- if type is 'data', this should be empty (resolution data is in the contrast data).
- if type is 'function' (NOT YET IMPLEMENTED),
this should be the name of a custom function defined in `Project.custom_files`.
value_1, value_2, ..., value_5 : str

value_1, value_2, value_3, value_4, value_5 : str
Values required by the background.

- if type is 'constant' or 'data', all values will be ignored.
- if type is 'function' (NOT YET IMPLEMENTED),
these values may be the names of up to 5 parameters which are passed to the function.
Expand Down
29 changes: 28 additions & 1 deletion RATapi/project.py