Define an experiment¶
This example shows how to define experimental parameters and load measured data in EasyDiffraction.
Import EasyDiffraction¶
In [2]:
Copied!
import easydiffraction as ed
import easydiffraction as ed
Define an experiment¶
pd-neut-cwl¶
Load from CIF¶
Download the data file from the EasyDiffraction repository on GitHub
In [3]:
Copied!
ed.download_from_repository('d1a.cif', destination='data')
ed.download_from_repository('d1a.cif', destination='data')
Show content of the downloaded file (first 45 lines)
In [4]:
Copied!
with open('data/d1a.cif') as f:
print(''.join(f.readlines()[:45]))
with open('data/d1a.cif') as f:
print(''.join(f.readlines()[:45]))
data_d1a _diffrn_radiation.probe neutron _diffrn_radiation_wavelength.wavelength 1.91 _pd_calib.2theta_offset -0.1406(1) _pd_instr.resolution_u 0.139 _pd_instr.resolution_v -0.4124 _pd_instr.resolution_w 0.386 _pd_instr.resolution_x 0 _pd_instr.resolution_y 0.0878 _pd_instr.reflex_asymmetry_p1 0 _pd_instr.reflex_asymmetry_p2 0 _pd_instr.reflex_asymmetry_p3 0 _pd_instr.reflex_asymmetry_p4 0 loop_ _pd_phase_block.id _pd_phase_block.scale pbso4 1.4597(21) loop_ _pd_background.line_segment_X _pd_background.line_segment_intensity _pd_background.X_coordinate 11 206.1624 2theta 15 194.75 2theta 20 194.505 2theta 30 188.4375 2theta 50 207.7633 2theta 70 201.7002 2theta 120 244.4525 2theta 153 226.0595 2theta loop_ _pd_meas.2theta_scan _pd_meas.intensity_total _pd_meas.intensity_total_su 10 220 14.8324 10.05 214 14.6287 10.1 219 14.7986 10.15 224 14.9666 10.2 198 14.0712
Load the data from the file and show the chart
In [5]:
Copied!
job = ed.Job(type='pd-neut-cwl')
job.add_experiment_from_file('data/d1a.cif')
job.show_experiment_chart()
job = ed.Job(type='pd-neut-cwl')
job.add_experiment_from_file('data/d1a.cif')
job.show_experiment_chart()
Load from XYE¶
Download the data file from the EasyDiffraction repository on GitHub
In [6]:
Copied!
ed.download_from_repository('hrpt.xye', destination='data')
ed.download_from_repository('hrpt.xye', destination='data')
Show content of the downloaded file (first 6 lines)
In [7]:
Copied!
with open('data/hrpt.xye') as f:
print(''.join(f.readlines()[:6]))
with open('data/hrpt.xye') as f:
print(''.join(f.readlines()[:6]))
# 2theta intensity su 10.00 167.00 12.60 10.05 157.00 12.50 10.10 187.00 13.30 10.15 197.00 14.00 10.20 164.00 12.50
Load the data from the file and show the chart
In [8]:
Copied!
job = ed.Job(type='pd-neut-cwl')
job.add_experiment_from_file('data/hrpt.xye')
job.show_experiment_chart()
job = ed.Job(type='pd-neut-cwl')
job.add_experiment_from_file('data/hrpt.xye')
job.show_experiment_chart()
In [9]:
Copied!
ed.download_from_repository('sepd.xye', destination='data')
ed.download_from_repository('sepd.xye', destination='data')
Show content of the downloaded file (first 5 lines)
In [10]:
Copied!
with open('data/sepd.xye') as f:
print(''.join(f.readlines()[:5]))
with open('data/sepd.xye') as f:
print(''.join(f.readlines()[:5]))
2000.0 213.8 3.3 2005.0 213.8 3.3 2010.0 210.1 3.3 2015.0 213.3 3.3 2020.0 211.9 3.3
Load the data from the file and show the chart
In [11]:
Copied!
job = ed.Job(type='pd-neut-tof')
job.add_experiment_from_file('data/sepd.xye')
job.show_experiment_chart(show_legend=False)
job = ed.Job(type='pd-neut-tof')
job.add_experiment_from_file('data/sepd.xye')
job.show_experiment_chart(show_legend=False)