Expand description
Application-neutral owned records shared by scripting and native hosts.
These types describe validated live domain state. Persistence wire records,
migrations, PyO3 objects, and Tauri command payloads deliberately live in
adapter crates instead of being derived directly from this model.
Applications normally use this crate through
phasesmith::model.
§Core records
PatternRecordowns a strictly increasing2θgrid and aligned observations, uncertainties, mask, and fixed background.TofPatternRecordowns the corresponding explicitly microsecond-domain time-of-flight record; the coordinate types cannot be interchanged.StructuralPhaseRecordowns one crystal-structure phase and its provider requirements.HistogramRecordcombines observed data, an experiment, and referenced phase IDs.ProjectRecordis a revisioned multi-histogram project snapshot.RecordIdis the validated stable identifier shared across records.
§Example
use phasesmith_model::PatternRecord;
let pattern = PatternRecord::new(
vec![20.0, 20.1],
Some(vec![100.0, 120.0]),
Some(vec![2.0, 2.5]),
None,
None,
)?;
assert_eq!(pattern.sample_count(), 2);
assert_eq!(pattern.background_y, [0.0, 0.0]);Constructors validate records at trust boundaries. Public fields remain
available for efficient adapter construction, so call validate again
after direct mutation or before crossing into persistence/workflow code.
Structs§
- Capability
Diagnostic - One host-capability diagnostic tied to a stable phase.
- Experiment
Record - Constant-wavelength experiment shared by native workflows and adapters.
- Fixed
Wavelength Spectrum - Validated fixed radiation components in input order.
- Histogram
Record - One independently observed dataset in a multi-histogram project.
- Host
Capabilities - Provider versions available to one application host.
- Pattern
Record - Owned observed powder pattern for one histogram.
- Project
Record - Revisioned application-neutral project snapshot.
- Provider
Requirement - Exact external provider capability required by a phase.
- Record
Id - Stable project-owned identifier used for projects, histograms, and phases.
- Structural
Phase Record - One validated structural phase and its optional extension requirements.
- TofExperiment
Record - One explicitly microsecond-domain time-of-flight experiment.
- TofHistogram
Record - One independently observed TOF dataset in a multi-histogram project.
- TofPattern
Record - Owned time-of-flight powder pattern with an explicitly microsecond coordinate axis.
Enums§
- Capability
Reason - Stable reason a project capability is unavailable to a host.
- Domain
Error - Invalid native domain or project data.
- Radiation
Definition - Radiation attached to one constant-wavelength histogram.
- Radiation
Probe - X-ray or neutron radiation selection.