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
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Build sdist
run: |
pip install pybind11
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ jobs:
run: |
export PATH="$pythonLocation:$PATH"
python -m pip install -e .[Dev,Orso]
pytest tests/ --cov=RATapi --cov-report=term
pytest tests/ --cov=ratapi --cov-report=term
29 changes: 0 additions & 29 deletions RATapi/__init__.py

This file was deleted.

25 changes: 0 additions & 25 deletions RATapi/examples/__init__.py

This file was deleted.

1 change: 0 additions & 1 deletion RATapi/utils/__init__.py

This file was deleted.

29 changes: 29 additions & 0 deletions ratapi/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""ratapi is a Python package for modelling, fitting and optimising reflectivity problems."""

from contextlib import suppress

import ratapi.examples as examples
from ratapi import events, models
from ratapi.classlist import ClassList
from ratapi.controls import Controls
from ratapi.outputs import BayesResults, Results
from ratapi.project import Project
from ratapi.run import run
from ratapi.utils import convert, plotting

with suppress(ImportError): # orsopy is an optional dependency
from ratapi.utils import orso as orso

__all__ = [
"examples",
"models",
"events",
"ClassList",
"Controls",
"BayesResults",
"Results",
"Project",
"run",
"plotting",
"convert",
]
File renamed without changes.
4 changes: 2 additions & 2 deletions RATapi/controls.py → ratapi/controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
model_validator,
)

from RATapi.utils.custom_errors import custom_pydantic_validation_error
from RATapi.utils.enums import BoundHandling, Display, Parallel, Procedures, Strategies
from ratapi.utils.custom_errors import custom_pydantic_validation_error
from ratapi.utils.enums import BoundHandling, Display, Parallel, Procedures, Strategies

common_fields = ["procedure", "parallel", "calcSldDuringFit", "resampleMinAngle", "resampleNPoints", "display"]
update_fields = ["updateFreq", "updatePlotFreq"]
Expand Down
2 changes: 1 addition & 1 deletion RATapi/events.py → ratapi/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
from typing import Callable, Union

from RATapi.rat_core import EventBridge, EventTypes, PlotEventData, ProgressEventData
from ratapi.rat_core import EventBridge, EventTypes, PlotEventData, ProgressEventData


def notify(event_type: EventTypes, data: Union[str, PlotEventData, ProgressEventData]) -> None:
Expand Down
25 changes: 25 additions & 0 deletions ratapi/examples/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""Usage examples for the Python RAT API."""

from ratapi.examples.absorption.absorption import absorption
from ratapi.examples.convert_rascal_project.convert_rascal import convert_rascal
from ratapi.examples.domains.domains_custom_layers import domains_custom_layers
from ratapi.examples.domains.domains_custom_XY import domains_custom_XY
from ratapi.examples.domains.domains_standard_layers import domains_standard_layers
from ratapi.examples.normal_reflectivity.DSPC_custom_layers import DSPC_custom_layers
from ratapi.examples.normal_reflectivity.DSPC_custom_XY import DSPC_custom_XY
from ratapi.examples.normal_reflectivity.DSPC_data_background import DSPC_data_background
from ratapi.examples.normal_reflectivity.DSPC_function_background import DSPC_function_background
from ratapi.examples.normal_reflectivity.DSPC_standard_layers import DSPC_standard_layers

__all__ = [
"absorption",
"domains_custom_layers",
"domains_custom_XY",
"domains_standard_layers",
"DSPC_custom_layers",
"DSPC_custom_XY",
"DSPC_standard_layers",
"DSPC_data_background",
"DSPC_function_background",
"convert_rascal",
]
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"import numpy as np\n",
"from IPython.display import Code\n",
"\n",
"import RATapi as RAT\n",
"from RATapi.models import Parameter"
"import ratapi as RAT\n",
"from ratapi.models import Parameter"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import numpy as np

import RATapi as RAT
import ratapi as RAT


def absorption():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"source": [
"import numpy as np\n",
"\n",
"import RATapi as RAT\n",
"from RATapi.models import Parameter, Background, Resolution, Data, Contrast"
"import ratapi as RAT\n",
"from ratapi.models import Parameter, Background, Resolution, Data, Contrast"
]
},
{
Expand Down Expand Up @@ -263,7 +263,7 @@
"source": [
"import matplotlib.pyplot as plt\n",
"from matplotlib import colormaps\n",
"import RATapi.utils.plotting as RATplot\n",
"import ratapi.utils.plotting as RATplot\n",
"\n",
"fig, axes = plt.subplots(3, 2, figsize=(6, 9))\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
import matplotlib.pyplot as plt
import numpy as np

import RATapi as RAT
import RATapi.utils.plotting as RATplot
from RATapi.models import Background, Contrast, Data, Parameter, Resolution
import ratapi as RAT
import ratapi.utils.plotting as RATplot
from ratapi.models import Background, Contrast, Data, Parameter, Resolution

PWD = Path(__file__).parents[0]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"metadata": {},
"outputs": [],
"source": [
"from RATapi.utils.convert import r1_to_project\n",
"from ratapi.utils.convert import r1_to_project\n",
"\n",
"project = r1_to_project(\"R1monolayerVolumeModel.mat\")\n",
"print(project)"
Expand Down Expand Up @@ -99,7 +99,7 @@
"metadata": {},
"outputs": [],
"source": [
"from RATapi.examples import DSPC_standard_layers\n",
"from ratapi.examples import DSPC_standard_layers\n",
"lipid_bilayer_project = DSPC_standard_layers()[0]\n",
"print(lipid_bilayer_project)"
]
Expand All @@ -121,7 +121,7 @@
"metadata": {},
"outputs": [],
"source": [
"from RATapi.utils.convert import project_to_r1\n",
"from ratapi.utils.convert import project_to_r1\n",
"from pprint import pp # for printing the struct\n",
"\n",
"# save to a file called lipid_bilayer.mat\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pathlib
from pprint import pp

import RATapi as RAT
import ratapi as RAT


# convert R1 project to Project class
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"import pathlib\n",
"from IPython.display import Code\n",
"\n",
"import RATapi as RAT\n",
"from RATapi.models import Parameter"
"import ratapi as RAT\n",
"from ratapi.models import Parameter"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pathlib

import RATapi as RAT
import ratapi as RAT


def domains_custom_XY():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"import pathlib\n",
"from IPython.display import Code\n",
"\n",
"import RATapi as RAT\n",
"from RATapi.models import Parameter"
"import ratapi as RAT\n",
"from ratapi.models import Parameter"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pathlib

import RATapi as RAT
import ratapi as RAT


def domains_custom_layers():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"metadata": {},
"outputs": [],
"source": [
"import RATapi as RAT\n",
"from RATapi.models import Layer, Parameter"
"import ratapi as RAT\n",
"from ratapi.models import Layer, Parameter"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""An example using domains with standard layers."""

import RATapi as RAT
import ratapi as RAT


def domains_standard_layers():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import numpy as np

import RATapi as RAT
import ratapi as RAT


def two_contrast_example():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import setup_problem

import RATapi as RAT
import ratapi as RAT

path = pathlib.Path(__file__).parent

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import numpy as np

import RATapi as RAT
import ratapi as RAT


def make_example_problem():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import numpy as np

import RATapi as RAT
import ratapi as RAT


def DSPC_custom_XY():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"import numpy as np\n",
"from IPython.display import Code\n",
"\n",
"import RATapi as RAT\n",
"from RATapi.models import Parameter"
"import ratapi as RAT\n",
"from ratapi.models import Parameter"
]
},
{
Expand Down Expand Up @@ -730,7 +730,7 @@
"+-------+------------+------------------------+---------------------+----------+-------------------------------------------------------------------------+\n",
"| index | name | filename | function name | language | path |\n",
"+-------+------------+------------------------+---------------------+----------+-------------------------------------------------------------------------+\n",
"| 0 | DSPC Model | custom_bilayer_DSPC.py | custom_bilayer_DSPC | python | /mnt/c/Users/gnn85523/projects/python-RAT/RATapi/examples/non_polarised |\n",
"| 0 | DSPC Model | custom_bilayer_DSPC.py | custom_bilayer_DSPC | python | /mnt/c/Users/gnn85523/projects/python-RAT/ratapi/examples/non_polarised |\n",
"+-------+------------+------------------------+---------------------+----------+-------------------------------------------------------------------------+\n",
"\n",
"Data: ----------------------------------------------------------------------------------------------\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import numpy as np

import RATapi as RAT
import ratapi as RAT


def DSPC_custom_layers():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"import numpy as np\n",
"from IPython.display import Code\n",
"\n",
"import RATapi as RAT\n",
"from RATapi.models import Parameter"
"import ratapi as RAT\n",
"from ratapi.models import Parameter"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import numpy as np

import RATapi as RAT
import ratapi as RAT


def DSPC_data_background():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import numpy as np

import RATapi as RAT
import ratapi as RAT


def DSPC_function_background():
Expand Down
Loading