orochi.fit
— Orochi Fit: Parameter Refinement and Multi-Module Optimization —
The orochi.fit package provides robust structural refinement and parameter optimization engines for experimental scattering data within the Orochi 4.0 ecosystem. It bridges physical simulators (such as orochi.pdfsim and orochi.phase) with modern numerical optimization frameworks:
Bounded Least-Squares Refinement (``LeastSquaresOptimizer``): Powered by lmfit and SciPy, supporting Levenberg–Marquardt, Nelder–Mead, and Powell algorithms with parameter bounds, linear constraints, and parameter ties.
Bayesian Global Optimization (``BayesOptimizer``): Powered by Optuna, enabling tree-structured Parzen estimator (TPE) and CMA-ES sampling for challenging, multi-modal, or highly correlated parameter landscapes.
Quickstart: Real-Space PDF Refinement
The following example demonstrates refining the scale factor and atomic displacement parameter (U_iso) of a ceria (CeO₂) model against experimental Pair Distribution Function (G(r)) data:
import numpy as np
from orochi.phase import Phase
from orochi.pdfsim import Simulator
from orochi.fit import LeastSquaresOptimizer
# 1. Setup Phase and Simulator
phase = Phase()
phase.read_cif("CeO2.cif")
sim = Simulator()
sim.phase = phase
sim["qmax"] = 25.0
sim["qdamp"] = 0.04
# 2. Configure optimizable parameters and search bounds
sim["scale"] = 1.0
sim["scale", "min"] = 0.1
sim["scale", "max"] = 5.0
sim["scale", "fit"] = True
phase["uiso_0"] = 0.005
phase["uiso_0", "min"] = 0.0001
phase["uiso_0", "max"] = 0.05
phase["uiso_0", "fit"] = True
# 3. Configure Optimizer
opt = LeastSquaresOptimizer()
opt.simulators = [sim]
opt["fit_min"] = 1.5
opt["fit_max"] = 20.0
opt.study_name = "ceo2_refinement"
# Load experimental PDF data (r, G(r))
opt.read_file("CeO2_experimental.gr")
# 4. Execute Refinement
# Automated execution:
opt()
# Or explicit manual execution forcing clean re-evaluation:
# opt.run(force=True)
# 5. Inspect Results
print("Optimization Scores:", opt.best_scores)
print("Refined Parameters:", opt.best_params)
Execution Lifecycle & Force Recalculation
Like all core Orochi modules, LeastSquaresOptimizer and BayesOptimizer support dual execution interfaces:
Automated execution via ``opt()``: Resets internal states and optimizes according to changed parameters.
Manual execution via ``opt.run(force=True)``: Forcibly resets both the optimizer’s cache and all attached simulators’ caches (setting _state = "INIT"), guaranteeing a completely fresh evaluation from initial conditions.
Installation
Install via pip:
pip install orochi.fit
Or install in development mode from source:
git clone https://github.com/Tominaka-Laboratory/orochi.fit.git
cd orochi.fit
pip install -e .
To confirm successful installation:
python -c "import orochi.fit; print(orochi.fit.__version__)"
Citation
If you use orochi.fit in your research, please cite:
Orochi Software Suite, Tominaka Laboratory, National Institute for Materials Science (NIMS). https://github.com/Tominaka-Laboratory/orochi.fit
For Bayesian optimization workflows, please also cite Optuna:
Akiba et al., “Optuna: A Next-generation Hyperparameter Optimization Framework”, Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (2019).
License
This project is licensed under the GNU General Public License v3.0 (GPLv3). See the LICENSE.rst file for details.
This copyleft license guarantees that Orochi remains freely accessible, open, and transparent to the entire scientific community, and that all derivative works must likewise remain open source.
Citation
If you use this package in academic research, please cite:
@article{tominaka2026orochi,
title = {Orochi: A Physics-Grounded Python Package for Pair Distribution Function Analysis of Crystalline and Low-Dimensional Materials},
author = {Tominaka, Satoshi},
year = {2026},
url = {https://github.com/Tominaka-Laboratory/orochi}
}
Contact
For bug reports and questions, visit GitHub Issues or contact Dr. Satoshi Tominaka at tominaka.satoshi@nims.go.jp.
Metadata
Release files for orochi.fit 4.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| orochi_fit-4.0.0.tar.gz | 54.9 kB | Without provenance | Details for orochi_fit-4.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| orochi_fit-4.0.0-py3-none-any.whl | Python 3 | none | any | Details for orochi_fit-4.0.0-py3-none-any.whl |
Total release size: 112.4 kB
Release files / orochi_fit-4.0.0.tar.gz
| Download URL | orochi_fit-4.0.0.tar.gz |
|---|---|
| Size | 54.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b828d22bb3aefae5342c7aa0b417f216210c9d0f972fd3ea2d0a0e85d77d4f66
|
|
BLAKE2b-256 checksum How to use checksums |
9476fa2143e19b1b8419ee033b22b1e4b852d48ef23801919e5c15d826b726f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Release files / orochi_fit-4.0.0-py3-none-any.whl
| Download URL | orochi_fit-4.0.0-py3-none-any.whl |
|---|---|
| Size | 57.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
351f3457c7ed61647305c165afb944a090bea512289d1d6d4722a18070f4b6b5
|
|
BLAKE2b-256 checksum How to use checksums |
b7652ace0faede8874817a7d5fa76523d3bb5c62e61fb5c7521665fa9c2a5ac3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Security for orochi.fit 4.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.