La₀.₅Ba₀.₅CoO₃ and Si on a McStas instrument¶
Fit two phases, La₀.₅Ba₀.₅CoO₃ and silicon, to a time-of-flight pattern simulated with McStas.
The project is the catalogue case pd-neut-tof_lbco-si-mcstas, 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_lbco-si-mcstas', destination='data')
project = edi.Project.load(project_path)
lbco = project.structures['lbco']
si = project.structures['si']
experiment = project.experiments['mcstas']
Data 'pd-neut-tof_lbco-si-mcstas' is at data/pd-neut-tof_lbco-si-mcstas-301812138a70/pd-neut-tof_lbco-si-mcstas
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('mcstas')
Perform the analysis¶
The fit goes in stages, freeing one group of parameters at a time.
Scales and cells¶
Both phases' scales and cells put the peaks in place and at the right height; the DIFC stays fixed, as in diffraction-lib's tutorial.
experiment.linked_structures['lbco'].scale.free = True
experiment.linked_structures['si'].scale.free = True
lbco.cell.length_a.free = True
si.cell.length_a.free = True
project.display.parameters.free()
project.analysis.fit()
project.display.fit.results()
edi fit: project pd-neut-tof_lbco-si-mcstas, 633 pts fitted / 1000 loaded, 4 free
iter time (s) Rwp (%) reduced χ² change
50.18 398.16
1 0.088 26.80 113.57 71.5% ↓
2 0.180 23.13 84.56 25.5% ↓
3 0.272 23.12 84.52
4 0.362 23.12 84.52
done · converged · 4 iters · reduced χ² 84.52 · Rwp 23.12 % · 0.41 s
project.display.pattern('mcstas')
Background¶
for point in experiment.background:
point.intensity.free = True
project.analysis.fit()
project.display.fit.results()
edi fit: project pd-neut-tof_lbco-si-mcstas, 633 pts fitted / 1000 loaded, 17 free
iter time (s) Rwp (%) reduced χ² change
23.12 86.31
1 0.105 21.09 71.82 16.8% ↓
2 0.201 21.09 71.82
3 0.317 21.09 71.82
done · converged · 3 iters · reduced χ² 71.82 · Rwp 21.09 % · 0.37 s
project.display.pattern('mcstas')
Peak widths¶
experiment.peak.broad_gauss_sigma_0.free = True
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_lbco-si-mcstas, 633 pts fitted / 1000 loaded, 20 free
iter time (s) Rwp (%) reduced χ² change
21.09 72.17
1 0.109 21.05 71.92 0.4% ↓
2 0.194 21.05 71.87 0.1% ↓
3 0.281 21.04 71.81 0.1% ↓
4 0.369 21.03 71.75 0.1% ↓
5 0.453 21.02 71.69 0.1% ↓
6 0.541 21.01 71.62 0.1% ↓
7 0.626 20.99 71.51 0.2% ↓
8 0.710 20.97 71.33 0.3% ↓
9 0.794 20.93 71.09 0.3% ↓
10 0.881 20.90 70.86 0.3% ↓
11 0.965 20.88 70.75 0.2% ↓
12 1.053 20.88 70.73
13 1.164 20.88 70.73
done · converged · 13 iters · reduced χ² 70.73 · Rwp 20.88 % · 1.21 s
project.display.pattern('mcstas')
Rise and decay¶
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_lbco-si-mcstas, 633 pts fitted / 1000 loaded, 23 free
iter time (s) Rwp (%) reduced χ² change
20.88 71.07
1 0.025 20.86 70.93 0.2% ↓
2 0.039 20.86 70.93
3 0.051 20.86 70.92
4 0.063 20.86 70.92
5 0.088 20.86 70.92
done · converged · 5 iters · reduced χ² 70.92 · Rwp 20.86 % · 0.10 s
project.display.pattern('mcstas')
Displacements¶
Co's and O's; La's, Ba's and Si's stay fixed, as the case's project keeps them.
lbco.atom_sites['Co'].adp_iso.free = True
lbco.atom_sites['O'].adp_iso.free = True
project.analysis.fit()
project.display.fit.results()
edi fit: project pd-neut-tof_lbco-si-mcstas, 633 pts fitted / 1000 loaded, 25 free
iter time (s) Rwp (%) reduced χ² change
20.86 71.15
1 0.025 7.47 9.13 87.2% ↓
2 0.039 6.22 6.33 30.7% ↓
3 0.053 5.98 5.85 7.7% ↓
4 0.066 5.73 5.36 8.3% ↓
5 0.078 5.53 5.00 6.8% ↓
6 0.091 5.43 4.83 3.4% ↓
7 0.105 5.38 4.73 2.0% ↓
8 0.117 5.31 4.61 2.6% ↓
9 0.131 5.22 4.45 3.4% ↓
10 0.144 5.13 4.30 3.4% ↓
11 0.158 5.07 4.20 2.2% ↓
12 0.172 5.05 4.17 0.9% ↓
13 0.186 5.04 4.16 0.2% ↓
14 0.199 5.04 4.16
15 0.229 5.04 4.16
done · converged · 15 iters · reduced χ² 4.16 · Rwp 5.04 % · 0.24 s
project.display.pattern('mcstas')
project.display.fit.correlations()
project.display.structure('lbco')
project.display.structure('si')
Save the project¶
project.save_as('pd-neut-tof_lbco-si-mcstas')
project.report.save_html('pd-neut-tof_lbco-si-mcstas.html')
Saving project to 'pd-neut-tof_lbco-si-mcstas'
Saving report to 'pd-neut-tof_lbco-si-mcstas.html'