Expand description
Numerical kernels for powder diffraction profile calculation.
phasesmith-core is the lowest numerical layer. It operates on explicit
parameters and flat borrowed slices and is deliberately unaware of files,
phases, refinement projects, Python, and GUI state. Most applications should
depend on the phasesmith facade and reach
this crate through phasesmith::core.
§Capabilities
- symmetric pseudo-Voigt and Thompson–Cox–Hastings profiles;
- constant-wavelength U/V/W/X/Y broadening;
- Finger–Cox–Jephcoat axial asymmetry;
- fixed wavelength components and neutron time-of-flight profiles;
- smooth Bruckner background estimation;
- fused pattern values and analytical derivative storage.
§Quick start
use phasesmith_core::{Peak, accumulate_peaks};
let x = [23.9, 24.0, 24.1];
let peaks = [Peak {
position: 24.0,
intensity: 100.0,
fwhm: 0.1,
eta: 0.4,
}];
let result = accumulate_peaks(&x, &peaks, 20.0)?;
assert_eq!(result.y.len(), x.len());
assert_eq!(result.derivatives.local.parameter_count, 4);GridView and the various *BatchView types validate borrowed arrays
once before entering hot kernels. Local derivatives use sparse finite-support
storage; call SupportJacobian::to_dense only when a dense allocation is
actually required. See profile for support and derivative conventions.
The facade’s
profile mathematics guide
derives every implemented profile and broadening equation together.
Re-exports§
pub use background::BackgroundError;pub use background::smooth_bruckner;pub use cw::ConstantWavelengthInstrument;pub use cw::CwBatchError;pub use cw::CwError;pub use cw::CwProfileParameters;pub use cw::CwReflectionBatchView;pub use cw::accumulate_cw_batch;pub use cw_components::CwComponentsBatchError;pub use cw_components::accumulate_cw_components_batch;pub use cw_components::accumulate_cw_fcj_components_batch;pub use cw_contributions::CwContributionArrays;pub use cw_contributions::CwContributionsError;pub use cw_contributions::CwContributionsView;pub use cw_contributions::OwnedCwContributionArrays;pub use cw_contributions::OwnedCwContributions;pub use cw_contributions::accumulate_cw_contributions_batch;pub use cw_contributions::accumulate_cw_contributions_batch_with_context;pub use cw_contributions::accumulate_cw_fcj_contributions_batch;pub use cw_contributions::accumulate_cw_fcj_contributions_batch_with_context;pub use cw_fcj::CwFcjBatchError;pub use cw_fcj::accumulate_cw_fcj_batch;pub use fcj::FcjError;pub use fcj::FcjGeometry;pub use fcj::FcjProfile;pub use fcj::FcjProfilePoint;pub use profile::Accumulation;pub use profile::DenseJacobian;pub use profile::GridView;pub use profile::PatternDerivatives;pub use profile::Peak;pub use profile::PeakBatchView;pub use profile::ProfileError;pub use profile::ProfilePoint;pub use profile::SupportJacobian;pub use profile::SupportPolicy;pub use profile::SupportRange;pub use profile::accumulate_batch;pub use profile::accumulate_peaks;pub use profile::accumulate_values_batch;pub use profile::symmetric_pseudo_voigt;pub use radiation::WavelengthComponentsError;pub use radiation::WavelengthComponentsView;pub use tch::TchError;pub use tch::TchPeakBatchView;pub use tch::TchProfilePoint;pub use tch::TchShape;pub use tch::TchWidths;pub use tch::accumulate_tch_batch;pub use tch::tch_pseudo_voigt;pub use tof::TOF_GLOBAL_PARAMETER_COUNT;pub use tof::TOF_GLOBAL_PARAMETER_NAMES;pub use tof::TOF_INCIDENT_SPECTRUM_COEFFICIENT_COUNT;pub use tof::TofBankGeometry;pub use tof::TofError;pub use tof::TofIncidentSpectrum;pub use tof::TofIncidentSpectrumError;pub use tof::TofIncidentSpectrumPoint;pub use tof::TofInstrument;pub use tof::TofInstrumentParameter;pub use tof::TofProfile;pub use tof::TofProfileParameters;pub use tof::TofProfilePoint;pub use tof::accumulate_tof_batch;pub use tof::accumulate_tof_batch_with_context;
Modules§
- background
- Deterministic background-estimation kernels.
- cw
- Constant-wavelength U/V/W/X/Y profile broadening.
- cw_
components - Fused CW wavelength-component accumulation with optional FCJ asymmetry.
- cw_
contributions - CW accumulation with externally prepared sample-physics contributions.
- cw_fcj
- Single-wavelength compatibility wrapper for CW plus FCJ accumulation.
- fcj
- Finger-Cox-Jephcoat axial-divergence convolution.
- profile
- Symmetric pseudo-Voigt profile and fused peak accumulation.
- radiation
- Wavelength-component models for constant-wavelength radiation.
- tch
- Thompson-Cox-Hastings component-width transform and symmetric profile.
- tof
- Neutron time-of-flight calibration, profile parameters, and accumulation.