Skip to content

Commit

Permalink
180 extract functionality from sample in easyreflectometryappproxiesm…
Browse files Browse the repository at this point in the history
…odel to lib (#183)

* renaming from item to assembly

* collections are together in folder

* moving responsibilities from model to sample

* rename experiment to model

* test for sample

* ruff

* get classes from module

* add Multilayer assembly if none

* cleaning of sample

* experiment to model and new sample structure

* Update src/easyreflectometry/sample/collections/sample.py

* update jupyter
  • Loading branch information
andped10 authored Sep 20, 2024
1 parent 5d48702 commit 21c958d
Show file tree
Hide file tree
Showing 40 changed files with 687 additions and 393 deletions.
21 changes: 11 additions & 10 deletions docs/src/tutorials/fitting/repeating.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "29d5d62d-af4a-416d-bbe2-1338d32b30f5",
"metadata": {},
"outputs": [],
Expand All @@ -45,8 +45,9 @@
"from easyreflectometry.sample import Sample\n",
"from easyreflectometry.sample import Material\n",
"from easyreflectometry.sample import RepeatingMultilayer\n",
"from easyreflectometry.experiment import Model\n",
"from easyreflectometry.experiment import PercentageFhwm\n",
"from easyreflectometry.sample import Multilayer\n",
"from easyreflectometry.model import Model\n",
"from easyreflectometry.model import PercentageFhwm\n",
"from easyreflectometry.calculators import CalculatorFactory\n",
"from easyreflectometry.fitting import Fitter\n",
"from easyreflectometry.plot import plot\n",
Expand Down Expand Up @@ -87,7 +88,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"id": "7121c7e9",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -141,7 +142,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"id": "0f95d620-35b7-4b47-a3b4-9e33d5525b50",
"metadata": {},
"outputs": [],
Expand All @@ -154,7 +155,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"id": "9a0b37ed-8714-4614-b49f-1e86ac232ac1",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -195,13 +196,13 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"id": "fed8d60f-a4a7-40f1-8063-eb975bfa6115",
"metadata": {},
"outputs": [],
"source": [
"resolution_function = PercentageFhwm(0)\n",
"sample = Sample(superphase, rep_multilayer, subphase, name='Multilayer Structure')\n",
"sample = Sample(Multilayer(superphase), rep_multilayer, Multilayer(subphase), name='Multilayer Structure')\n",
"model = Model(\n",
" sample=sample,\n",
" scale=1,\n",
Expand All @@ -221,7 +222,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"id": "db1e3df9-d0fa-421a-a959-a8b2fe483310",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -340,7 +341,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.12.5"
}
},
"nbformat": 4,
Expand Down
32 changes: 16 additions & 16 deletions docs/src/tutorials/fitting/simple_fitting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "f026d35c-6a4a-4e9d-889c-d23ea6ee7adc",
"metadata": {},
"outputs": [],
Expand All @@ -39,8 +39,8 @@
"from easyreflectometry.sample import Sample\n",
"from easyreflectometry.sample import Material\n",
"from easyreflectometry.sample import Multilayer\n",
"from easyreflectometry.experiment import Model\n",
"from easyreflectometry.experiment import PercentageFhwm\n",
"from easyreflectometry.model import Model\n",
"from easyreflectometry.model import PercentageFhwm\n",
"from easyreflectometry.calculators import CalculatorFactory\n",
"from easyreflectometry.fitting import Fitter\n",
"from easyreflectometry.plot import plot"
Expand Down Expand Up @@ -79,7 +79,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"id": "7d851064-605c-4f80-a510-197bcdbff2ea",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -157,7 +157,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"id": "1fd5d9ba-a912-40f1-96a9-8d8d85c35c18",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -196,7 +196,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"id": "bfd2d8a1-35fe-4a6c-aeee-93f1b4066b61",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -235,7 +235,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 10,
"id": "a6508395-d292-4338-9fbe-77e19b011ae6",
"metadata": {},
"outputs": [],
Expand All @@ -253,12 +253,12 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 11,
"id": "2a0aee2a-e77e-4558-a8b0-ef2d1cffd4d0",
"metadata": {},
"outputs": [],
"source": [
"sample = Sample(superphase, film_layer, subphase, name='Film Structure')"
"sample = Sample(superphase, Multilayer(film_layer), Multilayer(subphase), name='Film Structure')"
]
},
{
Expand Down Expand Up @@ -301,7 +301,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 13,
"id": "8646c977-28b4-4cd4-adbd-fc263359ca1c",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -347,7 +347,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 18,
"id": "a4d3eae5-ec8d-4a7f-91ef-fcce3cc5a5ed",
"metadata": {},
"outputs": [],
Expand All @@ -373,7 +373,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 19,
"id": "7e2d7b81-7b49-4831-9508-75e0e234f15f",
"metadata": {},
"outputs": [],
Expand All @@ -400,7 +400,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 20,
"id": "cdbe172a-1283-4cdc-8fb2-d3383b8d21b3",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -439,7 +439,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 22,
"id": "3648873e-16bb-449d-b90d-8b1bd4f05eb6",
"metadata": {},
"outputs": [],
Expand All @@ -458,7 +458,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 23,
"id": "9762fc0b-c4c2-4f92-8560-079ea248dfca",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -537,7 +537,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.12.5"
}
},
"nbformat": 4,
Expand Down
20 changes: 10 additions & 10 deletions docs/src/tutorials/magnetism.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "29d5d62d-af4a-416d-bbe2-1338d32b30f5",
"metadata": {},
"outputs": [],
Expand All @@ -38,8 +38,8 @@
"import easyreflectometry\n",
"\n",
"from easyreflectometry.calculators import CalculatorFactory\n",
"from easyreflectometry.experiment import Model\n",
"from easyreflectometry.experiment import PercentageFhwm\n",
"from easyreflectometry.model import Model\n",
"from easyreflectometry.model import PercentageFhwm\n",
"from easyreflectometry.sample import Layer\n",
"from easyreflectometry.sample import Material\n",
"from easyreflectometry.sample import Multilayer\n",
Expand Down Expand Up @@ -91,7 +91,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"id": "0f95d620-35b7-4b47-a3b4-9e33d5525b50",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -119,13 +119,13 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"id": "2af8c30b",
"metadata": {},
"outputs": [],
"source": [
"two_layers = Multilayer([sld_4_layer, sld_8_layer], name='SLD 4/8 Layer')\n",
"sample = Sample(superphase, two_layers, subphase, name='Two Layer Sample')\n",
"sample = Sample(Multilayer(superphase), two_layers, Multilayer(subphase), name='Two Layer Sample')\n",
"model = Model(\n",
" sample=sample,\n",
" scale=1,\n",
Expand All @@ -144,7 +144,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"id": "b0259cd0",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -175,7 +175,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"id": "f1500603-d85d-4e16-b697-e1bf16502991",
"metadata": {},
"outputs": [],
Expand All @@ -194,7 +194,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"id": "18010202",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -569,7 +569,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.12.5"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 21c958d

Please sign in to comment.