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
4 changes: 2 additions & 2 deletions source/examples/DSPC_custom_XY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ In this model, we make distributions to represent the volume fractions of each o
We also make our volume fractions as optional outputted parameters from our file. The optional nature of this output means we can suppress it to run the model, then
activate it to make final output plots of our analysis.

.. image:: ../images/examples/volumeFractions.jpg
.. image:: ../images/examples/volumeFractions.png
:align: center
:alt: Volume fractions

Expand Down Expand Up @@ -64,7 +64,7 @@ This example can be run as a script or interactively using the instructions belo
.. code-block:: Python

import RATapi as RAT
problem, results = RATapi.examples.non_polarised.DSPC_custom_XY()
problem, results = RAT.examples.non_polarised.DSPC_custom_XY()

**Run Interactively**:

Expand Down
2 changes: 1 addition & 1 deletion source/examples/DSPC_custom_layers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ This example can be run as a script or interactively using the instructions belo
.. code-block:: Python

import RATapi as RAT
problem, results = RATapi.examples.non_polarised.DSPC_custom_layers()
problem, results = RAT.examples.non_polarised.DSPC_custom_layers()

**Run Interactively**:

Expand Down
4 changes: 3 additions & 1 deletion source/examples/DSPC_standard_layers.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _DSPC_Standard_Layers:

====================
DSPC Standard Layers
====================
Expand Down Expand Up @@ -44,7 +46,7 @@ This example can be run as a script or interactively using the instructions belo
.. code-block:: Python

import RATapi as RAT
problem, results = RATapi.examples.non_polarised.DSPC_standard_layers()
problem, results = RAT.examples.non_polarised.DSPC_standard_layers()

**Run Interactively**:

Expand Down
2 changes: 1 addition & 1 deletion source/examples/convert_r1_project.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ This example can be run using the instructions below.
.. code-block:: Python

import RATapi as RAT
problem, results = RATapi.examples.convert_rascal_project.convert_rascal()
problem, results = RAT.examples.convert_rascal_project.convert_rascal()

**Run Interactively**:

Expand Down
2 changes: 1 addition & 1 deletion source/examples/domains_custom_XY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ This example can be run as a script or interactively using the instructions belo
.. code-block:: Python

import RATapi as RAT
problem, results = RATapi.examples.domains.domains_custom_XY()
problem, results = RAT.examples.domains.domains_custom_XY()

**Run Interactively**:

Expand Down
2 changes: 1 addition & 1 deletion source/examples/domains_custom_layers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ This example can be run as a script or interactively using the instructions belo
.. code-block:: Python

import RATapi as RAT
problem, results = RATapi.examples.domains.domains_custom_layers()
problem, results = RAT.examples.domains.domains_custom_layers()

**Run Interactively**:

Expand Down
2 changes: 1 addition & 1 deletion source/examples/domains_standard_layers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ This example can be run as a script or interactively using the instructions belo
.. code-block:: Python

import RATapi as RAT
problem, results = RATapi.examples.domains.domains_standard_layers()
problem, results = RAT.examples.domains.domains_standard_layers()

**Run Interactively**:

Expand Down
2 changes: 1 addition & 1 deletion source/examples/imaginary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ This example can be run using the instructions below.
.. code-block:: Python

import RATapi as RAT
problem, results = RATapi.examples.absorption.absorption()
problem, results = RAT.examples.absorption.absorption()

**Run Interactively**:

Expand Down
Binary file modified source/images/advanced/layersPic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified source/images/advanced/resamplePic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified source/images/examples/critEdge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed source/images/examples/volumeFractions.jpg
Binary file not shown.
Binary file added source/images/examples/volumeFractions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified source/images/misc/bayes95.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified source/images/misc/bayesRef1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified source/images/misc/bayesq4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified source/images/misc/chainPlot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified source/images/misc/cornerPlot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified source/images/misc/histNoSmooth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified source/images/misc/histSmooth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified source/images/misc/r1Converted.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified source/images/misc/resamPlot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed source/images/misc/runDE.png
Binary file not shown.
Binary file modified source/images/misc/simPlot1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified source/images/misc/simPlot2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/tutorial/plotAfterOptimization.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/tutorial/plotBeforeOptimization.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed source/images/userManual/chapter1/plots.png
Binary file not shown.
Binary file removed source/images/userManual/chapter2/plot1.png
Diff not rendered.
Binary file removed source/images/userManual/chapter2/plot2.png
Diff not rendered.
Diff not rendered.
Binary file removed source/images/userManual/chapter3/copyProject1.png
Diff not rendered.
Binary file removed source/images/userManual/chapter3/copyProject2.png
Diff not rendered.
Binary file removed source/images/userManual/chapter3/loadingBack.png
Diff not rendered.
Binary file removed source/images/userManual/chapter3/ratSimpleLayer.png
Diff not rendered.
Diff not rendered.
Binary file removed source/images/userManual/chapter3/resultsStruct.png
Diff not rendered.
6 changes: 3 additions & 3 deletions source/tutorial/chapter1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ heads which are adjacent (or embedded) in the bulk aqueous phase.

In our example, the layers can be either deuterated or hydrogenated, and the bulk water can either be D2O or ACMW.

.. image:: ../images/userManual/chapter1/lipidMonolayer.png
.. image:: ../images/tutorial/lipidMonolayer.png
:width: 300
:alt: The lipid monolayer example

Expand Down Expand Up @@ -364,14 +364,14 @@ We can now plot the output, either manually (by taking the relevant parts from t
.. tab-set-code::
.. code-block:: Matlab

fig(1); clf;
figure(1); clf;
plotRefSLD(problem, results)

.. code-block:: Python

RAT.plotting.plot_ref_sld(problem, results)

.. image:: ../images/userManual/chapter1/plots.png
.. image:: ../images/tutorial/plotBeforeOptimization.png
:alt: reflectivity and SLD plots

We can see that our model is looking fairly sensible, but that our guess values for the parameters are pretty wide off the mark. Further analysis
Expand Down
6 changes: 3 additions & 3 deletions source/tutorial/chapter2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,7 @@ We then send all of this to RAT, and plot the output:



.. image:: ../images/userManual/chapter2/plot1.png
.. image:: ../images/tutorial/plotBeforeOptimization.png
:alt: Displays reflectivity and SLD plot

To do a fit, we change the *procedure* attribute of the controls class to **simplex**. We will also change the 'parallel' option to 'contrasts', so that each contrast gets its own calculation thread,
Expand All @@ -1315,7 +1315,7 @@ and modify the output to only display the final result (rather than each iterati
controls.procedure = 'simplex';
controls.parallel = 'contrasts';
controls.display = 'final';
[problem, results] = RAT(problem, controls)
[problem, results] = RAT(problem, controls);

.. code-block:: Python

Expand Down Expand Up @@ -1383,5 +1383,5 @@ We can now plot the results of our fit:

RAT.plotting.plot_ref_sld(problem, results)

.. image:: ../images/userManual/chapter2/plot2.png
.. image:: ../images/tutorial/plotAfterOptimization.png
:alt: Displays reflectivity and SLD plot
8 changes: 4 additions & 4 deletions source/tutorial/customModels.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ In terms of the SLD's, because the volume and composition of each layer is known

The figure shows the system we are measuring. We have a single, hydrogenated DSPC bilayer supported on a silicon surface. The silicon is, as always, coated with an oxide layer. The bilayer may or may not be complete (i.e. partially hydrated) so we will need hydration parameters, and there is the possibility of a thin water layer between the bilayer and the substrate. We also need some roughness parameters, both for the substrate and the bilayer itself. We will build a custom model for this and use it to analyse the bilayer data at three contrasts.

.. image:: ../images/userManual/chapter3/bilayer.png
.. image:: ../images/tutorial/bilayer.png
:alt: Bilayer on silicon diagram

Looking at our system, we can see that we are going to need 8 parameters in total:
Expand Down Expand Up @@ -765,7 +765,7 @@ The following code snippet we'll make an example of a simple layer....
plt.axis((0 100 0 1.5))
plt.show()

.. image:: ../images/userManual/chapter3/simpleLayer.png
.. image:: ../images/tutorial/simpleLayer.png
:width: 800
:alt: simple layer

Expand Down Expand Up @@ -947,12 +947,12 @@ run it and plot the results
problem,resuts = RAT.run(problem, controls)
RAT.plotting.plot_ref_sld(problem, results)

.. image:: ../images/userManual/chapter3/customTwoLayerFig.png
.. image:: ../images/tutorial/customTwoLayerFig.png
:width: 500
:alt: Dtwo layers XY

When sent to RAT, customXY SLD profiles are automatically resampled into layers with adaptive resampling:

.. image:: ../images/userManual/chapter3/twoLayerRAT.png
.. image:: ../images/tutorial/twoLayerRAT.png
:width: 800
:alt: Displays the final customXY result
7 changes: 4 additions & 3 deletions source/utilities/plotFuns.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Basic Plotting
==============

The simplest plot available is a simple display of the contents of the *problem* and *results* blocks.
This takes the following form:
The initial problem and result used in this section were made by running :ref:`DSPC Standard Layers<DSPC_Standard_Layers>`, after
running the example a basic plot takes the following form:

.. tab-set-code::
.. code-block:: Matlab
Expand All @@ -18,7 +19,7 @@ This takes the following form:
RAT.plotting.plot_ref_sld(problem, results)

.. image:: ../images/misc/simPlot1.png
:alt: disp(results)
:alt: simple plot


This produces a basic plot of the reflectivity and SLD.
Expand All @@ -37,7 +38,7 @@ If this plot is not cleared before subsequent plots, then *plotRefSLD* will over

.. code-block:: Python

controls = RAT.Controls(procedure='DE', display='final', parallel='contrast')
controls = RAT.Controls(procedure='DE', display='final', parallel='contrasts')
problem, results = RAT.run(problem, controls)
RAT.plotting.plot_ref_sld(problem, controls)

Expand Down
89 changes: 73 additions & 16 deletions source/utilities/plotFunsBayes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,38 @@
Plotting Bayesian Analysis
==========================

A number of function exist for plotting the results of Bayesian analysis.
A number of functions exist for plotting the results of Bayesian analysis. The problem and result used in this section were made using the
:ref:`DSPC Standard Layers<DSPC_Standard_Layers>` example and a control object with the procedure set to ``DREAM``.

.. tab-set-code::
.. code-block:: Matlab

% Run the DSPC standard layers example
controls = controlsClass();
controls.procedure = 'dream';
[problem, results] = RAT(problem, controls);

.. code-block:: Python

# Run the DSPC standard layer example
controls = RAT.Controls()
controls.procedure = 'dream'
problem, results = RAT.run(problem, controls)

********************
Reflectivity and SLD
....................
********************

A simple reflectivity shaded plot can be displayed as follows:

.. code-block:: MATLAB
.. tab-set-code::
.. code-block:: Matlab

figure(1); clf;
bayesShadedPlot(problem,results)
bayesShadedPlot(problem, results)

.. code-block:: Python

RAT.plotting.plot_ref_sld(problem, results, bayes=65)


.. image:: ../images/misc/bayesRef1.png
Expand All @@ -28,9 +49,14 @@ There are a number of options to customise the plot:

**Interval** - You can sepcify either the 65% or 95% confidence interval to display:

.. code-block:: MATLAB
.. tab-set-code::
.. code-block:: Matlab

bayesShadedPlot(problem, results, 'interval', 95)

.. code-block:: Python

bayesShadedPlot(problem,results,'interval',95)
RAT.plotting.plot_ref_sld(problem, results, bayes=95)

.. image:: ../images/misc/bayes95.png
:width: 800
Expand All @@ -39,6 +65,15 @@ There are a number of options to customise the plot:

**Type** - You can also specify a q4 plot for the reflectivity:

.. tab-set-code::
.. code-block:: Matlab

bayesShadedPlot(problem, results, 'q4', true)

.. code-block:: Python

RAT.plotting.plot_ref_sld(problem, results, bayes=65, q4=True)

.. image:: ../images/misc/bayesq4.png
:width: 800
:alt: bayes q4 plot
Expand All @@ -50,19 +85,29 @@ Posterior Histograms

You can easily view the marginalised Bayesian posteriors from your analysis:

.. code-block:: MATLAB
.. tab-set-code::
.. code-block:: Matlab

plotHists(results)
plotHists(results)

.. code-block:: Python

RAT.plotting.plot_hists(results)

.. image:: ../images/misc/histSmooth.png
:width: 800
:alt: smooth hists

By default, *plotHists* carries out a KDE smooth of the histograms. You can optionally choose no smoothing:

.. code-block:: MATLAB
.. tab-set-code::
.. code-block:: Matlab

plotHists(results,'smooth',false)

.. code-block:: Python

plotHists(results,'smooth',false)
RAT.plotting.plot_hists(results, smooth=False)

.. image:: ../images/misc/histNoSmooth.png
:width: 800
Expand All @@ -75,9 +120,16 @@ Corner Plots

To produce a cornerplot, simply use the *cornerPlot* function:

.. code-block:: MATLAB
.. tab-set-code::
.. code-block:: Matlab

cornerPlot(results)

.. code-block:: Python

RAT.plotting.plot_corner(results)

cornerPlot(results)


.. image:: ../images/misc/cornerPlot.png
:width: 800
Expand All @@ -89,11 +141,16 @@ Chain View

Finally, you can check the integrity of your markov chain as follows:

.. code-block:: MATLAB
.. tab-set-code::
.. code-block:: Matlab

plotChain(results);

.. code-block:: Python

RAT.plotting.plot_chain(results)

mcmcplot(results.chain,[],results.fitNames,'chainpanel');

.. image:: ../images/misc/chainPlot.png
:width: 800
:alt: chainPlot