2323 " # Imports\n " ,
2424 " import pooch\n " ,
2525 " \n " ,
26- " from easydynamics.analysis.analysis import Analysis\n " ,
27- " from easydynamics.experiment import Experiment\n " ,
28- " from easydynamics.sample_model import BrownianTranslationalDiffusion\n " ,
29- " from easydynamics.sample_model import ComponentCollection\n " ,
30- " from easydynamics.sample_model import DeltaFunction\n " ,
31- " from easydynamics.sample_model import Gaussian\n " ,
32- " from easydynamics.sample_model import Lorentzian\n " ,
33- " from easydynamics.sample_model import Polynomial\n " ,
34- " from easydynamics.sample_model.background_model import BackgroundModel\n " ,
35- " from easydynamics.sample_model.instrument_model import InstrumentModel\n " ,
36- " from easydynamics.sample_model.resolution_model import ResolutionModel\n " ,
37- " from easydynamics.sample_model.sample_model import SampleModel\n " ,
26+ " import easydynamics as edyn\n " ,
27+ " import easydynamics.sample_model as sm\n " ,
3828 " \n " ,
3929 " %matplotlib widget"
4030 ]
4737 "outputs" : [],
4838 "source" : [
4939 " # Load the vanadium data\n " ,
50- " vanadium_experiment = Experiment('Vanadium')\n " ,
40+ " vanadium_experiment = edyn. Experiment('Vanadium')\n " ,
5141 " file_path = pooch.retrieve(\n " ,
5242 " url='https://github.com/easyscience/dynamics-lib/raw/refs/heads/master/docs/docs/tutorials/data/vanadium_data_example.h5',\n " ,
5343 " known_hash='16cc1b327c303feeb88fb9dda5390dc4880b62396b1793f98c6fef0b27c7b873',\n " ,
6656 " # Example of Analysis with a simple sample model and instrument model\n " ,
6757 " # The scattering from vanadium is purely elastic, so we model it with a\n " ,
6858 " # delta function\n " ,
69- " delta_function = DeltaFunction(display_name='DeltaFunction', area=1)\n " ,
70- " sample_model = SampleModel(\n " ,
59+ " delta_function = sm. DeltaFunction(display_name='DeltaFunction', area=1)\n " ,
60+ " sample_model = sm. SampleModel(\n " ,
7161 " components=delta_function,\n " ,
7262 " )\n " ,
7363 " \n " ,
7464 " # The resolution is in this case modeled as a Gaussian. However, we can\n " ,
7565 " # add as many components as we like to the resolution model\n " ,
76- " res_gauss = Gaussian(width=0.1)\n " ,
66+ " res_gauss = sm. Gaussian(width=0.1)\n " ,
7767 " res_gauss.area.fixed = True\n " ,
78- " resolution_components = ComponentCollection()\n " ,
68+ " resolution_components = sm. ComponentCollection()\n " ,
7969 " resolution_components.append_component(res_gauss)\n " ,
80- " resolution_model = ResolutionModel(components=resolution_components)\n " ,
70+ " resolution_model = sm. ResolutionModel(components=resolution_components)\n " ,
8171 " \n " ,
8272 " # The background model is created in the same way. In this case, we use\n " ,
8373 " # a flat background\n " ,
84- " background_model = BackgroundModel(components=Polynomial(coefficients=[0.001]))\n " ,
74+ " background_model = sm. BackgroundModel(components=sm. Polynomial(coefficients=[0.001]))\n " ,
8575 " \n " ,
8676 " # We combine the resolution abd background model into an instrument\n " ,
8777 " # model. This model also contains a small energy offset to account for\n " ,
8878 " # instrument misalignment.\n " ,
8979 " \n " ,
90- " instrument_model = InstrumentModel(\n " ,
80+ " instrument_model = sm. InstrumentModel(\n " ,
9181 " resolution_model=resolution_model,\n " ,
9282 " background_model=background_model,\n " ,
9383 " )\n " ,
9484 " \n " ,
9585 " # Collect everything into an analysis object.\n " ,
96- " vanadium_analysis = Analysis(\n " ,
86+ " vanadium_analysis = edyn. Analysis(\n " ,
9787 " display_name='Vanadium Full Analysis',\n " ,
9888 " experiment=vanadium_experiment,\n " ,
9989 " sample_model=sample_model,\n " ,
180170 "source" : [
181171 " # Now it's time to look at the data we want to fit. We first load the\n " ,
182172 " # data\n " ,
183- " diffusion_experiment = Experiment('Diffusion')\n " ,
173+ " diffusion_experiment = edyn. Experiment('Diffusion')\n " ,
184174 " \n " ,
185175 " file_path = pooch.retrieve(\n " ,
186176 " url='https://github.com/easyscience/dynamics-lib/raw/refs/heads/master/docs/docs/tutorials/data/diffusion_data_example.h5',\n " ,
200190 " # Now we set up the model, similarly to how we set up the model for the\n " ,
201191 " # vanadium data.\n " ,
202192 " \n " ,
203- " delta_function = DeltaFunction(display_name='DeltaFunction', area=0.2)\n " ,
204- " lorentzian = Lorentzian(display_name='Lorentzian', area=0.5, width=0.3)\n " ,
205- " component_collection = ComponentCollection(\n " ,
193+ " delta_function = sm. DeltaFunction(display_name='DeltaFunction', area=0.2)\n " ,
194+ " lorentzian = sm. Lorentzian(display_name='Lorentzian', area=0.5, width=0.3)\n " ,
195+ " component_collection = sm. ComponentCollection(\n " ,
206196 " components=[delta_function, lorentzian],\n " ,
207197 " )\n " ,
208198 " \n " ,
209- " sample_model = SampleModel(\n " ,
199+ " sample_model = sm. SampleModel(\n " ,
210200 " components=component_collection,\n " ,
211201 " )\n " ,
212202 " \n " ,
213- " background_model = BackgroundModel(components=Polynomial(coefficients=[0.001]))\n " ,
203+ " background_model = sm. BackgroundModel(components=sm. Polynomial(coefficients=[0.001]))\n " ,
214204 " \n " ,
215- " instrument_model = InstrumentModel(\n " ,
205+ " instrument_model = sm. InstrumentModel(\n " ,
216206 " background_model=background_model,\n " ,
217207 " )\n " ,
218208 " \n " ,
219- " diffusion_analysis = Analysis(\n " ,
209+ " diffusion_analysis = edyn. Analysis(\n " ,
220210 " display_name='Diffusion Full Analysis',\n " ,
221211 " experiment=diffusion_experiment,\n " ,
222212 " sample_model=sample_model,\n " ,
286276 " # Let us now fit directly to a diffusion model. We replace the\n " ,
287277 " # Lorentzian with a Brownian translational diffusion model and keep the\n " ,
288278 " # other parameters the same.\n " ,
289- " delta_function = DeltaFunction(display_name='DeltaFunction', area=0.2)\n " ,
290- " component_collection = ComponentCollection(\n " ,
279+ " delta_function = sm. DeltaFunction(display_name='DeltaFunction', area=0.2)\n " ,
280+ " component_collection = sm. ComponentCollection(\n " ,
291281 " components=[delta_function],\n " ,
292282 " )\n " ,
293- " diffusion_model = BrownianTranslationalDiffusion(\n " ,
283+ " diffusion_model = sm. BrownianTranslationalDiffusion(\n " ,
294284 " display_name='Brownian Translational Diffusion', diffusion_coefficient=2.4e-9, scale=0.5\n " ,
295285 " )\n " ,
296286 " \n " ,
297- " sample_model = SampleModel(\n " ,
287+ " sample_model = sm. SampleModel(\n " ,
298288 " components=component_collection,\n " ,
299289 " diffusion_models=diffusion_model,\n " ,
300290 " )\n " ,
301291 " \n " ,
302- " background_model = BackgroundModel(components=Polynomial(coefficients=[0.001]))\n " ,
292+ " background_model = sm. BackgroundModel(components=sm. Polynomial(coefficients=[0.001]))\n " ,
303293 " \n " ,
304- " instrument_model = InstrumentModel(\n " ,
294+ " instrument_model = sm. InstrumentModel(\n " ,
305295 " background_model=background_model,\n " ,
306296 " )\n " ,
307297 " \n " ,
308- " diffusion_model_analysis = Analysis(\n " ,
298+ " diffusion_model_analysis = edyn. Analysis(\n " ,
309299 " display_name='Diffusion Full Analysis',\n " ,
310300 " experiment=diffusion_experiment,\n " ,
311301 " sample_model=sample_model,\n " ,
367357 },
368358 "nbformat" : 4 ,
369359 "nbformat_minor" : 5
370- }
360+ }
0 commit comments