Skip to content
Open
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
43 changes: 15 additions & 28 deletions docs/docs/tutorials/tutorial1_brownian.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@
"id": "927b8fb5",
"metadata": {},
"source": [
"We also create a new instrument_model and attach it to our analysis. We want to use the resolutin that we determined from the vanadium data. Ideally, we'd just attach it to the instrument model like before. However, this is currently not possible due to a small issue in EasyDynamics that will be fixed asap. For now, we need to hack it a bit."
"We also create a new instrument_model and attach it to our analysis, giving it the resolution model determined in the vanadium analysis. "
]
},
{
Expand All @@ -378,20 +378,15 @@
"source": [
"instrument_model = InstrumentModel(\n",
" background_model=background_model,\n",
" resolution_model=vanadium_analysis.instrument_model.resolution_model,\n",
")\n",
"instrument_model.resolution_model.fix_all_parameters()\n",
"\n",
"diffusion_analysis = Analysis(\n",
" display_name='Diffusion Analysis',\n",
" experiment=diffusion_experiment,\n",
" sample_model=sample_model,\n",
" instrument_model=instrument_model,\n",
")\n",
"\n",
"# We need to hack in the resolution model from the vanadium analysis,\n",
"# since the setters and getters overwrite the model. This will be fixed\n",
"# asap.\n",
"diffusion_analysis.instrument_model._resolution_model = (\n",
" vanadium_analysis.instrument_model.resolution_model\n",
")"
]
},
Expand All @@ -403,17 +398,6 @@
"We don't want to fit our resolution anymore, so we fix all the parameters in it."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "18e2f0bf",
"metadata": {},
"outputs": [],
"source": [
"# We fix all parameters of the resolution model.\n",
"diffusion_analysis.instrument_model.resolution_model.fix_all_parameters()"
]
},
{
"cell_type": "markdown",
"id": "e366a05d",
Expand Down Expand Up @@ -506,10 +490,19 @@
" diffusion_models=diffusion_model,\n",
")\n",
"\n",
"background_model = BackgroundModel(components=Polynomial(coefficients=[0.001]))\n",
"\n",
"background_model = BackgroundModel(components=Polynomial(coefficients=[0.001]))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "48370156",
"metadata": {},
"outputs": [],
"source": [
"instrument_model = InstrumentModel(\n",
" background_model=background_model,\n",
" resolution_model=vanadium_analysis.instrument_model.resolution_model,\n",
")"
]
},
Expand All @@ -518,7 +511,7 @@
"id": "8bb4abe9",
"metadata": {},
"source": [
"We attach all our models to a new `Analysis` object, again being mindful that we need to hack in the resolution. I promise this will be fixed soon!"
"We attach all our models to a new `Analysis` object."
]
},
{
Expand All @@ -535,12 +528,6 @@
" instrument_model=instrument_model,\n",
")\n",
"\n",
"# We again need to hack in the resolution model from the vanadium\n",
"# analysis, since the setters and getters overwrite the model. This will\n",
"# be fixed asap.\n",
"diffusion_model_analysis.instrument_model._resolution_model = (\n",
" vanadium_analysis.instrument_model.resolution_model\n",
")\n",
"diffusion_model_analysis.instrument_model.resolution_model.fix_all_parameters()"
]
},
Expand Down
21 changes: 12 additions & 9 deletions docs/docs/tutorials/tutorial2_nanoparticles.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -275,14 +275,16 @@
"background_model.components = polynomial\n",
"\n",
"\n",
"instrument_model = InstrumentModel(background_model=background_model)\n",
"instrument_model = InstrumentModel(\n",
" background_model=background_model,\n",
" resolution_model=res_analysis.instrument_model.resolution_model,\n",
")\n",
"instrument_model.resolution_model.fix_all_parameters()\n",
"\n",
"\n",
"analysis = Analysis(\n",
" experiment=experiment, sample_model=sample_model, instrument_model=instrument_model\n",
")\n",
"analysis.instrument_model._resolution_model = res_analysis.instrument_model.resolution_model\n",
"analysis.instrument_model.resolution_model.fix_all_parameters()\n",
"\n",
"analysis.plot_data_and_model(logy=True)"
]
Expand Down Expand Up @@ -410,15 +412,16 @@
"polynomial = Polynomial(coefficients=[0.15])\n",
"background_model.components = polynomial\n",
"\n",
"instrument_model = InstrumentModel(background_model=background_model)\n",
"\n",
"instrument_model = InstrumentModel(\n",
" background_model=background_model,\n",
" resolution_model=res_analysis.instrument_model.resolution_model,\n",
")\n",
"instrument_model.resolution_model.fix_all_parameters()\n",
"\n",
"# Create the analysis object\n",
"mag_analysis = Analysis(\n",
" experiment=experiment, sample_model=mag_sample_model, instrument_model=instrument_model\n",
")\n",
"mag_analysis.instrument_model._resolution_model = res_analysis.instrument_model.resolution_model\n",
"mag_analysis.instrument_model.resolution_model.fix_all_parameters()"
")"
]
},
{
Expand Down Expand Up @@ -614,7 +617,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.12"
"version": "3.12.13"
}
},
"nbformat": 4,
Expand Down
Loading
Loading