Co2SiO4 T-scan Resume¶
This example loads a previously saved Co2SiO4 project after a
sequential refinement was stopped before all scan files were
processed. The saved project contains 213 scan files and a partial
analysis/results.csv with 210 completed rows. Running
project.analysis.fit() resumes from the remaining three 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. The project contains the scan data and the partial sequential-fit results needed for resuming.
project_dir = edi.download_data('proj-cosio-d20-scan', destination='projects', overwrite=True)
Getting data...
Data 'proj-cosio-d20-scan': Co2SiO4, D20 (ILL), 213-file T-scan resume project with 210 completed results
✅ Data 'proj-cosio-d20-scan' downloaded and extracted to '../../../projects/proj-cosio-d20-scan-cee816aee63d'
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: 210 files already fitted.
Sequential fitting
🚀 Starting fit process with 'bumps (lm)'...
📋 3 files in 1 chunks (max_workers=4)
📈 Goodness-of-fit progress:
| chunk | progress | time (s) | files | count | average χ² | status | |
|---|---|---|---|---|---|---|---|
| 1 | 1/1 | 100.0% | 58.99 | 002p3630_all594632.dat - 002p3440_all594631.dat | 3 | 53.31 | ✅ |
✅ Sequential fitting complete: 213 files processed.
📄 Results saved to '../../../projects/proj-cosio-d20-scan-cee816aee63d/analysis/results.csv'
Saving project 📦 'cosio_d20_scan' to '../../../projects/proj-cosio-d20-scan-cee816aee63d'
├── 📄 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