Structure Refinement: Co2SiO4, D20 (T-scan, resumed)¶
This example loads a previously saved Co2SiO4 project after a
sequential refinement was stopped before all scan files were
processed. If analysis/results.csv already contains completed rows,
running project.analysis.fit() again resumes from the remaining
datasets and appends the missing results.
🛠️ Import Library¶
import easydiffraction as edi
📂 Load Project¶
Locate Project¶
Download and extract the saved Co2SiO4 scan project from the EasyDiffraction data repository.
project_dir = edi.download_data('proj-cosio-d20-scan', destination='projects', overwrite=True)
Getting data...
Data 'proj-cosio-d20-scan': Co2SiO4, D20 (ILL), T-scan (resumed)
✅ Data 'proj-cosio-d20-scan' downloaded and extracted to '../../../projects/proj-cosio-d20-scan-db6dec492e9e'
Load Project¶
The project is downloaded into a fresh writable working directory so
resuming the sequential fit appends to its analysis/results.csv.
project = edi.Project.load(project_dir)
🚀 Perform Analysis¶
Display Structure¶
Render the Co2SiO4 structure restored from the saved project.
project.display.structure(struct_name='cosio')
Structure 🧩 'cosio' (Atom view type: 'adp')
wheel = zoom
right-drag = pan
Resume Sequential Analysis¶
This project already stores the template experiment, sequential-fit
settings, and the partial analysis/results.csv from the previous
run. Running the fit again skips datasets already present in the CSV
and continues from the remaining files.
project.analysis.fit()
📂 Resuming from CSV: 3 files already fitted.
✅ All files already fitted. Nothing to do.
Saving project 📦 'cosio_d20_scan' to '../../../projects/proj-cosio-d20-scan-db6dec492e9e'
├── 📄 project.edi
├── 📁 structures/
│ └── 📄 cosio.edi
├── 📁 experiments/
│ └── 📄 d20.edi
├── 📁 analysis/
│ ├── 📄 analysis.edi
│ └── 📄 results.csv
└── 📁 reports/
└── 📄 cosio_d20_scan.html
Replay Fitted Datasets¶
Apply fitted parameters from the first CSV row and plot the result.
project.apply_params_from_csv(row_index=0)
project.display.pattern(expt_name='d20')
Apply fitted parameters from the last CSV row and plot the result.
project.apply_params_from_csv(row_index=-1)
project.display.pattern(expt_name='d20')
Display Parameter Evolution¶
Use the same persisted diffrn path stored in analysis/results.csv
for the x-axis.
temperature = 'diffrn.ambient_temperature'
Plot fit quality metrics vs. temperature.
project.display.fit.series(
project.analysis.fit_result.success,
versus=temperature,
)
project.display.fit.series(
project.analysis.fit_result.reduced_chi_square,
versus=temperature,
)
project.display.fit.series(
project.analysis.fit_result.iterations,
versus=temperature,
)
Omitting param plots every fitted parameter one after another.
project.display.fit.series(versus=temperature)
💾 Save Project¶
project.save_as(dir_path='projects/refine-cosio-d20-tscan-resumed')
Saving project 📦 'cosio_d20_scan' to '../../../projects/refine-cosio-d20-tscan-resumed'
├── 📄 project.edi
├── 📁 structures/
│ └── 📄 cosio.edi
├── 📁 experiments/
│ └── 📄 d20.edi
├── 📁 analysis/
│ └── 📄 analysis.edi
└── 📁 reports/
└── 📄 cosio_d20_scan.html