Ferrite and austenite on BEER¶
Calibrate the BEER instrument at ESS with two McStas-simulated banks of a ferrite and austenite duplex steel, fitted together: each bank has its own zero and resolution.
The project is the catalogue case pd-neut-tof_ferrite-austenite-beer, the one the command line
and the app's Examples open. Austenite's displacement follows ferrite's, and each phase's scale
in bank n2 follows bank s2, from the start.
Fitting
Joint pd neut tof Bragg
Crystal structure
import easydiffraction as edi
Load the project¶
project_path = edi.download_data('pd-neut-tof_ferrite-austenite-beer', destination='data')
project = edi.Project.load(project_path)
ferrite = project.structures['ferrite']
austenite = project.structures['austenite']
bank_s2 = project.experiments['expt_s2']
bank_n2 = project.experiments['expt_n2']
project.display.constraints()
Data 'pd-neut-tof_ferrite-austenite-beer' is at data/pd-neut-tof_ferrite-austenite-beer-eccc89de8995/pd-neut-tof_ferrite-austenite-beer
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('expt_s2')
Perform the analysis¶
The cells stay fixed: this is a calibration, and the two phases are the standards.
Scales and time-of-flight calibration¶
Both phases' scales and each bank's DIFC offset put the peaks in place and at the right height.
bank_s2.linked_structures['ferrite'].scale.free = True
bank_s2.linked_structures['austenite'].scale.free = True
bank_s2.instrument.calib_d_to_tof_offset.free = True
bank_n2.instrument.calib_d_to_tof_offset.free = True
project.display.parameters.free()
project.analysis.fit()
project.display.fit.results()
edi fit: joint project pd-neut-tof_ferrite-austenite-beer, 2 banks (expt_n2, expt_s2), 5642 pts fitted / 5998 loaded, 4 free
iter time (s) Rwp (%) reduced χ² change
41.43 229.76
1 0.002 23.98 76.97 66.5% ↓
2 0.005 23.84 76.05 1.2% ↓
3 0.007 23.83 76.04
4 0.009 23.83 76.04
done · converged · 4 iters · reduced χ² 76.04 · Rwp 23.83 % · 0.01 s
project.display.pattern('expt_s2')
project.display.pattern('expt_n2')
Background¶
Each bank's background points; the last, past the end of the data, stays fixed.
for point in bank_s2.background:
point.intensity.free = True
for point in bank_n2.background:
point.intensity.free = True
bank_s2.background[30].intensity.free = False
bank_n2.background[30].intensity.free = False
project.analysis.fit()
project.display.fit.results()
edi fit: joint project pd-neut-tof_ferrite-austenite-beer, 2 banks (expt_n2, expt_s2), 5642 pts fitted / 5998 loaded, 64 free
iter time (s) Rwp (%) reduced χ² change
23.83 76.86
1 0.061 18.05 44.10 42.6% ↓
2 0.123 18.05 44.10
done · converged · 2 iters · reduced χ² 44.10 · Rwp 18.05 % · 0.14 s
project.display.pattern('expt_s2')
project.display.pattern('expt_n2')
Peak widths¶
Each bank's widths.
bank_s2.peak.broad_gauss_sigma_0.free = True
bank_s2.peak.broad_gauss_sigma_1.free = True
bank_s2.peak.broad_gauss_sigma_2.free = True
bank_s2.peak.broad_lorentz_gamma_0.free = True
bank_n2.peak.broad_gauss_sigma_0.free = True
bank_n2.peak.broad_gauss_sigma_1.free = True
bank_n2.peak.broad_gauss_sigma_2.free = True
bank_n2.peak.broad_lorentz_gamma_0.free = True
project.analysis.fit()
project.display.fit.results()
edi fit: joint project pd-neut-tof_ferrite-austenite-beer, 2 banks (expt_n2, expt_s2), 5642 pts fitted / 5998 loaded, 72 free
iter time (s) Rwp (%) reduced χ² change
18.05 44.16
1 0.059 16.39 36.39 17.6% ↓
2 0.069 16.38 36.35 0.1% ↓
3 0.127 16.38 36.35
done · converged · 3 iters · reduced χ² 36.35 · Rwp 16.38 % · 0.15 s
project.display.pattern('expt_s2')
project.display.pattern('expt_n2')
Displacement¶
Last, ferrite's displacement; austenite's follows it.
ferrite.atom_sites['Fe'].adp_iso.free = True
project.analysis.fit()
project.display.fit.results()
edi fit: joint project pd-neut-tof_ferrite-austenite-beer, 2 banks (expt_n2, expt_s2), 5642 pts fitted / 5998 loaded, 73 free
iter time (s) Rwp (%) reduced χ² change
16.38 36.36
1 0.055 7.73 8.10 77.7% ↓
2 0.065 7.14 6.91 14.7% ↓
3 0.076 7.13 6.89 0.3% ↓
4 0.087 7.13 6.89
5 0.142 7.13 6.89
done · converged · 5 iters · reduced χ² 6.89 · Rwp 7.13 % · 0.16 s
project.display.pattern('expt_s2')
project.display.pattern('expt_n2')
project.display.fit.correlations()
project.display.structure('ferrite')
project.display.structure('austenite')
Save the project¶
project.save_as('pd-neut-tof_ferrite-austenite-beer')
project.report.save_html('pd-neut-tof_ferrite-austenite-beer.html')
Saving project to 'pd-neut-tof_ferrite-austenite-beer'
Saving report to 'pd-neut-tof_ferrite-austenite-beer.html'