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 .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ jobs:
python -m pip install --upgrade pip
if [ ${VERSION} == 'dev' ]; then
wget https://github.com/RascalSoftware/RAT/releases/download/nightly/Linux.zip
pip install RATapi
pip install ratapi --upgrade
else
wget "https://github.com/RascalSoftware/RAT/releases/download/${VERSION}/Linux.zip"
pip install RATapi==${VERSION} || pip install RATapi
pip install ratapi==${VERSION} || pip install ratapi --upgrade
fi
unzip Linux.zip -d API/
rm API/utilities/mockFunction.m # as otherwise the MATLAB reference fails to parse it
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ source/_outputs/
.envrc

# autogenerated documentation
source/reference/python/RATapi.*
source/reference/python/ratapi.*
source/python_examples/data/
source/matlab_examples/*.html
source/python_examples/notebooks/*
Expand Down
6 changes: 3 additions & 3 deletions source/_ext/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from docutils import nodes

import RATapi
import ratapi

from sphinx.application import Sphinx
from sphinx.util.docutils import SphinxDirective
Expand Down Expand Up @@ -44,15 +44,15 @@ def setup(app: Sphinx) -> ExtensionMetadata:

def setup_envs(*ignore):
"""Initialise Python/MATLAB environments."""
app.env.snippets_env = {"RAT": RATapi}
app.env.snippets_env = {"RAT": ratapi}
app.env.matlab_engine = setup_matlab()
app.env.matlab_engine.eval(
"cd('API'); addPaths; cd('..'); ratVars = who;", nargout=0
)

def clear_envs(*ignore):
"""Clear Python/MATLAB environments from the build environment."""
app.env.snippets_env = {"RAT": RATapi}
app.env.snippets_env = {"RAT": ratapi}
app.env.matlab_engine.eval(
r"clearvars('-except', 'ratVars', ratVars{:});", nargout=0
)
Expand Down
4 changes: 2 additions & 2 deletions source/advanced/events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The example below registers a function to listen for the ``Plot`` event:

.. code-block:: Python

import RATapi as RAT
import ratapi as RAT
RAT.events.register(RAT.events.EventTypes.Plot, update_plot)

The event listener function is also shown below, it uses one of the plot functions provided by RAT to display the event data. The plot event data contains the current state of the reflectivity and SLDs, along with a number of other items which is detailed below.
Expand Down Expand Up @@ -71,7 +71,7 @@ Register a function as an event listener by providing the event type and the lis

.. code-block:: Python

import RATapi as RAT
import ratapi as RAT

RAT.events.register(RAT.events.EventTypes.Message, handle_event) # Message Event
RAT.events.register(RAT.events.EventTypes.Plot, handle_event) # Plot Event
Expand Down
2 changes: 1 addition & 1 deletion source/calcTypes/data/domains_example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import RATapi as RAT
import ratapi as RAT
import numpy as np

problem = RAT.Project(calculation='domains')
Expand Down
16 changes: 8 additions & 8 deletions source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
'Please download and extract the RAT release to the API folder.')
sys.path.insert(0, matlab_src_dir)

import RATapi
sys.path.insert(0, os.path.dirname(os.path.abspath(RATapi.__file__)))
import ratapi
sys.path.insert(0, os.path.dirname(os.path.abspath(ratapi.__file__)))
project = 'RAT'
copyright = u'2022-{}, ISIS Neutron and Muon Source'.format(datetime.date.today().year)
author = 'Arwel Hughes, Sethu Pastula, Alex Room, Rabiya Farooq, Paul Sharp, Stephen Nneji'
Expand All @@ -52,7 +52,7 @@
templates_path = ['_templates']

# -- Setup example files -----------------------------------------------------
PYTHON_RAT_RELEASE = metadata.version("RATapi")
PYTHON_RAT_RELEASE = metadata.version("ratapi")

MATLAB_AVAILABLE = True
try:
Expand All @@ -67,14 +67,14 @@
zf.extractall()
print("Copying Jupyter notebooks...")
for directory in ['normal_reflectivity', 'domains', 'absorption']:
for file in Path(f"./python-RAT-{PYTHON_RAT_RELEASE}/RATapi/examples/{directory}/").glob('*'):
for file in Path(f"./python-RAT-{PYTHON_RAT_RELEASE}/ratapi/examples/{directory}/").glob('*'):
shutil.copy(file, "./python_examples/notebooks/")
if MATLAB_AVAILABLE: # convert_rascal example requires matlab engine
for file in Path(f"./python-RAT-{PYTHON_RAT_RELEASE}/RATapi/examples/convert_rascal_project/").glob('*'):
for file in Path(f"./python-RAT-{PYTHON_RAT_RELEASE}/ratapi/examples/convert_rascal_project/").glob('*'):
shutil.copy(file, "./python_examples/notebooks/")


shutil.copytree(f"./python-RAT-{PYTHON_RAT_RELEASE}/RATapi/examples/data", "./python_examples/data", dirs_exist_ok=True)
shutil.copytree(f"./python-RAT-{PYTHON_RAT_RELEASE}/ratapi/examples/data", "./python_examples/data", dirs_exist_ok=True)

shutil.rmtree(f"./python-RAT-{PYTHON_RAT_RELEASE}")

Expand Down Expand Up @@ -149,7 +149,7 @@

<div class="admonition note">
This page was generated from the notebook {{ env.docname.split('/')|last|e + '.ipynb' }} found in
<a class="reference external" href="https://github.com/RascalSoftware/python-RAT/blob/"""+PYTHON_RAT_RELEASE+r"""/RATapi/examples/">the Python-RAT repository</a>.
<a class="reference external" href="https://github.com/RascalSoftware/python-RAT/blob/"""+PYTHON_RAT_RELEASE+r"""/ratapi/examples/">the Python-RAT repository</a>.
<a href="{{ env.docname.split('/')|last|e + '.ipynb' }}" class="reference download internal" download>Download notebook</a>.
</div>

Expand All @@ -159,7 +159,7 @@

.. code-block:: python

from RATapi.examples import {{ env.docname.split('/')|last|e }}
from ratapi.examples import {{ env.docname.split('/')|last|e }}
project, results = {{ env.docname.split('/')|last|e }}()

-------------------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ This section provides more detailed information about installing RAT for MATLAB

.. code-block:: console

pip install RATapi
pip install ratapi

``matlabengine`` is an optional dependency only required for MATLAB related actions such as running MATLAB custom functions and converting RasCAL-1 projects.
The version of ``matlabengine`` must match the version of MATLAB installed on the computer. For example, if MATLAB 2023a is installed on the computer,
``matlabengine`` can be installed as shown below:

.. code-block:: console

pip install RATapi[Matlab-2023a]
pip install ratapi[Matlab-2023a]

.. note::

Expand Down
2 changes: 1 addition & 1 deletion source/reference/python/classlist.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ClassList
---------

.. autoclass:: RATapi.ClassList
.. autoclass:: ratapi.ClassList
2 changes: 1 addition & 1 deletion source/reference/python/controls.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ The ``Controls`` class details control parameters for the RAT run. Note that man
specific to certain procedures: the relevant procedure is listed in square brackets before the
field description.

.. autopydantic_model:: RATapi.Controls
.. autopydantic_model:: ratapi.Controls
:members:
2 changes: 1 addition & 1 deletion source/reference/python/core.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ RAT Core
This module contains the `Pybind11 <https://pybind11.readthedocs.io/en/stable/index.html>`_ objects
which are used to interface with RAT's C++ code.

.. automodule:: RATapi.rat_core
.. automodule:: ratapi.rat_core
:members:
4 changes: 2 additions & 2 deletions source/reference/python/enums.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Enums
-----

This utility module (found in ``RATapi.utils.enums``) contains the Enum objects
This utility module (found in ``ratapi.utils.enums``) contains the Enum objects
which are used under the hood to represent arguments given as string options,
such as those for control parameters or background types.

.. automodule:: RATapi.utils.enums
.. automodule:: ratapi.utils.enums
:members:
2 changes: 1 addition & 1 deletion source/reference/python/events.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Events
------

.. automodule:: RATapi.events
.. automodule:: ratapi.events
:members:
2 changes: 1 addition & 1 deletion source/reference/python/examples.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Examples
--------

.. automodule:: RATapi.examples
.. automodule:: ratapi.examples
:members:
2 changes: 1 addition & 1 deletion source/reference/python/inputs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ Inputs
This module contains the objects used to organise input data to RAT to be fed
into the C++ module.

.. automodule:: RATapi.inputs
.. automodule:: ratapi.inputs
:members:
2 changes: 1 addition & 1 deletion source/reference/python/models.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Models
------

.. automodule:: RATapi.models
.. automodule:: ratapi.models
:members:
:inherited-members: RATModel
:exclude-members: RATModel, Signal
2 changes: 1 addition & 1 deletion source/reference/python/outputs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ Outputs
This module contains the Results objects and the relevant objects to retrieve
results data from the C++ module.

.. automodule:: RATapi.outputs
.. automodule:: ratapi.outputs
:members:
4 changes: 2 additions & 2 deletions source/reference/python/plotting.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Plotting
--------

Plotting functionality for RAT results objects is available through the ``RATapi.utils.plotting`` module.
Plotting functionality for RAT results objects is available through the ``ratapi.utils.plotting`` module.

.. note: plot_bayes is currently excluded because its docstring is not valid RST!

.. automodule:: RATapi.utils.plotting
.. automodule:: ratapi.utils.plotting
:members:
:exclude-members: plot_errorbars, plot_ref_sld_helper, assert_bayesian, name_to_index, panel_plot_helper, plot_bayes
2 changes: 1 addition & 1 deletion source/reference/python/project.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Project
-------

.. autopydantic_model:: RATapi.Project
.. autopydantic_model:: ratapi.Project
:members:

2 changes: 1 addition & 1 deletion source/reference/python/run.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Run

The core function to run RAT.

.. autofunction:: RATapi.run
.. autofunction:: ratapi.run
2 changes: 1 addition & 1 deletion source/reference/python/wrappers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ Wrappers
This module contains the wrappers for interfacing with MATLAB custom functions,
such as those for custom layers models or function backgrounds.

.. automodule:: RATapi.wrappers
.. automodule:: ratapi.wrappers
:members:
3 changes: 3 additions & 0 deletions source/tutorial/controls.rst
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,6 @@ See the :ref:`resampling page<resampling>` for more details. In short:

- ``resampleNPoints``: The initial number of domain points (layers) sampled by the algorithm at the start.

``numSimulationPoints``
^^^^^^^^^^^^^^^^^^^^^^^
The number of points used for a reflectivity simulation where no data is present.
4 changes: 2 additions & 2 deletions source/tutorial/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ The code block below shows how to set up each object for each language, as well

.. code-block:: Python

import RATapi as RAT
import ratapi as RAT

# Create project and controls objects
project = RAT.Project()
Expand Down Expand Up @@ -135,7 +135,7 @@ definition and explain what it describes.

.. output:: Python

import RATapi as RAT
import ratapi as RAT

problem = RAT.Project.load("source/tutorial/data/two_contrast_example.json")
print(problem)
Expand Down
4 changes: 2 additions & 2 deletions source/tutorial/project.rst
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ and our new dataset appears in the table:

from importlib.resources import files
import numpy as np
data_path = files("RATapi.examples.data")
data_path = files("ratapi.examples.data")
myData = np.loadtxt(data_path / 'c_PLP0016596.dat', delimiter=',')
problem.data.append(name='My new datafile', data=myData)
print(problem.data)
Expand Down Expand Up @@ -953,7 +953,7 @@ To start, we first make an instance of the **Project** class:

.. code-block:: Python

import RATapi as RAT
import ratapi as RAT
problem = RAT.Project(name='DSPC monolayers')

Then we need to define the parameters we need. We'll do this by making a parameters block, and adding these to the project:
Expand Down
6 changes: 3 additions & 3 deletions source/utilities/conversionFuncs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ To convert this, simply navigate to the project directory, and run the following

.. code-block:: Python

from RATapi.utils.convert import r1_to_project_class
from ratapi.utils.convert import r1_to_project_class

problem = r1_to_project_class('monolayer_8_contrasts.mat')

Expand All @@ -45,7 +45,7 @@ This produces a **Project** object containing the R1 project, which can then be

.. code-block:: Python

import RATapi as RAT
import ratapi as RAT

controls = RAT.Controls(procedure='de', parallel='contrasts')
problem, results = RAT.run(problem, controls)
Expand Down Expand Up @@ -83,7 +83,7 @@ It is also possible to do the opposite conversion, and convert any RAT **Project

.. code-block:: Python

from RATapi.utils.convert import project_class_to_r1
from ratapi.utils.convert import project_class_to_r1

project_class_to_r1(problem, "./testProject/myConvertedProject")

Expand Down