CeO₂ on PEARL¶
Fit the CeO₂ standard to time-of-flight neutron powder data from PEARL at ISIS: the calibration and the profile, with a polynomial background.
The project is the catalogue case pd-neut-tof_ceo2-pearl, the one the command line and the
app's Examples open.
Fitting
Single pd neut tof Bragg
Crystal structure
import easydiffraction as edi
Load the project¶
project_path = edi.download_data('pd-neut-tof_ceo2-pearl', destination='data')
project = edi.Project.load(project_path)
structure = project.structures['ceo2']
experiment = project.experiments['pearl']
Data 'pd-neut-tof_ceo2-pearl' is at data/pd-neut-tof_ceo2-pearl-d212831a55d0/pd-neut-tof_ceo2-pearl
The project marks what its fit frees. The fit below frees it in stages, so start with all of it fixed.
for parameter in project.free_parameters:
parameter.free = False
project.display.pattern('pearl')
Perform the analysis¶
The fit goes in stages, freeing one group of parameters at a time.
Scale and time-of-flight calibration¶
CeO₂ is the calibration standard, so its cell stays fixed and the DIFC terms put the peaks in place.
experiment.linked_structures['ceo2'].scale.free = True
experiment.instrument.calib_d_to_tof_offset.free = True
experiment.instrument.calib_d_to_tof_linear.free = True
experiment.instrument.calib_d_to_tof_quadratic.free = True
project.display.parameters.free()
project.analysis.fit()
project.display.fit.results()
edi fit: project pd-neut-tof_ceo2-pearl, 2237 pts fitted / 2524 loaded, 4 free
iter time (s) Rwp (%) reduced χ² change
14.21 27.74
1 0.008 13.04 23.36 15.8% ↓
2 0.015 13.03 23.34 0.1% ↓
3 0.024 13.03 23.34
4 0.037 13.03 23.34
done · converged · 4 iters · reduced χ² 23.34 · Rwp 13.03 % · 0.05 s
project.display.pattern('pearl')
Background¶
The six polynomial terms follow the level between the peaks.
for term in experiment.background_terms:
term.coef.free = True
project.analysis.fit()
project.display.fit.results()
edi fit: project pd-neut-tof_ceo2-pearl, 2237 pts fitted / 2524 loaded, 10 free
iter time (s) Rwp (%) reduced χ² change
13.03 23.41
1 0.016 6.73 6.24 73.4% ↓
2 0.026 6.73 6.24
3 0.041 6.73 6.24
done · converged · 3 iters · reduced χ² 6.24 · Rwp 6.73 % · 0.05 s
project.display.pattern('pearl')
Gaussian widths¶
The Gaussian terms that grow with d spacing.
experiment.peak.broad_gauss_sigma_1.free = True
experiment.peak.broad_gauss_sigma_2.free = True
project.analysis.fit()
project.display.fit.results()
edi fit: project pd-neut-tof_ceo2-pearl, 2237 pts fitted / 2524 loaded, 12 free
iter time (s) Rwp (%) reduced χ² change
6.73 6.24
1 0.014 6.28 5.44 12.9% ↓
2 0.020 6.27 5.43 0.1% ↓
3 0.036 6.27 5.43
done · converged · 3 iters · reduced χ² 5.43 · Rwp 6.27 % · 0.05 s
project.display.pattern('pearl')
Lorentzian width¶
The Lorentzian term that grows with d spacing.
experiment.peak.broad_lorentz_gamma_1.free = True
project.analysis.fit()
project.display.fit.results()
edi fit: project pd-neut-tof_ceo2-pearl, 2237 pts fitted / 2524 loaded, 13 free
iter time (s) Rwp (%) reduced χ² change
6.27 5.43
1 0.017 6.19 5.30 2.5% ↓
2 0.028 6.19 5.30
3 0.043 6.19 5.30
done · converged · 3 iters · reduced χ² 5.30 · Rwp 6.19 % · 0.05 s
project.display.pattern('pearl')
Rise and decay¶
The back-to-back exponentials that shape each time-of-flight peak.
experiment.peak.rise_alpha_1.free = True
experiment.peak.decay_beta_0.free = True
experiment.peak.decay_beta_1.free = True
project.analysis.fit()
project.display.fit.results()
edi fit: project pd-neut-tof_ceo2-pearl, 2237 pts fitted / 2524 loaded, 16 free
iter time (s) Rwp (%) reduced χ² change
6.19 5.30
1 0.018 6.02 5.01 5.4% ↓
2 0.028 5.67 4.45 11.3% ↓
3 0.037 5.67 4.44 0.3% ↓
4 0.052 5.67 4.44
done · converged · 4 iters · reduced χ² 4.44 · Rwp 5.67 % · 0.06 s
project.display.pattern('pearl')
Displacements¶
structure.atom_sites['Ce'].adp_iso.free = True
structure.atom_sites['O'].adp_iso.free = True
project.analysis.fit()
project.display.fit.results()
edi fit: project pd-neut-tof_ceo2-pearl, 2237 pts fitted / 2524 loaded, 18 free
iter time (s) Rwp (%) reduced χ² change
5.67 4.44
1 0.015 5.30 3.88 12.5% ↓
2 0.022 5.29 3.88 0.2% ↓
3 0.032 5.29 3.88
4 0.047 5.29 3.88
done · converged · 4 iters · reduced χ² 3.88 · Rwp 5.29 % · 0.06 s
project.display.pattern('pearl')
Absorption¶
Absorption weakens the intensities with time of flight, as the displacements do, so it comes after them, on its own.
experiment.absorption.abscor1.free = True
project.analysis.fit()
project.display.fit.results()
edi fit: project pd-neut-tof_ceo2-pearl, 2237 pts fitted / 2524 loaded, 19 free
iter time (s) Rwp (%) reduced χ² change
5.29 3.88
1 0.018 5.29 3.88
2 0.032 5.29 3.88
done · converged · 2 iters · reduced χ² 3.88 · Rwp 5.29 % · 0.04 s
project.display.pattern('pearl')
project.display.fit.correlations()
project.display.structure('ceo2')
Save the project¶
project.save_as('pd-neut-tof_ceo2-pearl')
project.report.save_html('pd-neut-tof_ceo2-pearl.html')
Saving project to 'pd-neut-tof_ceo2-pearl'
Saving report to 'pd-neut-tof_ceo2-pearl.html'