Skip to content

Commit b7216cb

Browse files
committed
Merge branch 'develop' into orso_support
2 parents 4bc9ba0 + 072f43b commit b7216cb

File tree

8 files changed

+68
-61
lines changed

8 files changed

+68
-61
lines changed

.github/workflows/documentation-build.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ jobs:
2323
# This workflow contains a single job called "build"
2424
build_documentation:
2525
runs-on: ubuntu-latest
26+
environment:
27+
name: github-pages
28+
url: ${{ steps.deployment.outputs.page_url }}
29+
30+
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
31+
permissions:
32+
contents: read # to clone the repository
33+
pages: write # to deploy to Pages
34+
id-token: write # to verify the deployment originates from an appropriate source
35+
2636
steps:
2737
- name: Checkout
2838
uses: actions/checkout@master
@@ -34,16 +44,21 @@ jobs:
3444
- name: Set up Python
3545
uses: actions/setup-python@v5
3646
with:
37-
python-version: 3.11
47+
python-version: 3.12
3848
- name: Install Pandoc, repo and dependencies
3949
run: |
4050
sudo apt install pandoc
51+
sudo apt install libcairo2-dev
4152
pip install sphinx==8.1.3
4253
pip install . '.[dev,docs]'
54+
55+
- name: Install Jupyter kernel
56+
run: |
57+
python -m ipykernel install --user --name=python3
58+
4359
- name: Build and Commit
44-
uses: sphinx-notes/pages@master
60+
uses: sphinx-notes/pages@v3
4561
with:
46-
install_requirements: false
4762
sphinx_version: 8.1.3
4863
documentation_path: docs/src
4964
- name: Push changes

.github/workflows/ossar-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
OSSAR-Scan:
1414
# OSSAR runs on windows-latest.
1515
# ubuntu-latest and macos-latest support coming soon
16-
runs-on: windows-latest
16+
runs-on: windows-2022
1717

1818
steps:
1919
# Checkout your code repository to scan

.github/workflows/python-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
max-parallel: 4
3030
matrix:
3131
python-version: ['3.11', '3.12']
32-
os: [ubuntu-latest, macos-latest, windows-latest]
32+
os: [ubuntu-latest, macos-latest, windows-2022]
3333

3434
runs-on: ${{ matrix.os }}
3535
if: "!contains(github.event.head_commit.message, '[ci skip]')"

docs/src/tutorials/advancedfitting/multi_contrast.ipynb

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@
251251
")\n",
252252
"d13d2o.constrain_area_per_molecule = True\n",
253253
"d13d2o.conformal_roughness = True\n",
254-
"d13d2o.constrain_solvent_roughness(d2o_layer)"
254+
"d13d2o.constrain_solvent_roughness(d2o_layer.roughness)"
255255
]
256256
},
257257
{
@@ -291,7 +291,7 @@
291291
")\n",
292292
"d70d2o.constrain_area_per_molecule = True\n",
293293
"d70d2o.conformal_roughness = True\n",
294-
"d70d2o.constrain_solvent_roughness(d2o_layer)"
294+
"d70d2o.constrain_solvent_roughness(d2o_layer.roughness)"
295295
]
296296
},
297297
{
@@ -331,7 +331,7 @@
331331
")\n",
332332
"d83acmw.constrain_area_per_molecule = True\n",
333333
"d83acmw.conformal_roughness = True\n",
334-
"d83acmw.constrain_solvent_roughness(acmw_layer)"
334+
"d83acmw.constrain_solvent_roughness(acmw_layer.roughness)"
335335
]
336336
},
337337
{
@@ -341,8 +341,8 @@
341341
"source": [
342342
"## Introducing constraints\n",
343343
"\n",
344-
"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",
345-
"The `constrain_multiple_contrast` method allows this, not that is it important that a chain of constraints is produced, one constraining the next. "
344+
"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",
345+
"The `constrain_multiple_contrast` method allows this, note that it is important that a chain of constraints is produced, one constraining the next. "
346346
]
347347
},
348348
{
@@ -352,12 +352,6 @@
352352
"metadata": {},
353353
"outputs": [],
354354
"source": [
355-
"# These four lines should be removed in future\n",
356-
"d70d2o.head_layer.area_per_molecule_parameter.enabled = True\n",
357-
"d70d2o.tail_layer.area_per_molecule_parameter.enabled = True\n",
358-
"d83acmw.head_layer.area_per_molecule_parameter.enabled = True\n",
359-
"d83acmw.tail_layer.area_per_molecule_parameter.enabled = True\n",
360-
"\n",
361355
"d70d2o.constrain_multiple_contrast(d13d2o)\n",
362356
"d83acmw.constrain_multiple_contrast(d70d2o)"
363357
]
@@ -571,7 +565,7 @@
571565
"name": "python",
572566
"nbconvert_exporter": "python",
573567
"pygments_lexer": "ipython3",
574-
"version": "3.12.9"
568+
"version": "3.12.11"
575569
}
576570
},
577571
"nbformat": 4,

docs/src/tutorials/fitting/monolayer.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@
382382
"calculator = CalculatorFactory()\n",
383383
"model.interface = calculator\n",
384384
"fitter = MultiFitter(model)\n",
385-
"fitter.switch_minimizer(AvailableMinimizers.LMFit_differential_evolution)\n",
385+
"# fitter.switch_minimizer(AvailableMinimizers.LMFit_differential_evolution)\n",
386386
"analysed = fitter.fit(data)"
387387
]
388388
},
@@ -487,7 +487,7 @@
487487
"name": "python",
488488
"nbconvert_exporter": "python",
489489
"pygments_lexer": "ipython3",
490-
"version": "3.12.9"
490+
"version": "3.12.11"
491491
}
492492
},
493493
"nbformat": 4,

docs/src/tutorials/fitting/repeating.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@
274274
"outputs": [],
275275
"source": [
276276
"fitter = MultiFitter(model)\n",
277-
"fitter.switch_minimizer(AvailableMinimizers.LMFit_differential_evolution)\n",
277+
"# fitter.switch_minimizer(AvailableMinimizers.LMFit_differential_evolution)\n",
278278
"analysed = fitter.fit(data)\n",
279279
"analysed"
280280
]
@@ -341,7 +341,7 @@
341341
"name": "python",
342342
"nbconvert_exporter": "python",
343343
"pygments_lexer": "ipython3",
344-
"version": "3.12.9"
344+
"version": "3.12.11"
345345
}
346346
},
347347
"nbformat": 4,

docs/src/tutorials/simulation/magnetism.ipynb

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
"from easyreflectometry.sample import Layer\n",
4444
"from easyreflectometry.sample import Material\n",
4545
"from easyreflectometry.sample import Multilayer\n",
46-
"from easyreflectometry.sample import Sample"
46+
"from easyreflectometry.sample import Sample\n",
47+
"from easyreflectometry.calculators.refl1d.wrapper import _get_polarized_probe"
4748
]
4849
},
4950
{
@@ -331,15 +332,17 @@
331332
" refl1d_sld_4(100, 0, magnetism=refl1d.names.Magnetism(rhoM=10, thetaM=70)) | \n",
332333
" refl1d_vacuum(0, 0)\n",
333334
") \n",
334-
"probe = refl1d.names.QProbe(\n",
335-
" Q=model_coords,\n",
336-
" dQ=np.zeros(len(model_coords)),\n",
337-
" intensity=1,\n",
338-
" background=0,\n",
339-
" )\n",
335+
"model_name = model.unique_name\n",
336+
"storage = {'model': {model_name: {}}}\n",
337+
"storage['model'][model_name]['scale'] = 10.0\n",
338+
"storage['model'][model_name]['bkg'] = 20.0\n",
339+
"\n",
340+
"polarized_probe = _get_polarized_probe(\n",
341+
" q_array=model_coords,\n",
342+
" dq_array=np.zeros(len(model_coords)),\n",
343+
" model_name=model_name,\n",
344+
" storage=storage)\n",
340345
"\n",
341-
"four_probes = [probe, None, None, None]\n",
342-
"polarized_probe = refl1d.names.PolarizedQProbe(xs=four_probes, name='polarized')\n",
343346
"experiment = refl1d.names.Experiment(probe=polarized_probe, sample=refl1d_sample)\n",
344347
"model_data_magnetism_ref1d = experiment.reflectivity()[0][1]\n",
345348
"plt.plot(model_coords, model_data_magnetism_ref1d, '-k', label='Refl1d', linewidth=4)\n",
@@ -413,34 +416,28 @@
413416
" refl1d_vacuum(0, 0)\n",
414417
") \n",
415418
"\n",
416-
"probe_pp = refl1d.names.QProbe(\n",
417-
" Q=model_coords,\n",
418-
" dQ=np.zeros(len(model_coords)),\n",
419-
" intensity=1,\n",
420-
" background=0,\n",
421-
" )\n",
422-
"probe_pm = refl1d.names.QProbe(\n",
423-
" Q=model_coords,\n",
424-
" dQ=np.zeros(len(model_coords)),\n",
425-
" intensity=1,\n",
426-
" background=0,\n",
427-
" )\n",
428-
"probe_mp = refl1d.names.QProbe(\n",
429-
" Q=model_coords,\n",
430-
" dQ=np.zeros(len(model_coords)),\n",
431-
" intensity=1,\n",
432-
" background=0,\n",
433-
" )\n",
434-
"probe_mm = refl1d.names.QProbe(\n",
435-
" Q=model_coords,\n",
436-
" dQ=np.zeros(len(model_coords)),\n",
437-
" intensity=1,\n",
438-
" background=0,\n",
439-
" )\n",
419+
"model_name = model.unique_name\n",
420+
"storage = {'model': {model_name: {}}}\n",
421+
"storage['model'][model_name]['scale'] = 1.0\n",
422+
"storage['model'][model_name]['bkg'] = 0.0\n",
440423
"\n",
441-
"four_probes = [probe_pp, probe_pm, probe_mp, probe_mm]\n",
442-
"polarized_probe = refl1d.names.PolarizedQProbe(xs=four_probes, name='polarized')\n",
443-
"experiment = refl1d.names.Experiment(probe=polarized_probe, sample=refl1d_sample)\n",
424+
"polarized_probe = _get_polarized_probe(\n",
425+
" q_array=model_coords,\n",
426+
" dq_array=np.zeros(len(model_coords)),\n",
427+
" model_name=model_name,\n",
428+
" storage=storage,\n",
429+
" all_polarizations=True)\n",
430+
"\n",
431+
"experiment = refl1d.names.Experiment(probe=polarized_probe, sample=refl1d_sample)\n"
432+
]
433+
},
434+
{
435+
"cell_type": "code",
436+
"execution_count": null,
437+
"id": "239e2a04",
438+
"metadata": {},
439+
"outputs": [],
440+
"source": [
444441
"model_data_magnetism_ref1d_raw_pp = experiment.reflectivity()[0][1]\n",
445442
"model_data_magnetism_ref1d_raw_pm = experiment.reflectivity()[1][1]\n",
446443
"model_data_magnetism_ref1d_raw_mp = experiment.reflectivity()[2][1]\n",
@@ -555,7 +552,7 @@
555552
],
556553
"metadata": {
557554
"kernelspec": {
558-
"display_name": ".venv2",
555+
"display_name": "era",
559556
"language": "python",
560557
"name": "python3"
561558
},
@@ -569,7 +566,7 @@
569566
"name": "python",
570567
"nbconvert_exporter": "python",
571568
"pygments_lexer": "ipython3",
572-
"version": "3.11.9"
569+
"version": "3.11.12"
573570
}
574571
},
575572
"nbformat": 4,

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ classifiers = [
2929
requires-python = ">=3.11,<3.13"
3030

3131
dependencies = [
32+
#"easyscience @ git+https://github.com/easyscience/corelib.git@dict_size_changed_bug",
3233
"easyscience",
3334
"scipp",
3435
"refnx",
@@ -61,7 +62,7 @@ dev = [
6162
docs = [
6263
"myst_parser",
6364
"nbsphinx",
64-
"sphinx==8.1.3",
65+
"sphinx<=8.1.3",
6566
"sphinx_autodoc_typehints",
6667
"sphinx_book_theme",
6768
"sphinx-copybutton",
@@ -143,7 +144,7 @@ python =
143144
PLATFORM =
144145
ubuntu-latest: linux
145146
macos-latest: macos
146-
windows-latest: windows
147+
windows-latest: 2022
147148
[testenv]
148149
passenv =
149150
CI

0 commit comments

Comments
 (0)