Na₂Ca₃Al₂F₁₄ on WISH¶
Fit Na₂Ca₃Al₂F₁₄ to time-of-flight neutron powder data from WISH at ISIS, all five detector bank pairs at once. Each bank has its own calibration and profile; the structure is shared.
The project is the catalogue case pd-neut-tof_ncaf-wish, the one the command line and the
app's Examples open.
import easydiffraction as edi
Load the project¶
project_path = edi.download_data('pd-neut-tof_ncaf-wish', destination='data')
project = edi.Project.load(project_path)
structure = project.structures['ncaf']
wish_1_10 = project.experiments['wish_1_10']
wish_2_9 = project.experiments['wish_2_9']
wish_3_8 = project.experiments['wish_3_8']
wish_4_7 = project.experiments['wish_4_7']
wish_5_6 = project.experiments['wish_5_6']
Data 'pd-neut-tof_ncaf-wish' is at data/pd-neut-tof_ncaf-wish-806c3099eda1/pd-neut-tof_ncaf-wish
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('wish_1_10')
Perform the analysis¶
Five banks fit together. diffraction-lib's tutorial of this case fits two banks at once with everything free; this one has five, so it stages them.
Scales and time-of-flight calibration¶
Each bank's scale and DIFC offset and linear term put its peaks in place and at the right height.
wish_1_10.linked_structures['ncaf'].scale.free = True
wish_1_10.instrument.calib_d_to_tof_offset.free = True
wish_1_10.instrument.calib_d_to_tof_linear.free = True
wish_2_9.linked_structures['ncaf'].scale.free = True
wish_2_9.instrument.calib_d_to_tof_offset.free = True
wish_2_9.instrument.calib_d_to_tof_linear.free = True
wish_3_8.linked_structures['ncaf'].scale.free = True
wish_3_8.instrument.calib_d_to_tof_offset.free = True
wish_3_8.instrument.calib_d_to_tof_linear.free = True
wish_4_7.linked_structures['ncaf'].scale.free = True
wish_4_7.instrument.calib_d_to_tof_offset.free = True
wish_4_7.instrument.calib_d_to_tof_linear.free = True
wish_5_6.linked_structures['ncaf'].scale.free = True
wish_5_6.instrument.calib_d_to_tof_offset.free = True
wish_5_6.instrument.calib_d_to_tof_linear.free = True
project.display.parameters.free()
project.analysis.fit()
project.display.fit.results()
edi fit: joint project pd-neut-tof_ncaf-wish, 5 banks (wish_1_10, wish_2_9, wish_3_8, wish_4_7, wish_5_6), 18973 pts fitted / 20475 loaded, 15 free
iter time (s) Rwp (%) reduced χ² change
29.70 140.21
1 0.758 19.91 62.98 55.1% ↓
2 0.849 19.90 62.95
3 0.968 19.90 62.95
4 1.087 19.90 62.95
5 1.204 19.90 62.95
6 1.387 19.90 62.95
done · converged · 6 iters · reduced χ² 62.95 · Rwp 19.90 % · 1.51 s
project.display.pattern('wish_1_10')
project.display.pattern('wish_2_9')
project.display.pattern('wish_3_8')
project.display.pattern('wish_4_7')
project.display.pattern('wish_5_6')
Background¶
Each bank's background points; bank 1-10's first and last stay fixed, as its source has them.
for point in wish_1_10.background:
point.intensity.free = True
for point in wish_2_9.background:
point.intensity.free = True
for point in wish_3_8.background:
point.intensity.free = True
for point in wish_4_7.background:
point.intensity.free = True
for point in wish_5_6.background:
point.intensity.free = True
wish_1_10.background[0].intensity.free = False
wish_1_10.background[35].intensity.free = False
project.analysis.fit()
project.display.fit.results()
edi fit: joint project pd-neut-tof_ncaf-wish, 5 banks (wish_1_10, wish_2_9, wish_3_8, wish_4_7, wish_5_6), 18973 pts fitted / 20475 loaded, 149 free
iter time (s) Rwp (%) reduced χ² change
19.90 63.39
1 1.342 13.97 31.21 50.8% ↓
done · converged · 1 iters · reduced χ² 31.21 · Rwp 13.97 % · 1.55 s
project.display.pattern('wish_1_10')
project.display.pattern('wish_2_9')
project.display.pattern('wish_3_8')
project.display.pattern('wish_4_7')
project.display.pattern('wish_5_6')
Peak asymmetry¶
Each bank's back-to-back exponentials, the terms its data determine; bank 1-10 keeps its instrument values.
wish_2_9.peak.rise_alpha_0.free = True
wish_2_9.peak.rise_alpha_1.free = True
wish_2_9.peak.decay_beta_0.free = True
wish_2_9.peak.decay_beta_1.free = True
wish_3_8.peak.rise_alpha_0.free = True
wish_3_8.peak.rise_alpha_1.free = True
wish_3_8.peak.decay_beta_0.free = True
wish_3_8.peak.decay_beta_1.free = True
wish_4_7.peak.rise_alpha_0.free = True
wish_4_7.peak.rise_alpha_1.free = True
wish_4_7.peak.decay_beta_0.free = True
wish_4_7.peak.decay_beta_1.free = True
wish_5_6.peak.rise_alpha_0.free = True
wish_5_6.peak.rise_alpha_1.free = True
wish_5_6.peak.decay_beta_0.free = True
wish_5_6.peak.decay_beta_1.free = True
project.analysis.fit()
project.display.fit.results()
edi fit: joint project pd-neut-tof_ncaf-wish, 5 banks (wish_1_10, wish_2_9, wish_3_8, wish_4_7, wish_5_6), 18973 pts fitted / 20475 loaded, 165 free
iter time (s) Rwp (%) reduced χ² change
13.97 31.24
1 1.294 10.41 17.36 44.4% ↓
2 1.448 10.30 17.00 2.1% ↓
3 1.603 10.26 16.85 0.9% ↓
4 1.758 10.24 16.80 0.3% ↓
5 1.914 10.23 16.78 0.1% ↓
6 2.072 10.23 16.77
7 2.227 10.23 16.77
8 2.422 10.23 16.77
9 2.618 10.23 16.77
10 2.815 10.23 16.77
11 3.011 10.23 16.77
12 3.304 10.23 16.77
done · converged · 12 iters · reduced χ² 16.77 · Rwp 10.23 % · 3.55 s
project.display.pattern('wish_2_9')
Gaussian widths¶
The Gaussian width terms the banks' data determine.
wish_2_9.peak.broad_gauss_sigma_1.free = True
wish_2_9.peak.broad_gauss_sigma_2.free = True
wish_3_8.peak.broad_gauss_sigma_1.free = True
wish_3_8.peak.broad_gauss_sigma_2.free = True
wish_4_7.peak.broad_gauss_sigma_1.free = True
wish_4_7.peak.broad_gauss_sigma_2.free = True
wish_5_6.peak.broad_gauss_sigma_2.free = True
project.analysis.fit()
project.display.fit.results()
edi fit: joint project pd-neut-tof_ncaf-wish, 5 banks (wish_1_10, wish_2_9, wish_3_8, wish_4_7, wish_5_6), 18973 pts fitted / 20475 loaded, 172 free
iter time (s) Rwp (%) reduced χ² change
10.23 16.78
1 1.516 10.00 16.02 4.5% ↓
2 1.729 10.00 16.02
3 1.943 10.00 16.02
4 2.157 10.00 16.02
5 2.369 10.00 16.02
6 2.585 10.00 16.02
7 2.753 10.00 16.01
8 2.921 9.99 16.00 0.1% ↓
9 3.089 9.99 15.98 0.2% ↓
10 3.263 9.98 15.96 0.1% ↓
11 3.441 9.97 15.93 0.2% ↓
12 3.663 9.97 15.93
13 4.000 9.97 15.93
done · converged · 13 iters · reduced χ² 15.93 · Rwp 9.97 % · 4.28 s
project.display.pattern('wish_2_9')
Lorentzian width¶
Bank 2-9's Lorentzian term.
wish_2_9.peak.broad_lorentz_gamma_1.free = True
project.analysis.fit()
project.display.fit.results()
edi fit: joint project pd-neut-tof_ncaf-wish, 5 banks (wish_1_10, wish_2_9, wish_3_8, wish_4_7, wish_5_6), 18973 pts fitted / 20475 loaded, 173 free
iter time (s) Rwp (%) reduced χ² change
9.97 15.93
1 2.374 9.97 15.93
done · converged · 1 iters · reduced χ² 15.93 · Rwp 9.97 % · 2.79 s
project.display.pattern('wish_1_10')
project.display.pattern('wish_2_9')
project.display.pattern('wish_3_8')
project.display.pattern('wish_4_7')
project.display.pattern('wish_5_6')
Absorption¶
Banks 2-9 to 5-6 each fit their absorption.
wish_2_9.absorption.abscor1.free = True
wish_3_8.absorption.abscor1.free = True
wish_4_7.absorption.abscor1.free = True
wish_5_6.absorption.abscor1.free = True
project.analysis.fit()
project.display.fit.results()
edi fit: joint project pd-neut-tof_ncaf-wish, 5 banks (wish_1_10, wish_2_9, wish_3_8, wish_4_7, wish_5_6), 18973 pts fitted / 20475 loaded, 177 free
iter time (s) Rwp (%) reduced χ² change
9.97 15.94
1 2.017 9.91 15.74 1.2% ↓
2 2.244 9.91 15.74
3 2.579 9.91 15.74
done · converged · 3 iters · reduced χ² 15.74 · Rwp 9.91 % · 2.87 s
project.display.pattern('wish_1_10')
project.display.pattern('wish_2_9')
project.display.pattern('wish_3_8')
project.display.pattern('wish_4_7')
project.display.pattern('wish_5_6')
Atom positions¶
The coordinates the cubic symmetry leaves free.
for site in structure.atom_sites:
for coordinate in (site.fract_x, site.fract_y, site.fract_z):
coordinate.free = not coordinate.symmetry_constrained
project.analysis.fit()
project.display.fit.results()
edi fit: joint project pd-neut-tof_ncaf-wish, 5 banks (wish_1_10, wish_2_9, wish_3_8, wish_4_7, wish_5_6), 18973 pts fitted / 20475 loaded, 187 free
iter time (s) Rwp (%) reduced χ² change
9.91 15.75
1 2.112 8.07 10.43 33.8% ↓
2 2.360 8.07 10.43
3 2.706 8.07 10.43
done · converged · 3 iters · reduced χ² 10.43 · Rwp 8.07 % · 3.08 s
project.display.pattern('wish_1_10')
project.display.pattern('wish_2_9')
project.display.pattern('wish_3_8')
project.display.pattern('wish_4_7')
project.display.pattern('wish_5_6')
Displacements¶
for site in structure.atom_sites:
site.adp_iso.free = True
project.analysis.fit()
project.display.fit.results()
edi fit: joint project pd-neut-tof_ncaf-wish, 5 banks (wish_1_10, wish_2_9, wish_3_8, wish_4_7, wish_5_6), 18973 pts fitted / 20475 loaded, 193 free
iter time (s) Rwp (%) reduced χ² change
8.07 10.43
1 13.240 7.69 9.50 9.0% ↓
2 14.113 7.69 9.50
done · converged · 2 iters · reduced χ² 9.50 · Rwp 7.69 % · 14.87 s
project.display.pattern('wish_1_10')
project.display.pattern('wish_2_9')
project.display.pattern('wish_3_8')
project.display.pattern('wish_4_7')
project.display.pattern('wish_5_6')
project.display.fit.correlations()
project.display.structure('ncaf')
Save the project¶
project.save_as('pd-neut-tof_ncaf-wish')
project.report.save_html('pd-neut-tof_ncaf-wish.html')
Saving project to 'pd-neut-tof_ncaf-wish'
Saving report to 'pd-neut-tof_ncaf-wish.html'