Skip to content

Project

The Project serves as a container for all data and metadata associated with a particular data analysis task. It acts as the top-level entity in EasyDiffraction, ensuring structured organization and easy access to relevant information. Each project can contain multiple experimental datasets, with each dataset containing contribution from multiple sample models.

EasyDiffraction allows you to:

  • Manually create a new project by specifying its metadata.
  • Load an existing project from a file (CIF format).

Below are instructions on how to set up a project in EasyDiffraction. It is assumed that you have already imported the easydiffraction package, as described in the First Steps section.

Creating a Project Manually

You can manually create a new project and specify its short name, title and description. All these parameters are optional.

# Create a new project
project = ed.Project(name='lbco_hrpt')

# Define project info
project.info.title = 'La0.5Ba0.5CoO3 from neutron diffraction at HRPT@PSI'
project.info.description = '''This project demonstrates a standard refinement
of La0.5Ba0.5CoO3, which crystallizes in a perovskite-type structure, using
neutron powder diffraction data collected in constant wavelength mode at the
HRPT diffractometer (PSI).'''

Saving a Project

Saving the initial project requires specifying the directory path:

project.save_as(dir_path='lbco_hrpt')

If working in the interactive mode in a Jupyter notebook or similar environment, you can also save the project after every significant change. This is useful for keeping track of changes and ensuring that your work is not lost. If you already saved the project with save_as, you can just call the save:

project.save()

Loading a Project from CIF

If you have an existing project, you can load it directly from a CIF file. This is useful for reusing previously defined projects or sharing them with others.

project.load('data/lbco_hrpt.cif')

Project Structure

The example below illustrates a typical project structure for a constant-wavelength powder neutron diffraction experiment:

📁 La0.5Ba0.5CoO3     - Project directory.
├── 📄 project.cif    - Main project description file.
├── 📁 sample_models  - Folder with sample models (crystallographic structures).
│   ├── 📄 lbco.cif   - File with La0.5Ba0.5CoO3 structure parameters.
│   └── ...
├── 📁 experiments    - Folder with instrumental parameters and measured data.
│   ├── 📄 hrpt.cif   - Instrumental parameters and measured data from HRPT@PSI.
│   └── ...
├── 📄 analysis.cif   - Settings for data analysis (calculator, minimizer, etc.).
└── 📁 summary
    └── 📄 report.cif - Summary report after structure refinement.

Project Files

Below is a complete project example stored in the La0.5Ba0.5CoO3 directory, showing the contents of all files in the project.

Important

If you save the project right after creating it, the project directory will only contain the project.cif file. The other folders and files will be created as you add sample models, experiments, and set up the analysis. The summary folder will be created after the analysis is completed.

1. project.cif

This file provides an overview of the project, including file names of the sample models and experiments associated with the project.

data_La0.5Ba0.5CoO3

_project.title       "La0.5Ba0.5CoO3 from neutron diffraction at HRPT@PSI"
_project.description "neutrons, powder, constant wavelength, HRPT@PSI"

loop_
_sample_model.cif_file_name
lbco.cif

loop_
_experiment.cif_file_name
hrpt.cif

2. sample_models / lbco.cif

This file contains crystallographic information associated with the sample model, including space group, unit cell parameters, and atomic positions.

data_lbco

_space_group.name_H-M_alt              "P m -3 m"
_space_group.IT_coordinate_system_code 1

_cell.length_a      3.8909(1)
_cell.length_b      3.8909
_cell.length_c      3.8909
_cell.angle_alpha  90
_cell.angle_beta   90
_cell.angle_gamma  90

loop_
_atom_site.label
_atom_site.type_symbol
_atom_site.fract_x
_atom_site.fract_y
_atom_site.fract_z
_atom_site.Wyckoff_letter
_atom_site.occupancy
_atom_site.adp_type
_atom_site.B_iso_or_equiv
La La   0   0   0     a   0.5  Biso 0.4958
Ba Ba   0   0   0     a   0.5  Biso 0.4943
Co Co   0.5 0.5 0.5   b   1    Biso 0.2567
O  O    0   0.5 0.5   c   1    Biso 1.4041

3. experiments / hrpt.cif

This file contains the experiment type, instrumental parameters, peak parameters, associated phases, background parameters and measured diffraction data.

data_hrpt

_expt_type.beam_mode        "constant wavelength"
_expt_type.radiation_probe  neutron
_expt_type.sample_form      powder
_expt_type.scattering_type  bragg

_instr.wavelength    1.494
_instr.2theta_offset 0.6225(4)

_peak.broad_gauss_u    0.0834
_peak.broad_gauss_v   -0.1168
_peak.broad_gauss_w    0.123
_peak.broad_lorentz_x  0
_peak.broad_lorentz_y  0.0797

loop_
_pd_phase_block.id
_pd_phase_block.scale
lbco 9.0976(3)

loop_
_pd_background.line_segment_X
_pd_background.line_segment_intensity
_pd_background.X_coordinate
 10  174.3  2theta
 20  159.8  2theta
 30  167.9  2theta
 50  166.1  2theta
 70  172.3  2theta
 90  171.1  2theta
110  172.4  2theta
130  182.5  2theta
150  173.0  2theta
165  171.1  2theta

loop_
_pd_meas.2theta_scan
_pd_meas.intensity_total
_pd_meas.intensity_total_su
 10.00  167  12.6
 10.05  157  12.5
 10.10  187  13.3
 10.15  197  14.0
 10.20  164  12.5
 10.25  171  13.0
...
164.60  153  20.7
164.65  173  30.1
164.70  187  27.9
164.75  175  38.2
164.80  168  30.9
164.85  109  41.2

4. analysis.cif

This file contains settings used for data analysis, including the choice of calculation and fitting engines, as well as user defined constraints.

_analysis.calculator_engine  cryspy
_analysis.fitting_engine     "lmfit (leastsq)"
_analysis.fit_mode           single

loop_
_alias.label
_alias.param_uid
biso_La  lbco.atom_site.La.B_iso_or_equiv
biso_Ba  lbco.atom_site.Ba.B_iso_or_equiv
occ_La   lbco.atom_site.La.occupancy
occ_Ba   lbco.atom_site.Ba.occupancy

loop_
_constraint.lhs_alias
_constraint.rhs_expr
biso_Ba  biso_La
occ_Ba   "1 - occ_La"



Now that the Project has been defined, you can proceed to the next step: Sample Model.