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
21 changes: 18 additions & 3 deletions .github/workflows/documentation-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ jobs:
# This workflow contains a single job called "build"
build_documentation:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
contents: read # to clone the repository
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

steps:
- name: Checkout
uses: actions/checkout@master
Expand All @@ -34,16 +44,21 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
python-version: 3.12
- name: Install Pandoc, repo and dependencies
run: |
sudo apt install pandoc
sudo apt install libcairo2-dev
pip install sphinx==8.1.3
pip install . '.[dev,docs]'

- name: Install Jupyter kernel
run: |
python -m ipykernel install --user --name=python3

- name: Build and Commit
uses: sphinx-notes/pages@master
uses: sphinx-notes/pages@v3
with:
install_requirements: false
sphinx_version: 8.1.3
documentation_path: docs/src
- name: Push changes
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ossar-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
OSSAR-Scan:
# OSSAR runs on windows-latest.
# ubuntu-latest and macos-latest support coming soon
runs-on: windows-latest
runs-on: windows-2022

steps:
# Checkout your code repository to scan
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
max-parallel: 4
matrix:
python-version: ['3.11', '3.12']
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-latest, windows-2022]

runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, '[ci skip]')"
Expand Down
18 changes: 6 additions & 12 deletions docs/src/tutorials/advancedfitting/multi_contrast.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
")\n",
"d13d2o.constrain_area_per_molecule = True\n",
"d13d2o.conformal_roughness = True\n",
"d13d2o.constrain_solvent_roughness(d2o_layer)"
"d13d2o.constrain_solvent_roughness(d2o_layer.roughness)"
]
},
{
Expand Down Expand Up @@ -291,7 +291,7 @@
")\n",
"d70d2o.constrain_area_per_molecule = True\n",
"d70d2o.conformal_roughness = True\n",
"d70d2o.constrain_solvent_roughness(d2o_layer)"
"d70d2o.constrain_solvent_roughness(d2o_layer.roughness)"
]
},
{
Expand Down Expand Up @@ -331,7 +331,7 @@
")\n",
"d83acmw.constrain_area_per_molecule = True\n",
"d83acmw.conformal_roughness = True\n",
"d83acmw.constrain_solvent_roughness(acmw_layer)"
"d83acmw.constrain_solvent_roughness(acmw_layer.roughness)"
]
},
{
Expand All @@ -341,8 +341,8 @@
"source": [
"## Introducing constraints\n",
"\n",
"Then to ensure that the structure (thicknesss, area per molecule, etc.) is kept the same between the different contrasts we constain these (`layer2` is the head layer and `layer1`, which the neutron are incident on first are the tail layer). \n",
"The `constrain_multiple_contrast` method allows this, not that is it important that a chain of constraints is produced, one constraining the next. "
"To ensure that the structure (thicknesss, area per molecule, etc.) is kept the same between the different contrasts we constrain these (`layer2` is the head layer and `layer1`, which the neutron are incident on first are the tail layer). \n",
"The `constrain_multiple_contrast` method allows this, note that it is important that a chain of constraints is produced, one constraining the next. "
]
},
{
Expand All @@ -352,12 +352,6 @@
"metadata": {},
"outputs": [],
"source": [
"# These four lines should be removed in future\n",
"d70d2o.head_layer.area_per_molecule_parameter.enabled = True\n",
"d70d2o.tail_layer.area_per_molecule_parameter.enabled = True\n",
"d83acmw.head_layer.area_per_molecule_parameter.enabled = True\n",
"d83acmw.tail_layer.area_per_molecule_parameter.enabled = True\n",
"\n",
"d70d2o.constrain_multiple_contrast(d13d2o)\n",
"d83acmw.constrain_multiple_contrast(d70d2o)"
]
Expand Down Expand Up @@ -571,7 +565,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.9"
"version": "3.12.11"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions docs/src/tutorials/fitting/monolayer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@
"calculator = CalculatorFactory()\n",
"model.interface = calculator\n",
"fitter = MultiFitter(model)\n",
"fitter.switch_minimizer(AvailableMinimizers.LMFit_differential_evolution)\n",
"# fitter.switch_minimizer(AvailableMinimizers.LMFit_differential_evolution)\n",
"analysed = fitter.fit(data)"
]
},
Expand Down Expand Up @@ -487,7 +487,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.9"
"version": "3.12.11"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions docs/src/tutorials/fitting/repeating.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
"outputs": [],
"source": [
"fitter = MultiFitter(model)\n",
"fitter.switch_minimizer(AvailableMinimizers.LMFit_differential_evolution)\n",
"# fitter.switch_minimizer(AvailableMinimizers.LMFit_differential_evolution)\n",
"analysed = fitter.fit(data)\n",
"analysed"
]
Expand Down Expand Up @@ -341,7 +341,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.9"
"version": "3.12.11"
}
},
"nbformat": 4,
Expand Down
73 changes: 35 additions & 38 deletions docs/src/tutorials/simulation/magnetism.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"from easyreflectometry.sample import Layer\n",
"from easyreflectometry.sample import Material\n",
"from easyreflectometry.sample import Multilayer\n",
"from easyreflectometry.sample import Sample"
"from easyreflectometry.sample import Sample\n",
"from easyreflectometry.calculators.refl1d.wrapper import _get_polarized_probe"
]
},
{
Expand Down Expand Up @@ -331,15 +332,17 @@
" refl1d_sld_4(100, 0, magnetism=refl1d.names.Magnetism(rhoM=10, thetaM=70)) | \n",
" refl1d_vacuum(0, 0)\n",
") \n",
"probe = refl1d.names.QProbe(\n",
" Q=model_coords,\n",
" dQ=np.zeros(len(model_coords)),\n",
" intensity=1,\n",
" background=0,\n",
" )\n",
"model_name = model.unique_name\n",
"storage = {'model': {model_name: {}}}\n",
"storage['model'][model_name]['scale'] = 10.0\n",
"storage['model'][model_name]['bkg'] = 20.0\n",
"\n",
"polarized_probe = _get_polarized_probe(\n",
" q_array=model_coords,\n",
" dq_array=np.zeros(len(model_coords)),\n",
" model_name=model_name,\n",
" storage=storage)\n",
"\n",
"four_probes = [probe, None, None, None]\n",
"polarized_probe = refl1d.names.PolarizedQProbe(xs=four_probes, name='polarized')\n",
"experiment = refl1d.names.Experiment(probe=polarized_probe, sample=refl1d_sample)\n",
"model_data_magnetism_ref1d = experiment.reflectivity()[0][1]\n",
"plt.plot(model_coords, model_data_magnetism_ref1d, '-k', label='Refl1d', linewidth=4)\n",
Expand Down Expand Up @@ -413,34 +416,28 @@
" refl1d_vacuum(0, 0)\n",
") \n",
"\n",
"probe_pp = refl1d.names.QProbe(\n",
" Q=model_coords,\n",
" dQ=np.zeros(len(model_coords)),\n",
" intensity=1,\n",
" background=0,\n",
" )\n",
"probe_pm = refl1d.names.QProbe(\n",
" Q=model_coords,\n",
" dQ=np.zeros(len(model_coords)),\n",
" intensity=1,\n",
" background=0,\n",
" )\n",
"probe_mp = refl1d.names.QProbe(\n",
" Q=model_coords,\n",
" dQ=np.zeros(len(model_coords)),\n",
" intensity=1,\n",
" background=0,\n",
" )\n",
"probe_mm = refl1d.names.QProbe(\n",
" Q=model_coords,\n",
" dQ=np.zeros(len(model_coords)),\n",
" intensity=1,\n",
" background=0,\n",
" )\n",
"model_name = model.unique_name\n",
"storage = {'model': {model_name: {}}}\n",
"storage['model'][model_name]['scale'] = 1.0\n",
"storage['model'][model_name]['bkg'] = 0.0\n",
"\n",
"four_probes = [probe_pp, probe_pm, probe_mp, probe_mm]\n",
"polarized_probe = refl1d.names.PolarizedQProbe(xs=four_probes, name='polarized')\n",
"experiment = refl1d.names.Experiment(probe=polarized_probe, sample=refl1d_sample)\n",
"polarized_probe = _get_polarized_probe(\n",
" q_array=model_coords,\n",
" dq_array=np.zeros(len(model_coords)),\n",
" model_name=model_name,\n",
" storage=storage,\n",
" all_polarizations=True)\n",
"\n",
"experiment = refl1d.names.Experiment(probe=polarized_probe, sample=refl1d_sample)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "239e2a04",
"metadata": {},
"outputs": [],
"source": [
"model_data_magnetism_ref1d_raw_pp = experiment.reflectivity()[0][1]\n",
"model_data_magnetism_ref1d_raw_pm = experiment.reflectivity()[1][1]\n",
"model_data_magnetism_ref1d_raw_mp = experiment.reflectivity()[2][1]\n",
Expand Down Expand Up @@ -555,7 +552,7 @@
],
"metadata": {
"kernelspec": {
"display_name": ".venv2",
"display_name": "era",
"language": "python",
"name": "python3"
},
Expand All @@ -569,7 +566,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.11.12"
}
},
"nbformat": 4,
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ classifiers = [
requires-python = ">=3.11,<3.13"

dependencies = [
#"easyscience @ git+https://github.com/easyscience/corelib.git@dict_size_changed_bug",
"easyscience",
"scipp",
"refnx",
"refl1d>=1.0.0rc0",
"orsopy",
"svglib<1.6 ; platform_system=='Linux'",
"xhtml2pdf",
"bumps",
]
Expand All @@ -60,7 +62,7 @@ dev = [
docs = [
"myst_parser",
"nbsphinx",
"sphinx==8.1.3",
"sphinx<=8.1.3",
"sphinx_autodoc_typehints",
"sphinx_book_theme",
"sphinx-copybutton",
Expand Down Expand Up @@ -142,7 +144,7 @@ python =
PLATFORM =
ubuntu-latest: linux
macos-latest: macos
windows-latest: windows
windows-latest: 2022
[testenv]
passenv =
CI
Expand Down
Loading