Skip to content

analysis

Modules:

Name Description
analysis
calculators
categories
enums

Enumeration types used by analysis components.

fit_helpers
fitting
minimizers
sequential

Sequential fitting infrastructure: template, worker, CSV, recovery.

Classes

Modules

analysis

Classes:

Name Description
UndoFitOutcome

Summary of one undo-fit operation.

AnalysisDisplay

Display helper - parameter tables, CIF, and fit results.

Analysis

High-level orchestration of analysis tasks for a Project.

Classes

UndoFitOutcome(restored_parameter_names, cleared_fit_result, cleared_sidecar, was_no_op) dataclass

Summary of one undo-fit operation.

Attributes:

Name Type Description
restored_parameter_names tuple[str, ...]

Unique names of parameters restored to pre-fit values.

cleared_fit_result bool

Whether a committed fit-result projection was cleared.

cleared_sidecar bool

Whether in-memory sidecar arrays were cleared.

was_no_op bool

Whether the call found no fit to undo.

AnalysisDisplay(analysis)

Display helper - parameter tables, CIF, and fit results.

Accessed via analysis.display.

Methods:

Name Description
help

Print available analysis-display methods.

all_params

Print all parameters for structures and experiments.

fittable_params

Print all fittable parameters.

free_params

Print only currently free (varying) parameters.

how_to_access_parameters

Show Python access paths for all parameters.

parameter_cif_uids

Show CIF unique IDs for all parameters.

constraints

Print a table of all user-defined symbolic constraints.

fit_results

Display a summary of the fit results.

as_cif

Render the analysis section as CIF in console.

Functions
help()

Print available analysis-display methods.

all_params()

Print all parameters for structures and experiments.

fittable_params()

Print all fittable parameters.

free_params()

Print only currently free (varying) parameters.

how_to_access_parameters()

Show Python access paths for all parameters.

The output explains how to reference specific parameters in code.

parameter_cif_uids()

Show CIF unique IDs for all parameters.

The output explains which unique identifiers are used when creating CIF-based constraints.

constraints()

Print a table of all user-defined symbolic constraints.

fit_results()

Display a summary of the fit results.

Renders the fit quality metrics (reduced χ², R-factors) and a table of fitted parameters with their starting values, final values, and uncertainties.

This method should be called after :meth:Analysis.fit completes. If no fit has been performed yet, a warning is logged.

as_cif()

Render the analysis section as CIF in console.

Analysis(project)

High-level orchestration of analysis tasks for a Project.

This class wires calculators and minimizers, exposes a compact interface for parameters, constraints and results, and coordinates computations across the project's structures and experiments.

Parameters:

Name Type Description Default
project object

The project that owns models and experiments.

required

Methods:

Name Description
help

Print a summary of analysis properties and methods.

fit

Execute fitting for the currently selected fitting mode.

undo_fit

Roll back the latest fit output and scalar state.

show_as_cif

Pretty-print the analysis section as CIF text.

__str__

Return the string representation of this object.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

Attributes:

Name Type Description
fitting_mode FittingMode

Active fitting-mode selector category.

minimizer MinimizerCategoryBase

Active minimizer settings and result category.

joint_fit object

Per-experiment weight collection for joint fitting.

sequential_fit SequentialFit

Persisted settings for sequential fitting.

sequential_fit_extract SequentialFitExtractCollection

Persisted extract rules for sequential fitting.

as_cif str

Serialize the analysis section to a CIF string.

unique_name str

Fallback unique name: the class name.

parameters list

All parameters from all owned categories.

categories list

All category objects owned by this object, sorted by priority.

fit_parameters FitParameters

Persisted fit-parameter control snapshots.

fit_result FitResultBase

Persisted common fit-result status metadata.

fit_parameter_correlations FitParameterCorrelations

Persisted fit-parameter correlation summaries.

software Software

Software snapshot for the latest successful fit.

project object

Project that owns this analysis section.

aliases object

Alias mappings used by symbolic constraints and displays.

constraints object

Symbolic constraints owned by this analysis section.

display AnalysisDisplay

Display helper for parameter tables, CIF, and fit results.

fitter Fitter

Fitting engine used by this analysis object.

fit_results object | None

Results from the most recent fit, if any.

Attributes
fitting_mode property

Active fitting-mode selector category.

minimizer property

Active minimizer settings and result category.

joint_fit property

Per-experiment weight collection for joint fitting.

sequential_fit property

Persisted settings for sequential fitting.

sequential_fit_extract property

Persisted extract rules for sequential fitting.

as_cif property

Serialize the analysis section to a CIF string.

Returns:

Type Description
str

The analysis section represented as a CIF document string.

unique_name property

Fallback unique name: the class name.

parameters property

All parameters from all owned categories.

categories property

All category objects owned by this object, sorted by priority.

fit_parameters property

Persisted fit-parameter control snapshots.

fit_result property

Persisted common fit-result status metadata.

fit_parameter_correlations property

Persisted fit-parameter correlation summaries.

software property

Software snapshot for the latest successful fit.

project property

Project that owns this analysis section.

aliases property

Alias mappings used by symbolic constraints and displays.

constraints property

Symbolic constraints owned by this analysis section.

display property

Display helper for parameter tables, CIF, and fit results.

fitter property writable

Fitting engine used by this analysis object.

fit_results property writable

Results from the most recent fit, if any.

Functions
help()

Print a summary of analysis properties and methods.

fit(*, resume=False, extra_steps=None)

Execute fitting for the currently selected fitting mode.

undo_fit()

Roll back the latest fit output and scalar state.

Returns:

Type Description
UndoFitOutcome

Summary of the rollback operation.

show_as_cif()

Pretty-print the analysis section as CIF text.

__str__()

Return the string representation of this object.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

Functions

calculators

Modules:

Name Description
base
crysfml
cryspy
factory

Calculator factory — delegates to FactoryBase.

pdffit

PDF calculation backend using diffpy.pdffit2 if available.

Classes

Modules

base

Classes:

Name Description
PowderReflnRecord

Calculated powder reflection metadata for one reflection row.

CalculatorBase

Base API for diffraction calculation engines.

Classes
PowderReflnRecord(phase_id, d_spacing, sin_theta_over_lambda, index_h, index_k, index_l, f_calc, f_squared_calc, two_theta=None, time_of_flight=None) dataclass

Calculated powder reflection metadata for one reflection row.

CalculatorBase

Base API for diffraction calculation engines.

Methods:

Name Description
calculate_structure_factors

Calculate structure factors for one experiment.

calculate_pattern

Calculate diffraction pattern for one structure-experiment pair.

last_powder_refln_records

Return the last powder reflection records for one phase.

Attributes:

Name Type Description
name str

Short identifier of the calculation engine.

engine_imported bool

True if the underlying calculation library is available.

Attributes
name abstractmethod property

Short identifier of the calculation engine.

engine_imported abstractmethod property

True if the underlying calculation library is available.

Functions
calculate_structure_factors(structure, experiment, *, called_by_minimizer) abstractmethod

Calculate structure factors for one experiment.

calculate_pattern(structure, experiment, *, called_by_minimizer) abstractmethod

Calculate diffraction pattern for one structure-experiment pair.

Parameters:

Name Type Description Default
structure Structures

The structure object.

required
experiment ExperimentBase

The experiment object.

required
called_by_minimizer bool

Whether the calculation is called by a minimizer. Default is False.

required

Returns:

Type Description
np.ndarray

The calculated diffraction pattern as a NumPy array.

last_powder_refln_records(structure, experiment, *, phase_id)

Return the last powder reflection records for one phase.

Backends that do not expose powder reflection metadata return None so callers can clear stale reflection rows and warn.

crysfml

Classes:

Name Description
CrysfmlCalculator

Wrapper for Crysfml library.

Classes
CrysfmlCalculator

Wrapper for Crysfml library.

Methods:

Name Description
calculate_structure_factors

Call Crysfml to calculate structure factors.

calculate_pattern

Calculate the diffraction pattern using Crysfml.

last_powder_refln_records

Return the last powder reflection records for one phase.

Attributes:

Name Type Description
name str

Short identifier of this calculator engine.

Attributes
name property

Short identifier of this calculator engine.

Functions
calculate_structure_factors(structures, experiments)

Call Crysfml to calculate structure factors.

Parameters:

Name Type Description Default
structures Structures

The structures to calculate structure factors for.

required
experiments Experiments

The experiments associated with the sample models.

required

Raises:

Type Description
NotImplementedError

HKL calculation is not implemented for CrysfmlCalculator.

calculate_pattern(structure, experiment, *, called_by_minimizer=False)

Calculate the diffraction pattern using Crysfml.

Parameters:

Name Type Description Default
structure Structures

The structure to calculate the pattern for.

required
experiment ExperimentBase

The experiment associated with the structure.

required
called_by_minimizer bool

Whether the calculation is called by a minimizer.

False

Returns:

Type Description
np.ndarray | list[float]

The calculated diffraction pattern as a NumPy array or a list of floats.

last_powder_refln_records(structure, experiment, *, phase_id)

Return the last powder reflection records for one phase.

Backends that do not expose powder reflection metadata return None so callers can clear stale reflection rows and warn.

cryspy

Classes:

Name Description
CryspyCalculator

Cryspy-based diffraction calculator.

Classes
CryspyCalculator()

Cryspy-based diffraction calculator.

Converts EasyDiffraction models into Cryspy objects and computes patterns.

Methods:

Name Description
calculate_structure_factors

Raise NotImplementedError as HKL calculation is not implemented.

calculate_pattern

Calculate the diffraction pattern using Cryspy.

last_powder_refln_records

Return powder reflection records from the latest pattern run.

Attributes:

Name Type Description
name str

Short identifier of this calculator engine.

Attributes
name property

Short identifier of this calculator engine.

Functions
calculate_structure_factors(structure, experiment, *, called_by_minimizer=False)

Raise NotImplementedError as HKL calculation is not implemented.

Parameters:

Name Type Description Default
structure Structure

The structure to calculate structure factors for.

required
experiment ExperimentBase

The experiment associated with the sample models.

required
called_by_minimizer bool

Whether the calculation is called by a minimizer.

False
calculate_pattern(structure, experiment, *, called_by_minimizer=False)

Calculate the diffraction pattern using Cryspy.

We only recreate the cryspy_obj if this method is - NOT called by the minimizer, or - the cryspy_dict is NOT yet created. In other cases, we are modifying the existing cryspy_dict This allows significantly speeding up the calculation

Parameters:

Name Type Description Default
structure Structure

The structure to calculate the pattern for.

required
experiment ExperimentBase

The experiment associated with the structure.

required
called_by_minimizer bool

Whether the calculation is called by a minimizer.

False

Returns:

Type Description
np.ndarray | list[float]

The calculated diffraction pattern as a NumPy array or a list of floats.

last_powder_refln_records(structure, experiment, *, phase_id)

Return powder reflection records from the latest pattern run.

Functions
factory

Calculator factory — delegates to FactoryBase.

Overrides _supported_map to filter out calculators whose engines are not importable in the current environment.

Classes:

Name Description
CalculatorFactory

Factory for creating calculation engine instances.

Classes
CalculatorFactory

Factory for creating calculation engine instances.

Only calculators whose engine_imported flag is True are available for creation.

Methods:

Name Description
__init_subclass__

Give each subclass its own independent registry and rules.

register

Class decorator to register a concrete class.

supported_tags

Return list of all supported tags.

default_tag

Resolve the default tag for a given experimental context.

create

Instantiate a registered class by tag.

create_default_for

Instantiate the default class for a given context.

supported_for

Return classes matching conditions and/or calculator.

show_supported

Pretty-print a table of supported types.

Functions
__init_subclass__(**kwargs)

Give each subclass its own independent registry and rules.

register(klass) classmethod

Class decorator to register a concrete class.

Usage::

@SomeFactory.register class MyClass(SomeBase): type_info = TypeInfo(...)

Returns the class unmodified.

supported_tags() classmethod

Return list of all supported tags.

default_tag(**conditions) classmethod

Resolve the default tag for a given experimental context.

Uses largest-subset matching: the rule whose key is the biggest subset of the given conditions wins. A rule with an empty key (frozenset()) acts as a universal fallback.

Parameters:

Name Type Description Default
**conditions object

Experimental-axis values, e.g. scattering_type=ScatteringTypeEnum.BRAGG.

{}

Returns:

Type Description
str

The resolved default tag string.

Raises:

Type Description
ValueError

If no rule matches the given conditions.

create(tag, **kwargs) classmethod

Instantiate a registered class by tag.

Parameters:

Name Type Description Default
tag str

type_info.tag value.

required
**kwargs object

Forwarded to the class constructor.

{}

Returns:

Type Description
object

A new instance of the registered class.

Raises:

Type Description
ValueError

If tag is not in the registry.

create_default_for(**conditions) classmethod

Instantiate the default class for a given context.

Combines default_tag(**conditions) with create(tag).

Parameters:

Name Type Description Default
**conditions object

Experimental-axis values.

{}

Returns:

Type Description
object

A new instance of the default class.

supported_for(*, calculator=None, sample_form=None, scattering_type=None, beam_mode=None, radiation_probe=None) classmethod

Return classes matching conditions and/or calculator.

Parameters:

Name Type Description Default
calculator object

Optional CalculatorEnum value.

None
sample_form object

Optional SampleFormEnum value.

None
scattering_type object

Optional ScatteringTypeEnum value.

None
beam_mode object

Optional BeamModeEnum value.

None
radiation_probe object

Optional RadiationProbeEnum value.

None

Returns:

Type Description
list[type]

Classes matching the given conditions.

show_supported(*, calculator=None, sample_form=None, scattering_type=None, beam_mode=None, radiation_probe=None) classmethod

Pretty-print a table of supported types.

Parameters:

Name Type Description Default
calculator object

Optional CalculatorEnum filter.

None
sample_form object

Optional SampleFormEnum filter.

None
scattering_type object

Optional ScatteringTypeEnum filter.

None
beam_mode object

Optional BeamModeEnum filter.

None
radiation_probe object

Optional RadiationProbeEnum filter.

None
pdffit

PDF calculation backend using diffpy.pdffit2 if available.

The class adapts the engine to EasyDiffraction calculator interface and silences stdio on import to avoid noisy output in notebooks and logs.

Classes:

Name Description
PdffitCalculator

Wrapper for Pdffit library.

Classes
PdffitCalculator

Wrapper for Pdffit library.

Methods:

Name Description
calculate_structure_factors

Return an empty list; PDF does not compute structure factors.

calculate_pattern

Calculate the PDF pattern using PDFfit2.

last_powder_refln_records

Return the last powder reflection records for one phase.

Attributes:

Name Type Description
name str

Short identifier of this calculator engine.

Attributes
name property

Short identifier of this calculator engine.

Functions
calculate_structure_factors(structures, experiments)

Return an empty list; PDF does not compute structure factors.

Parameters:

Name Type Description Default
structures object

Unused; kept for interface consistency.

required
experiments object

Unused; kept for interface consistency.

required

Returns:

Type Description
list

An empty list.

calculate_pattern(structure, experiment, *, called_by_minimizer=False)

Calculate the PDF pattern using PDFfit2.

Parameters:

Name Type Description Default
structure Structure

The structure object supplying atom sites and cell parameters.

required
experiment ExperimentBase

The experiment object supplying instrument and peak parameters.

required
called_by_minimizer bool

Unused; kept for interface consistency.

False
last_powder_refln_records(structure, experiment, *, phase_id)

Return the last powder reflection records for one phase.

Backends that do not expose powder reflection metadata return None so callers can clear stale reflection rows and warn.

categories

Modules:

Name Description
aliases
constraints
fit_parameter_correlations
fit_parameters
fit_result
fitting_mode

Analysis fitting-mode category exports.

joint_fit
minimizer

Minimizer category implementations.

sequential_fit
sequential_fit_extract
software

Analysis software-provenance category exports.

Classes

Modules

aliases

Modules:

Name Description
default

Alias category for mapping friendly names to parameters.

factory

Aliases factory — delegates entirely to FactoryBase.

Classes
Modules
default

Alias category for mapping friendly names to parameters.

Defines a small record type used by analysis configuration to refer to parameters via readable labels instead of opaque identifiers. At runtime each alias holds a direct object reference to the parameter; for CIF serialization the parameter's unique_name is stored.

Classes:

Name Description
Alias

Single alias entry.

Aliases

Collection of :class:Alias items.

Classes
Alias()

Single alias entry.

Maps a human-readable label to a parameter object. The param_unique_name descriptor stores the parameter's unique_name for CIF serialization.

Methods:

Name Description
__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print parameters, other properties, and methods.

from_cif

Populate this item from a CIF block.

Attributes:

Name Type Description
label StringDescriptor

Human-readable alias label (e.g. 'biso_La').

param object | None

The referenced parameter object, or None before resolution.

param_unique_name StringDescriptor

Unique name of the referenced parameter (for CIF).

parameters list

Descriptors owned by this alias (excludes the param reference).

unique_name str

Fully qualified name: datablock, category, entry.

as_cif str

Return CIF representation of this object.

Attributes
label property writable

Human-readable alias label (e.g. 'biso_La').

Reading this property returns the underlying StringDescriptor object. Assigning to it updates the parameter value.

param property

The referenced parameter object, or None before resolution.

param_unique_name property

Unique name of the referenced parameter (for CIF).

Reading this property returns the underlying StringDescriptor object.

parameters property

Descriptors owned by this alias (excludes the param reference).

unique_name property

Fully qualified name: datablock, category, entry.

as_cif property

Return CIF representation of this object.

Functions
__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print parameters, other properties, and methods.

from_cif(block, idx=0)

Populate this item from a CIF block.

Aliases()

Collection of :class:Alias items.

Methods:

Name Description
create

Create a new alias mapping a label to a parameter.

__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print a summary of public attributes and contained items.

__getitem__

Return an item by name or positional index.

__setitem__

Insert or replace an item under the given identity key.

__delitem__

Delete an item by key or raise KeyError if missing.

__contains__

Check whether an item with the given key exists.

__iter__

Iterate over items in insertion order.

__len__

Return the number of items in the collection.

remove

Remove an item by its key.

keys

Yield keys for all items in insertion order.

values

Yield items in insertion order.

items

Yield (key, item) pairs in insertion order.

from_cif

Populate this collection from a CIF block.

add

Insert or replace a pre-built item into the collection.

Attributes:

Name Type Description
unique_name str | None

Return None; collections have no unique name.

parameters list

All parameters from all items in this collection.

as_cif str

Return CIF representation of this object.

names list[str | None]

List of all item keys in the collection.

scalar_descriptors list

Collection-level descriptors serialized outside the loop.

Attributes
unique_name property

Return None; collections have no unique name.

parameters property

All parameters from all items in this collection.

as_cif property

Return CIF representation of this object.

names property

List of all item keys in the collection.

scalar_descriptors property

Collection-level descriptors serialized outside the loop.

Functions
create(*, label, param)

Create a new alias mapping a label to a parameter.

Parameters:

Name Type Description Default
label str

Human-readable alias name (e.g. 'biso_La').

required
param object

The parameter object to reference.

required
__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print a summary of public attributes and contained items.

__getitem__(key)

Return an item by name or positional index.

Parameters:

Name Type Description Default
key str | int

Identity key (str) or zero-based positional index (int).

required

Returns:

Type Description
GuardedBase

The item matching the given key or index.

Raises:

Type Description
TypeError

If key is neither str nor int.

__setitem__(name, item)

Insert or replace an item under the given identity key.

__delitem__(name)

Delete an item by key or raise KeyError if missing.

__contains__(name)

Check whether an item with the given key exists.

__iter__()

Iterate over items in insertion order.

__len__()

Return the number of items in the collection.

remove(name)

Remove an item by its key.

Parameters:

Name Type Description Default
name str

Identity key of the item to remove.

required
keys()

Yield keys for all items in insertion order.

values()

Yield items in insertion order.

items()

Yield (key, item) pairs in insertion order.

from_cif(block)

Populate this collection from a CIF block.

add(item)

Insert or replace a pre-built item into the collection.

Parameters:

Name Type Description Default
item object

A CategoryItem instance to add.

required
factory

Aliases factory — delegates entirely to FactoryBase.

Classes:

Name Description
AliasesFactory

Create alias collections by tag.

Classes
AliasesFactory

Create alias collections by tag.

Methods:

Name Description
__init_subclass__

Give each subclass its own independent registry and rules.

register

Class decorator to register a concrete class.

supported_tags

Return list of all supported tags.

default_tag

Resolve the default tag for a given experimental context.

create

Instantiate a registered class by tag.

create_default_for

Instantiate the default class for a given context.

supported_for

Return classes matching conditions and/or calculator.

show_supported

Pretty-print a table of supported types.

Functions
__init_subclass__(**kwargs)

Give each subclass its own independent registry and rules.

register(klass) classmethod

Class decorator to register a concrete class.

Usage::

@SomeFactory.register class MyClass(SomeBase): type_info = TypeInfo(...)

Returns the class unmodified.

supported_tags() classmethod

Return list of all supported tags.

default_tag(**conditions) classmethod

Resolve the default tag for a given experimental context.

Uses largest-subset matching: the rule whose key is the biggest subset of the given conditions wins. A rule with an empty key (frozenset()) acts as a universal fallback.

Parameters:

Name Type Description Default
**conditions object

Experimental-axis values, e.g. scattering_type=ScatteringTypeEnum.BRAGG.

{}

Returns:

Type Description
str

The resolved default tag string.

Raises:

Type Description
ValueError

If no rule matches the given conditions.

create(tag, **kwargs) classmethod

Instantiate a registered class by tag.

Parameters:

Name Type Description Default
tag str

type_info.tag value.

required
**kwargs object

Forwarded to the class constructor.

{}

Returns:

Type Description
object

A new instance of the registered class.

Raises:

Type Description
ValueError

If tag is not in the registry.

create_default_for(**conditions) classmethod

Instantiate the default class for a given context.

Combines default_tag(**conditions) with create(tag).

Parameters:

Name Type Description Default
**conditions object

Experimental-axis values.

{}

Returns:

Type Description
object

A new instance of the default class.

supported_for(*, calculator=None, sample_form=None, scattering_type=None, beam_mode=None, radiation_probe=None) classmethod

Return classes matching conditions and/or calculator.

Parameters:

Name Type Description Default
calculator object

Optional CalculatorEnum value.

None
sample_form object

Optional SampleFormEnum value.

None
scattering_type object

Optional ScatteringTypeEnum value.

None
beam_mode object

Optional BeamModeEnum value.

None
radiation_probe object

Optional RadiationProbeEnum value.

None

Returns:

Type Description
list[type]

Classes matching the given conditions.

show_supported(*, calculator=None, sample_form=None, scattering_type=None, beam_mode=None, radiation_probe=None) classmethod

Pretty-print a table of supported types.

Parameters:

Name Type Description Default
calculator object

Optional CalculatorEnum filter.

None
sample_form object

Optional SampleFormEnum filter.

None
scattering_type object

Optional ScatteringTypeEnum filter.

None
beam_mode object

Optional BeamModeEnum filter.

None
radiation_probe object

Optional RadiationProbeEnum filter.

None
constraints

Modules:

Name Description
default

Simple symbolic constraint between parameters.

factory

Constraints factory — delegates entirely to FactoryBase.

Classes
Modules
default

Simple symbolic constraint between parameters.

Represents an equation of the form lhs_alias = rhs_expr stored as a single expression string. The left- and right-hand sides are derived by splitting the expression at the = sign.

Classes:

Name Description
Constraint

Single constraint item stored as lhs = rhs expression.

Constraints

Collection of :class:Constraint items.

Classes
Constraint()

Single constraint item stored as lhs = rhs expression.

Methods:

Name Description
__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print parameters, other properties, and methods.

from_cif

Populate this item from a CIF block.

Attributes:

Name Type Description
id StringDescriptor

Explicit identifier for this constraint row.

expression StringDescriptor

Full constraint equation (e.g. 'occ_Ba = 1 - occ_La').

lhs_alias str

Left-hand side alias derived from the expression.

rhs_expr str

Right-hand side expression derived from the expression.

unique_name str

Fully qualified name: datablock, category, entry.

parameters list

All GenericDescriptorBase instances on this item.

as_cif str

Return CIF representation of this object.

Attributes
id property writable

Explicit identifier for this constraint row.

expression property writable

Full constraint equation (e.g. 'occ_Ba = 1 - occ_La').

Reading this property returns the underlying StringDescriptor object. Assigning to it updates the value.

lhs_alias property

Left-hand side alias derived from the expression.

rhs_expr property

Right-hand side expression derived from the expression.

unique_name property

Fully qualified name: datablock, category, entry.

parameters property

All GenericDescriptorBase instances on this item.

as_cif property

Return CIF representation of this object.

Functions
__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print parameters, other properties, and methods.

from_cif(block, idx=0)

Populate this item from a CIF block.

Constraints()

Collection of :class:Constraint items.

Methods:

Name Description
enable

Activate constraints so they are applied during fitting.

disable

Deactivate constraints without deleting them.

create

Create a constraint from an expression string.

show

Print a table of all user-defined symbolic constraints.

__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print a summary of public attributes and contained items.

__getitem__

Return an item by name or positional index.

__setitem__

Insert or replace an item under the given identity key.

__delitem__

Delete an item by key or raise KeyError if missing.

__contains__

Check whether an item with the given key exists.

__iter__

Iterate over items in insertion order.

__len__

Return the number of items in the collection.

remove

Remove an item by its key.

keys

Yield keys for all items in insertion order.

values

Yield items in insertion order.

items

Yield (key, item) pairs in insertion order.

from_cif

Populate this collection from a CIF block.

add

Insert or replace a pre-built item into the collection.

Attributes:

Name Type Description
enabled bool

Whether constraints are currently active.

unique_name str | None

Return None; collections have no unique name.

parameters list

All parameters from all items in this collection.

as_cif str

Return CIF representation of this object.

names list[str | None]

List of all item keys in the collection.

scalar_descriptors list

Collection-level descriptors serialized outside the loop.

Attributes
enabled property

Whether constraints are currently active.

unique_name property

Return None; collections have no unique name.

parameters property

All parameters from all items in this collection.

as_cif property

Return CIF representation of this object.

names property

List of all item keys in the collection.

scalar_descriptors property

Collection-level descriptors serialized outside the loop.

Functions
enable()

Activate constraints so they are applied during fitting.

disable()

Deactivate constraints without deleting them.

create(*, expression, id=None)

Create a constraint from an expression string.

Automatically enables constraints on the first call.

Parameters:

Name Type Description Default
expression str

Constraint equation, e.g. 'biso_Co2 = biso_Co1' or 'occ_Ba = 1 - occ_La'.

required
id str | None

Explicit row identifier. When not None, this value is used as the collection key instead of the left-hand alias.

None
show()

Print a table of all user-defined symbolic constraints.

__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print a summary of public attributes and contained items.

__getitem__(key)

Return an item by name or positional index.

Parameters:

Name Type Description Default
key str | int

Identity key (str) or zero-based positional index (int).

required

Returns:

Type Description
GuardedBase

The item matching the given key or index.

Raises:

Type Description
TypeError

If key is neither str nor int.

__setitem__(name, item)

Insert or replace an item under the given identity key.

__delitem__(name)

Delete an item by key or raise KeyError if missing.

__contains__(name)

Check whether an item with the given key exists.

__iter__()

Iterate over items in insertion order.

__len__()

Return the number of items in the collection.

remove(name)

Remove an item by its key.

Parameters:

Name Type Description Default
name str

Identity key of the item to remove.

required
keys()

Yield keys for all items in insertion order.

values()

Yield items in insertion order.

items()

Yield (key, item) pairs in insertion order.

from_cif(block)

Populate this collection from a CIF block.

add(item)

Insert or replace a pre-built item into the collection.

Parameters:

Name Type Description Default
item object

A CategoryItem instance to add.

required
Functions
factory

Constraints factory — delegates entirely to FactoryBase.

Classes:

Name Description
ConstraintsFactory

Create constraint collections by tag.

Classes
ConstraintsFactory

Create constraint collections by tag.

Methods:

Name Description
__init_subclass__

Give each subclass its own independent registry and rules.

register

Class decorator to register a concrete class.

supported_tags

Return list of all supported tags.

default_tag

Resolve the default tag for a given experimental context.

create

Instantiate a registered class by tag.

create_default_for

Instantiate the default class for a given context.

supported_for

Return classes matching conditions and/or calculator.

show_supported

Pretty-print a table of supported types.

Functions
__init_subclass__(**kwargs)

Give each subclass its own independent registry and rules.

register(klass) classmethod

Class decorator to register a concrete class.

Usage::

@SomeFactory.register class MyClass(SomeBase): type_info = TypeInfo(...)

Returns the class unmodified.

supported_tags() classmethod

Return list of all supported tags.

default_tag(**conditions) classmethod

Resolve the default tag for a given experimental context.

Uses largest-subset matching: the rule whose key is the biggest subset of the given conditions wins. A rule with an empty key (frozenset()) acts as a universal fallback.

Parameters:

Name Type Description Default
**conditions object

Experimental-axis values, e.g. scattering_type=ScatteringTypeEnum.BRAGG.

{}

Returns:

Type Description
str

The resolved default tag string.

Raises:

Type Description
ValueError

If no rule matches the given conditions.

create(tag, **kwargs) classmethod

Instantiate a registered class by tag.

Parameters:

Name Type Description Default
tag str

type_info.tag value.

required
**kwargs object

Forwarded to the class constructor.

{}

Returns:

Type Description
object

A new instance of the registered class.

Raises:

Type Description
ValueError

If tag is not in the registry.

create_default_for(**conditions) classmethod

Instantiate the default class for a given context.

Combines default_tag(**conditions) with create(tag).

Parameters:

Name Type Description Default
**conditions object

Experimental-axis values.

{}

Returns:

Type Description
object

A new instance of the default class.

supported_for(*, calculator=None, sample_form=None, scattering_type=None, beam_mode=None, radiation_probe=None) classmethod

Return classes matching conditions and/or calculator.

Parameters:

Name Type Description Default
calculator object

Optional CalculatorEnum value.

None
sample_form object

Optional SampleFormEnum value.

None
scattering_type object

Optional ScatteringTypeEnum value.

None
beam_mode object

Optional BeamModeEnum value.

None
radiation_probe object

Optional RadiationProbeEnum value.

None

Returns:

Type Description
list[type]

Classes matching the given conditions.

show_supported(*, calculator=None, sample_form=None, scattering_type=None, beam_mode=None, radiation_probe=None) classmethod

Pretty-print a table of supported types.

Parameters:

Name Type Description Default
calculator object

Optional CalculatorEnum filter.

None
sample_form object

Optional SampleFormEnum filter.

None
scattering_type object

Optional ScatteringTypeEnum filter.

None
beam_mode object

Optional BeamModeEnum filter.

None
radiation_probe object

Optional RadiationProbeEnum filter.

None
fit_parameter_correlations

Modules:

Name Description
default

Persisted fit-parameter correlation summaries.

factory

Fit-parameter-correlation factory.

Classes
Modules
default

Persisted fit-parameter correlation summaries.

Classes:

Name Description
FitParameterCorrelationItem

Single persisted fit-parameter correlation row.

FitParameterCorrelations

Collection of persisted fit-parameter correlation summaries.

Classes
FitParameterCorrelationItem()

Single persisted fit-parameter correlation row.

Methods:

Name Description
__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print parameters, other properties, and methods.

from_cif

Populate this item from a CIF block.

Attributes:

Name Type Description
id StringDescriptor

Stable identifier for the persisted correlation row.

source_kind EnumDescriptor

Origin of the persisted correlation summary.

param_unique_name_i StringDescriptor

First unique parameter name in the persisted pair.

param_unique_name_j StringDescriptor

Second unique parameter name in the persisted pair.

correlation NumericDescriptor

Persisted correlation coefficient for the parameter pair.

unique_name str

Fully qualified name: datablock, category, entry.

parameters list

All GenericDescriptorBase instances on this item.

as_cif str

Return CIF representation of this object.

Attributes
id property

Stable identifier for the persisted correlation row.

source_kind property

Origin of the persisted correlation summary.

param_unique_name_i property

First unique parameter name in the persisted pair.

param_unique_name_j property

Second unique parameter name in the persisted pair.

correlation property

Persisted correlation coefficient for the parameter pair.

unique_name property

Fully qualified name: datablock, category, entry.

parameters property

All GenericDescriptorBase instances on this item.

as_cif property

Return CIF representation of this object.

Functions
__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print parameters, other properties, and methods.

from_cif(block, idx=0)

Populate this item from a CIF block.

FitParameterCorrelations()

Collection of persisted fit-parameter correlation summaries.

Methods:

Name Description
create

Create a persisted fit-parameter correlation row.

__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print a summary of public attributes and contained items.

__getitem__

Return an item by name or positional index.

__setitem__

Insert or replace an item under the given identity key.

__delitem__

Delete an item by key or raise KeyError if missing.

__contains__

Check whether an item with the given key exists.

__iter__

Iterate over items in insertion order.

__len__

Return the number of items in the collection.

remove

Remove an item by its key.

keys

Yield keys for all items in insertion order.

values

Yield items in insertion order.

items

Yield (key, item) pairs in insertion order.

from_cif

Populate this collection from a CIF block.

add

Insert or replace a pre-built item into the collection.

Attributes:

Name Type Description
unique_name str | None

Return None; collections have no unique name.

parameters list

All parameters from all items in this collection.

as_cif str

Return CIF representation of this object.

names list[str | None]

List of all item keys in the collection.

scalar_descriptors list

Collection-level descriptors serialized outside the loop.

Attributes
unique_name property

Return None; collections have no unique name.

parameters property

All parameters from all items in this collection.

as_cif property

Return CIF representation of this object.

names property

List of all item keys in the collection.

scalar_descriptors property

Collection-level descriptors serialized outside the loop.

Functions
create(*, source_kind, param_unique_name_i, param_unique_name_j, correlation, id=None)

Create a persisted fit-parameter correlation row.

Parameters:

Name Type Description Default
source_kind str

Origin of the persisted correlation summary.

required
param_unique_name_i str

First unique parameter name in the pair.

required
param_unique_name_j str

Second unique parameter name in the pair.

required
correlation float

Correlation coefficient for the parameter pair.

required
id str | None

Explicit persisted row identifier. When omitted, a simple sequential identifier is generated.

None
__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print a summary of public attributes and contained items.

__getitem__(key)

Return an item by name or positional index.

Parameters:

Name Type Description Default
key str | int

Identity key (str) or zero-based positional index (int).

required

Returns:

Type Description
GuardedBase

The item matching the given key or index.

Raises:

Type Description
TypeError

If key is neither str nor int.

__setitem__(name, item)

Insert or replace an item under the given identity key.

__delitem__(name)

Delete an item by key or raise KeyError if missing.

__contains__(name)

Check whether an item with the given key exists.

__iter__()

Iterate over items in insertion order.

__len__()

Return the number of items in the collection.

remove(name)

Remove an item by its key.

Parameters:

Name Type Description Default
name str

Identity key of the item to remove.

required
keys()

Yield keys for all items in insertion order.

values()

Yield items in insertion order.

items()

Yield (key, item) pairs in insertion order.

from_cif(block)

Populate this collection from a CIF block.

add(item)

Insert or replace a pre-built item into the collection.

Parameters:

Name Type Description Default
item object

A CategoryItem instance to add.

required
factory

Fit-parameter-correlation factory.

Classes:

Name Description
FitParameterCorrelationsFactory

Create fit-parameter correlation collections by tag.

Classes
FitParameterCorrelationsFactory

Create fit-parameter correlation collections by tag.

Methods:

Name Description
__init_subclass__

Give each subclass its own independent registry and rules.

register

Class decorator to register a concrete class.

supported_tags

Return list of all supported tags.

default_tag

Resolve the default tag for a given experimental context.

create

Instantiate a registered class by tag.

create_default_for

Instantiate the default class for a given context.

supported_for

Return classes matching conditions and/or calculator.

show_supported

Pretty-print a table of supported types.

Functions
__init_subclass__(**kwargs)

Give each subclass its own independent registry and rules.

register(klass) classmethod

Class decorator to register a concrete class.

Usage::

@SomeFactory.register class MyClass(SomeBase): type_info = TypeInfo(...)

Returns the class unmodified.

supported_tags() classmethod

Return list of all supported tags.

default_tag(**conditions) classmethod

Resolve the default tag for a given experimental context.

Uses largest-subset matching: the rule whose key is the biggest subset of the given conditions wins. A rule with an empty key (frozenset()) acts as a universal fallback.

Parameters:

Name Type Description Default
**conditions object

Experimental-axis values, e.g. scattering_type=ScatteringTypeEnum.BRAGG.

{}

Returns:

Type Description
str

The resolved default tag string.

Raises:

Type Description
ValueError

If no rule matches the given conditions.

create(tag, **kwargs) classmethod

Instantiate a registered class by tag.

Parameters:

Name Type Description Default
tag str

type_info.tag value.

required
**kwargs object

Forwarded to the class constructor.

{}

Returns:

Type Description
object

A new instance of the registered class.

Raises:

Type Description
ValueError

If tag is not in the registry.

create_default_for(**conditions) classmethod

Instantiate the default class for a given context.

Combines default_tag(**conditions) with create(tag).

Parameters:

Name Type Description Default
**conditions object

Experimental-axis values.

{}

Returns:

Type Description
object

A new instance of the default class.

supported_for(*, calculator=None, sample_form=None, scattering_type=None, beam_mode=None, radiation_probe=None) classmethod

Return classes matching conditions and/or calculator.

Parameters:

Name Type Description Default
calculator object

Optional CalculatorEnum value.

None
sample_form object

Optional SampleFormEnum value.

None
scattering_type object

Optional ScatteringTypeEnum value.

None
beam_mode object

Optional BeamModeEnum value.

None
radiation_probe object

Optional RadiationProbeEnum value.

None

Returns:

Type Description
list[type]

Classes matching the given conditions.

show_supported(*, calculator=None, sample_form=None, scattering_type=None, beam_mode=None, radiation_probe=None) classmethod

Pretty-print a table of supported types.

Parameters:

Name Type Description Default
calculator object

Optional CalculatorEnum filter.

None
sample_form object

Optional SampleFormEnum filter.

None
scattering_type object

Optional ScatteringTypeEnum filter.

None
beam_mode object

Optional BeamModeEnum filter.

None
radiation_probe object

Optional RadiationProbeEnum filter.

None
fit_parameters

Modules:

Name Description
default

Fit-parameter control snapshots.

factory

Fit-parameter factory.

Classes
Modules
default

Fit-parameter control snapshots.

Classes:

Name Description
FitParameterItem

Single persisted fit-parameter control row.

FitParameters

Collection of persisted fit-parameter control snapshots.

Classes
FitParameterItem()

Single persisted fit-parameter control row.

Methods:

Name Description
has_posterior_summary

Return whether any posterior summary field is populated.

posterior_summary

Return this row as a posterior summary, if populated.

__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print parameters, other properties, and methods.

from_cif

Populate this item from a CIF block.

Attributes:

Name Type Description
param_unique_name StringDescriptor

Unique name of the referenced live parameter.

fit_min NumericDescriptor

Persisted lower fit bound.

fit_max NumericDescriptor

Persisted upper fit bound.

fit_bounds_uncertainty_multiplier NumericDescriptor

Multiplier used to derive fit bounds from uncertainty.

start_value NumericDescriptor

Persisted pre-fit value snapshot.

start_uncertainty NumericDescriptor

Persisted pre-fit uncertainty snapshot.

posterior_best_sample_value NumericDescriptor

Highest-posterior sampled parameter value.

posterior_median NumericDescriptor

Posterior median value.

posterior_uncertainty NumericDescriptor

Posterior standard deviation.

posterior_interval_68_low NumericDescriptor

Lower bound of the 68% credible interval.

posterior_interval_68_high NumericDescriptor

Upper bound of the 68% credible interval.

posterior_interval_95_low NumericDescriptor

Lower bound of the 95% credible interval.

posterior_interval_95_high NumericDescriptor

Upper bound of the 95% credible interval.

posterior_gelman_rubin NumericDescriptor

Rank-normalized split-R-hat when available.

posterior_effective_sample_size_bulk NumericDescriptor

Bulk effective sample size when available.

unique_name str

Fully qualified name: datablock, category, entry.

parameters list

All GenericDescriptorBase instances on this item.

as_cif str

Return CIF representation of this object.

Attributes
param_unique_name property

Unique name of the referenced live parameter.

fit_min property

Persisted lower fit bound.

fit_max property

Persisted upper fit bound.

fit_bounds_uncertainty_multiplier property

Multiplier used to derive fit bounds from uncertainty.

start_value property

Persisted pre-fit value snapshot.

start_uncertainty property

Persisted pre-fit uncertainty snapshot.

posterior_best_sample_value property

Highest-posterior sampled parameter value.

posterior_median property

Posterior median value.

posterior_uncertainty property

Posterior standard deviation.

posterior_interval_68_low property

Lower bound of the 68% credible interval.

posterior_interval_68_high property

Upper bound of the 68% credible interval.

posterior_interval_95_low property

Lower bound of the 95% credible interval.

posterior_interval_95_high property

Upper bound of the 95% credible interval.

posterior_gelman_rubin property

Rank-normalized split-R-hat when available.

posterior_effective_sample_size_bulk property

Bulk effective sample size when available.

unique_name property

Fully qualified name: datablock, category, entry.

parameters property

All GenericDescriptorBase instances on this item.

as_cif property

Return CIF representation of this object.

Functions
has_posterior_summary()

Return whether any posterior summary field is populated.

posterior_summary(*, display_name)

Return this row as a posterior summary, if populated.

__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print parameters, other properties, and methods.

from_cif(block, idx=0)

Populate this item from a CIF block.

FitParameters()

Collection of persisted fit-parameter control snapshots.

Methods:

Name Description
create

Create a persisted fit-parameter control snapshot row.

set_posterior_summary

Attach a posterior summary to an existing row.

__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print a summary of public attributes and contained items.

__getitem__

Return an item by name or positional index.

__setitem__

Insert or replace an item under the given identity key.

__delitem__

Delete an item by key or raise KeyError if missing.

__contains__

Check whether an item with the given key exists.

__iter__

Iterate over items in insertion order.

__len__

Return the number of items in the collection.

remove

Remove an item by its key.

keys

Yield keys for all items in insertion order.

values

Yield items in insertion order.

items

Yield (key, item) pairs in insertion order.

from_cif

Populate this collection from a CIF block.

add

Insert or replace a pre-built item into the collection.

Attributes:

Name Type Description
unique_name str | None

Return None; collections have no unique name.

parameters list

All parameters from all items in this collection.

as_cif str

Return CIF representation of this object.

names list[str | None]

List of all item keys in the collection.

scalar_descriptors list

Collection-level descriptors serialized outside the loop.

Attributes
unique_name property

Return None; collections have no unique name.

parameters property

All parameters from all items in this collection.

as_cif property

Return CIF representation of this object.

names property

List of all item keys in the collection.

scalar_descriptors property

Collection-level descriptors serialized outside the loop.

Functions
create(*, param_unique_name, fit_min, fit_max, fit_bounds_uncertainty_multiplier=None, start_value=None, start_uncertainty=None)

Create a persisted fit-parameter control snapshot row.

Parameters:

Name Type Description Default
param_unique_name str

Unique name of the referenced live parameter.

required
fit_min float

Persisted lower fit bound.

required
fit_max float

Persisted upper fit bound.

required
fit_bounds_uncertainty_multiplier float | None

Multiplier used to derive fit bounds from uncertainty.

None
start_value float | None

Persisted pre-fit value snapshot.

None
start_uncertainty float | None

Persisted pre-fit uncertainty snapshot.

None
set_posterior_summary(summary)

Attach a posterior summary to an existing row.

__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print a summary of public attributes and contained items.

__getitem__(key)

Return an item by name or positional index.

Parameters:

Name Type Description Default
key str | int

Identity key (str) or zero-based positional index (int).

required

Returns:

Type Description
GuardedBase

The item matching the given key or index.

Raises:

Type Description
TypeError

If key is neither str nor int.

__setitem__(name, item)

Insert or replace an item under the given identity key.

__delitem__(name)

Delete an item by key or raise KeyError if missing.

__contains__(name)

Check whether an item with the given key exists.

__iter__()

Iterate over items in insertion order.

__len__()

Return the number of items in the collection.

remove(name)

Remove an item by its key.

Parameters:

Name Type Description Default
name str

Identity key of the item to remove.

required
keys()

Yield keys for all items in insertion order.

values()

Yield items in insertion order.

items()

Yield (key, item) pairs in insertion order.

from_cif(block)

Populate this collection from a CIF block.

add(item)

Insert or replace a pre-built item into the collection.

Parameters:

Name Type Description Default
item object

A CategoryItem instance to add.

required
factory

Fit-parameter factory.

Classes:

Name Description
FitParametersFactory

Create fit-parameter collections by tag.

Classes
FitParametersFactory

Create fit-parameter collections by tag.

Methods:

Name Description
__init_subclass__

Give each subclass its own independent registry and rules.

register

Class decorator to register a concrete class.

supported_tags

Return list of all supported tags.

default_tag

Resolve the default tag for a given experimental context.

create

Instantiate a registered class by tag.

create_default_for

Instantiate the default class for a given context.

supported_for

Return classes matching conditions and/or calculator.

show_supported

Pretty-print a table of supported types.

Functions
__init_subclass__(**kwargs)

Give each subclass its own independent registry and rules.

register(klass) classmethod

Class decorator to register a concrete class.

Usage::

@SomeFactory.register class MyClass(SomeBase): type_info = TypeInfo(...)

Returns the class unmodified.

supported_tags() classmethod

Return list of all supported tags.

default_tag(**conditions) classmethod

Resolve the default tag for a given experimental context.

Uses largest-subset matching: the rule whose key is the biggest subset of the given conditions wins. A rule with an empty key (frozenset()) acts as a universal fallback.

Parameters:

Name Type Description Default
**conditions object

Experimental-axis values, e.g. scattering_type=ScatteringTypeEnum.BRAGG.

{}

Returns:

Type Description
str

The resolved default tag string.

Raises:

Type Description
ValueError

If no rule matches the given conditions.

create(tag, **kwargs) classmethod

Instantiate a registered class by tag.

Parameters:

Name Type Description Default
tag str

type_info.tag value.

required
**kwargs object

Forwarded to the class constructor.

{}

Returns:

Type Description
object

A new instance of the registered class.

Raises:

Type Description
ValueError

If tag is not in the registry.

create_default_for(**conditions) classmethod

Instantiate the default class for a given context.

Combines default_tag(**conditions) with create(tag).

Parameters:

Name Type Description Default
**conditions object

Experimental-axis values.

{}

Returns:

Type Description
object

A new instance of the default class.

supported_for(*, calculator=None, sample_form=None, scattering_type=None, beam_mode=None, radiation_probe=None) classmethod

Return classes matching conditions and/or calculator.

Parameters:

Name Type Description Default
calculator object

Optional CalculatorEnum value.

None
sample_form object

Optional SampleFormEnum value.

None
scattering_type object

Optional ScatteringTypeEnum value.

None
beam_mode object

Optional BeamModeEnum value.

None
radiation_probe object

Optional RadiationProbeEnum value.

None

Returns:

Type Description
list[type]

Classes matching the given conditions.

show_supported(*, calculator=None, sample_form=None, scattering_type=None, beam_mode=None, radiation_probe=None) classmethod

Pretty-print a table of supported types.

Parameters:

Name Type Description Default
calculator object

Optional CalculatorEnum filter.

None
sample_form object

Optional SampleFormEnum filter.

None
scattering_type object

Optional ScatteringTypeEnum filter.

None
beam_mode object

Optional BeamModeEnum filter.

None
radiation_probe object

Optional RadiationProbeEnum filter.

None
fit_result

Modules:

Name Description
base

Common fit-result status category.

bayesian

Bayesian fit-result category.

default

Default fit-result category import.

factory

Fit-result factory.

lsq

Least-squares fit-result category.

Classes
Modules
base

Common fit-result status category.

Classes:

Name Description
FitResultBase

Common persisted fit-result status metadata.

Classes
FitResultBase()

Common persisted fit-result status metadata.

Methods:

Name Description
__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print parameters, other properties, and methods.

from_cif

Populate this item from a CIF block.

Attributes:

Name Type Description
result_kind EnumDescriptor

Kind of the latest persisted fit-result projection.

success BoolDescriptor

Whether the latest persisted fit-result projection succeeded.

message StringDescriptor

Status message for the latest persisted fit-result projection.

iterations IntegerDescriptor

Iteration count for the latest persisted fit-result projection.

fitting_time NumericDescriptor

Fitting time in seconds for the latest persisted projection.

reduced_chi_square NumericDescriptor

Reduced chi-square for the latest persisted projection.

unique_name str

Fully qualified name: datablock, category, entry.

parameters list

All GenericDescriptorBase instances on this item.

as_cif str

Return CIF representation of this object.

Attributes
result_kind property

Kind of the latest persisted fit-result projection.

success property

Whether the latest persisted fit-result projection succeeded.

message property

Status message for the latest persisted fit-result projection.

iterations property

Iteration count for the latest persisted fit-result projection.

fitting_time property

Fitting time in seconds for the latest persisted projection.

reduced_chi_square property

Reduced chi-square for the latest persisted projection.

unique_name property

Fully qualified name: datablock, category, entry.

parameters property

All GenericDescriptorBase instances on this item.

as_cif property

Return CIF representation of this object.

Functions
__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print parameters, other properties, and methods.

from_cif(block, idx=0)

Populate this item from a CIF block.

bayesian

Bayesian fit-result category.

Classes:

Name Description
BayesianFitResult

Persisted Bayesian fit-result metadata.

Classes
BayesianFitResult()

Persisted Bayesian fit-result metadata.

Methods:

Name Description
__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print parameters, other properties, and methods.

from_cif

Populate this item from a CIF block.

Attributes:

Name Type Description
point_estimate_name StringDescriptor

Committed sampled point estimate name.

sampler_completed BoolDescriptor

Whether the sampler completed and returned posterior data.

credible_interval_inner NumericDescriptor

Inner credible-interval level used in summaries.

credible_interval_outer NumericDescriptor

Outer credible-interval level used in summaries.

resolved_random_seed IntegerDescriptor

Runtime random seed used by the sampler.

acceptance_rate_mean NumericDescriptor

Mean sampler acceptance rate.

gelman_rubin_max NumericDescriptor

Maximum rank-normalized split R-hat.

effective_sample_size_min NumericDescriptor

Minimum bulk effective sample size.

best_log_posterior NumericDescriptor

Best log-posterior value found.

unique_name str

Fully qualified name: datablock, category, entry.

parameters list

All GenericDescriptorBase instances on this item.

as_cif str

Return CIF representation of this object.

result_kind EnumDescriptor

Kind of the latest persisted fit-result projection.

success BoolDescriptor

Whether the latest persisted fit-result projection succeeded.

message StringDescriptor

Status message for the latest persisted fit-result projection.

iterations IntegerDescriptor

Iteration count for the latest persisted fit-result projection.

fitting_time NumericDescriptor

Fitting time in seconds for the latest persisted projection.

reduced_chi_square NumericDescriptor

Reduced chi-square for the latest persisted projection.

Attributes
point_estimate_name property

Committed sampled point estimate name.

sampler_completed property

Whether the sampler completed and returned posterior data.

credible_interval_inner property

Inner credible-interval level used in summaries.

credible_interval_outer property

Outer credible-interval level used in summaries.

resolved_random_seed property

Runtime random seed used by the sampler.

acceptance_rate_mean property

Mean sampler acceptance rate.

gelman_rubin_max property

Maximum rank-normalized split R-hat.

effective_sample_size_min property

Minimum bulk effective sample size.

best_log_posterior property

Best log-posterior value found.

unique_name property

Fully qualified name: datablock, category, entry.

parameters property

All GenericDescriptorBase instances on this item.

as_cif property

Return CIF representation of this object.

result_kind property

Kind of the latest persisted fit-result projection.

success property

Whether the latest persisted fit-result projection succeeded.

message property

Status message for the latest persisted fit-result projection.

iterations property

Iteration count for the latest persisted fit-result projection.

fitting_time property

Fitting time in seconds for the latest persisted projection.

reduced_chi_square property

Reduced chi-square for the latest persisted projection.

Functions
__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print parameters, other properties, and methods.

from_cif(block, idx=0)

Populate this item from a CIF block.

default

Default fit-result category import.

Classes
factory

Fit-result factory.

Classes:

Name Description
FitResultFactory

Create fit-result categories by tag.

Classes
FitResultFactory

Create fit-result categories by tag.

Methods:

Name Description
__init_subclass__

Give each subclass its own independent registry and rules.

register

Class decorator to register a concrete class.

supported_tags

Return list of all supported tags.

default_tag

Resolve the default tag for a given experimental context.

create

Instantiate a registered class by tag.

create_default_for

Instantiate the default class for a given context.

supported_for

Return classes matching conditions and/or calculator.

show_supported

Pretty-print a table of supported types.

Functions
__init_subclass__(**kwargs)

Give each subclass its own independent registry and rules.

register(klass) classmethod

Class decorator to register a concrete class.

Usage::

@SomeFactory.register class MyClass(SomeBase): type_info = TypeInfo(...)

Returns the class unmodified.

supported_tags() classmethod

Return list of all supported tags.

default_tag(**conditions) classmethod

Resolve the default tag for a given experimental context.

Uses largest-subset matching: the rule whose key is the biggest subset of the given conditions wins. A rule with an empty key (frozenset()) acts as a universal fallback.

Parameters:

Name Type Description Default
**conditions object

Experimental-axis values, e.g. scattering_type=ScatteringTypeEnum.BRAGG.

{}

Returns:

Type Description
str

The resolved default tag string.

Raises:

Type Description
ValueError

If no rule matches the given conditions.

create(tag, **kwargs) classmethod

Instantiate a registered class by tag.

Parameters:

Name Type Description Default
tag str

type_info.tag value.

required
**kwargs object

Forwarded to the class constructor.

{}

Returns:

Type Description
object

A new instance of the registered class.

Raises:

Type Description
ValueError

If tag is not in the registry.

create_default_for(**conditions) classmethod

Instantiate the default class for a given context.

Combines default_tag(**conditions) with create(tag).

Parameters:

Name Type Description Default
**conditions object

Experimental-axis values.

{}

Returns:

Type Description
object

A new instance of the default class.

supported_for(*, calculator=None, sample_form=None, scattering_type=None, beam_mode=None, radiation_probe=None) classmethod

Return classes matching conditions and/or calculator.

Parameters:

Name Type Description Default
calculator object

Optional CalculatorEnum value.

None
sample_form object

Optional SampleFormEnum value.

None
scattering_type object

Optional ScatteringTypeEnum value.

None
beam_mode object

Optional BeamModeEnum value.

None
radiation_probe object

Optional RadiationProbeEnum value.

None

Returns:

Type Description
list[type]

Classes matching the given conditions.

show_supported(*, calculator=None, sample_form=None, scattering_type=None, beam_mode=None, radiation_probe=None) classmethod

Pretty-print a table of supported types.

Parameters:

Name Type Description Default
calculator object

Optional CalculatorEnum filter.

None
sample_form object

Optional SampleFormEnum filter.

None
scattering_type object

Optional ScatteringTypeEnum filter.

None
beam_mode object

Optional BeamModeEnum filter.

None
radiation_probe object

Optional RadiationProbeEnum filter.

None
lsq

Least-squares fit-result category.

Classes:

Name Description
LeastSquaresFitResult

Persisted least-squares fit-result metadata.

Classes
LeastSquaresFitResult()

Persisted least-squares fit-result metadata.

Methods:

Name Description
__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print parameters, other properties, and methods.

from_cif

Populate this item from a CIF block.

Attributes:

Name Type Description
unique_name str

Fully qualified name: datablock, category, entry.

parameters list

All GenericDescriptorBase instances on this item.

as_cif str

Return CIF representation of this object.

result_kind EnumDescriptor

Kind of the latest persisted fit-result projection.

success BoolDescriptor

Whether the latest persisted fit-result projection succeeded.

message StringDescriptor

Status message for the latest persisted fit-result projection.

iterations IntegerDescriptor

Iteration count for the latest persisted fit-result projection.

fitting_time NumericDescriptor

Fitting time in seconds for the latest persisted projection.

reduced_chi_square NumericDescriptor

Reduced chi-square for the latest persisted projection.

prof_r_factor NumericDescriptor

Profile R factor for powder fits.

prof_wr_factor NumericDescriptor

Weighted profile R factor for powder fits.

prof_wr_expected NumericDescriptor

Expected weighted profile R factor for powder fits.

number_restraints NumericDescriptor

Number of restraints used in the deterministic fit.

number_constraints NumericDescriptor

Number of constraints used in the deterministic fit.

shift_over_su_max NumericDescriptor

Maximum absolute parameter shift divided by s.u.

shift_over_su_mean NumericDescriptor

Mean absolute parameter shift divided by s.u.

profile_function StringDescriptor

Active profile function names.

background_function StringDescriptor

Active background function names.

r_factor_all NumericDescriptor

R factor for all observed data.

wr_factor_all NumericDescriptor

Weighted R factor for all observed data.

r_factor_gt NumericDescriptor

R factor for observations above the threshold.

wr_factor_gt NumericDescriptor

Weighted R factor for observations above the threshold.

threshold_expression StringDescriptor

Expression defining the observed-reflection threshold.

number_reflns_total NumericDescriptor

Total number of reflections represented in the fit.

number_reflns_gt NumericDescriptor

Number of reflections above the observed threshold.

objective_name StringDescriptor

Objective function name for the persisted deterministic fit.

objective_value NumericDescriptor

Objective value for the persisted deterministic fit.

n_data_points NumericDescriptor

Number of data points used in the persisted deterministic fit.

n_parameters NumericDescriptor

Number of parameters in the persisted deterministic fit.

n_free_parameters NumericDescriptor

Number of free parameters in the persisted deterministic fit.

degrees_of_freedom NumericDescriptor

Degrees of freedom for the persisted deterministic fit.

covariance_available BoolDescriptor

Whether deterministic covariance was available.

correlation_available BoolDescriptor

Whether deterministic correlations were available.

exit_reason StringDescriptor

Backend exit reason for the persisted deterministic fit.

Attributes
unique_name property

Fully qualified name: datablock, category, entry.

parameters property

All GenericDescriptorBase instances on this item.

as_cif property

Return CIF representation of this object.

result_kind property

Kind of the latest persisted fit-result projection.

success property

Whether the latest persisted fit-result projection succeeded.

message property

Status message for the latest persisted fit-result projection.

iterations property

Iteration count for the latest persisted fit-result projection.

fitting_time property

Fitting time in seconds for the latest persisted projection.

reduced_chi_square property

Reduced chi-square for the latest persisted projection.

prof_r_factor property

Profile R factor for powder fits.

prof_wr_factor property

Weighted profile R factor for powder fits.

prof_wr_expected property

Expected weighted profile R factor for powder fits.

number_restraints property

Number of restraints used in the deterministic fit.

number_constraints property

Number of constraints used in the deterministic fit.

shift_over_su_max property

Maximum absolute parameter shift divided by s.u.

shift_over_su_mean property

Mean absolute parameter shift divided by s.u.

profile_function property

Active profile function names.

background_function property

Active background function names.

r_factor_all property

R factor for all observed data.

wr_factor_all property

Weighted R factor for all observed data.

r_factor_gt property

R factor for observations above the threshold.

wr_factor_gt property

Weighted R factor for observations above the threshold.

threshold_expression property

Expression defining the observed-reflection threshold.

number_reflns_total property

Total number of reflections represented in the fit.

number_reflns_gt property

Number of reflections above the observed threshold.

objective_name property

Objective function name for the persisted deterministic fit.

objective_value property

Objective value for the persisted deterministic fit.

n_data_points property

Number of data points used in the persisted deterministic fit.

n_parameters property

Number of parameters in the persisted deterministic fit.

n_free_parameters property

Number of free parameters in the persisted deterministic fit.

degrees_of_freedom property

Degrees of freedom for the persisted deterministic fit.

covariance_available property

Whether deterministic covariance was available.

correlation_available property

Whether deterministic correlations were available.

exit_reason property

Backend exit reason for the persisted deterministic fit.

Functions
__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print parameters, other properties, and methods.

from_cif(block, idx=0)

Populate this item from a CIF block.

fitting_mode

Analysis fitting-mode category exports.

Modules:

Name Description
default

Analysis fitting-mode category.

factory

Factory for analysis fitting-mode categories.

Classes
Modules
default

Analysis fitting-mode category.

Classes:

Name Description
FittingMode

Fitting-mode selector for an analysis.

Classes
FittingMode()

Fitting-mode selector for an analysis.

Methods:

Name Description
show_supported

Print supported types and mark the active one.

__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print parameters, other properties, and methods.

from_cif

Populate this item from a CIF block.

Attributes:

Name Type Description
type str

Active factory tag for this category.

unique_name str

Fully qualified name: datablock, category, entry.

parameters list

All GenericDescriptorBase instances on this item.

as_cif str

Return CIF representation of this object.

Attributes
type property writable

Active factory tag for this category.

unique_name property

Fully qualified name: datablock, category, entry.

parameters property

All GenericDescriptorBase instances on this item.

as_cif property

Return CIF representation of this object.

Functions
show_supported()

Print supported types and mark the active one.

__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print parameters, other properties, and methods.

from_cif(block, idx=0)

Populate this item from a CIF block.

factory

Factory for analysis fitting-mode categories.

Classes:

Name Description
FittingModeFactory

Create analysis fitting-mode category instances.

Classes
FittingModeFactory

Create analysis fitting-mode category instances.

Methods:

Name Description
__init_subclass__

Give each subclass its own independent registry and rules.

register

Class decorator to register a concrete class.

supported_tags

Return list of all supported tags.

default_tag

Resolve the default tag for a given experimental context.

create

Instantiate a registered class by tag.

create_default_for

Instantiate the default class for a given context.

supported_for

Return classes matching conditions and/or calculator.

show_supported

Pretty-print a table of supported types.

Functions
__init_subclass__(**kwargs)

Give each subclass its own independent registry and rules.

register(klass) classmethod

Class decorator to register a concrete class.

Usage::

@SomeFactory.register class MyClass(SomeBase): type_info = TypeInfo(...)

Returns the class unmodified.

supported_tags() classmethod

Return list of all supported tags.

default_tag(**conditions) classmethod

Resolve the default tag for a given experimental context.

Uses largest-subset matching: the rule whose key is the biggest subset of the given conditions wins. A rule with an empty key (frozenset()) acts as a universal fallback.

Parameters:

Name Type Description Default
**conditions object

Experimental-axis values, e.g. scattering_type=ScatteringTypeEnum.BRAGG.

{}

Returns:

Type Description
str

The resolved default tag string.

Raises:

Type Description
ValueError

If no rule matches the given conditions.

create(tag, **kwargs) classmethod

Instantiate a registered class by tag.

Parameters:

Name Type Description Default
tag str

type_info.tag value.

required
**kwargs object

Forwarded to the class constructor.

{}

Returns:

Type Description
object

A new instance of the registered class.

Raises:

Type Description
ValueError

If tag is not in the registry.

create_default_for(**conditions) classmethod

Instantiate the default class for a given context.

Combines default_tag(**conditions) with create(tag).

Parameters:

Name Type Description Default
**conditions object

Experimental-axis values.

{}

Returns:

Type Description
object

A new instance of the default class.

supported_for(*, calculator=None, sample_form=None, scattering_type=None, beam_mode=None, radiation_probe=None) classmethod

Return classes matching conditions and/or calculator.

Parameters:

Name Type Description Default
calculator object

Optional CalculatorEnum value.

None
sample_form object

Optional SampleFormEnum value.

None
scattering_type object

Optional ScatteringTypeEnum value.

None
beam_mode object

Optional BeamModeEnum value.

None
radiation_probe object

Optional RadiationProbeEnum value.

None

Returns:

Type Description
list[type]

Classes matching the given conditions.

show_supported(*, calculator=None, sample_form=None, scattering_type=None, beam_mode=None, radiation_probe=None) classmethod

Pretty-print a table of supported types.

Parameters:

Name Type Description Default
calculator object

Optional CalculatorEnum filter.

None
sample_form object

Optional SampleFormEnum filter.

None
scattering_type object

Optional ScatteringTypeEnum filter.

None
beam_mode object

Optional BeamModeEnum filter.

None
radiation_probe object

Optional RadiationProbeEnum filter.

None
joint_fit

Modules:

Name Description
default

Joint-fit weighting configuration.

factory

Joint-fit factory - delegates to FactoryBase.

Classes
Modules
default

Joint-fit weighting configuration.

Stores per-experiment weights to be used when multiple experiments are fitted simultaneously.

Classes:

Name Description
JointFitItem

A single joint-fit entry.

JointFitCollection

Collection of :class:JointFitItem items.

Classes
JointFitItem()

A single joint-fit entry.

Methods:

Name Description
__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print parameters, other properties, and methods.

from_cif

Populate this item from a CIF block.

Attributes:

Name Type Description
experiment_id StringDescriptor

Experiment identifier.

weight NumericDescriptor

Weight factor.

unique_name str

Fully qualified name: datablock, category, entry.

parameters list

All GenericDescriptorBase instances on this item.

as_cif str

Return CIF representation of this object.

Attributes
experiment_id property writable

Experiment identifier.

Reading this property returns the underlying StringDescriptor object. Assigning to it updates the parameter value.

weight property writable

Weight factor.

Reading this property returns the underlying NumericDescriptor object. Assigning to it updates the parameter value.

unique_name property

Fully qualified name: datablock, category, entry.

parameters property

All GenericDescriptorBase instances on this item.

as_cif property

Return CIF representation of this object.

Functions
__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print parameters, other properties, and methods.

from_cif(block, idx=0)

Populate this item from a CIF block.

JointFitCollection()

Collection of :class:JointFitItem items.

Methods:

Name Description
__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print a summary of public attributes and contained items.

__getitem__

Return an item by name or positional index.

__setitem__

Insert or replace an item under the given identity key.

__delitem__

Delete an item by key or raise KeyError if missing.

__contains__

Check whether an item with the given key exists.

__iter__

Iterate over items in insertion order.

__len__

Return the number of items in the collection.

remove

Remove an item by its key.

keys

Yield keys for all items in insertion order.

values

Yield items in insertion order.

items

Yield (key, item) pairs in insertion order.

from_cif

Populate this collection from a CIF block.

add

Insert or replace a pre-built item into the collection.

create

Create a new item with the given attributes and add it.

Attributes:

Name Type Description
unique_name str | None

Return None; collections have no unique name.

parameters list

All parameters from all items in this collection.

as_cif str

Return CIF representation of this object.

names list[str | None]

List of all item keys in the collection.

scalar_descriptors list

Collection-level descriptors serialized outside the loop.

Attributes
unique_name property

Return None; collections have no unique name.

parameters property

All parameters from all items in this collection.

as_cif property

Return CIF representation of this object.

names property

List of all item keys in the collection.

scalar_descriptors property

Collection-level descriptors serialized outside the loop.

Functions
__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print a summary of public attributes and contained items.

__getitem__(key)

Return an item by name or positional index.

Parameters:

Name Type Description Default
key str | int

Identity key (str) or zero-based positional index (int).

required

Returns:

Type Description
GuardedBase

The item matching the given key or index.

Raises:

Type Description
TypeError

If key is neither str nor int.

__setitem__(name, item)

Insert or replace an item under the given identity key.

__delitem__(name)

Delete an item by key or raise KeyError if missing.

__contains__(name)

Check whether an item with the given key exists.

__iter__()

Iterate over items in insertion order.

__len__()

Return the number of items in the collection.

remove(name)

Remove an item by its key.

Parameters:

Name Type Description Default
name str

Identity key of the item to remove.

required
keys()

Yield keys for all items in insertion order.

values()

Yield items in insertion order.

items()

Yield (key, item) pairs in insertion order.

from_cif(block)

Populate this collection from a CIF block.

add(item)

Insert or replace a pre-built item into the collection.

Parameters:

Name Type Description Default
item object

A CategoryItem instance to add.

required
create(**kwargs)

Create a new item with the given attributes and add it.

A default instance of the collection's item type is created, then each keyword argument is applied via setattr.

Parameters:

Name Type Description Default
**kwargs object

Attribute names and values for the new item.

{}
factory

Joint-fit factory - delegates to FactoryBase.

Classes:

Name Description
JointFitFactory

Create joint-fit collections by tag.

Classes
JointFitFactory

Create joint-fit collections by tag.

Methods:

Name Description
__init_subclass__

Give each subclass its own independent registry and rules.

register

Class decorator to register a concrete class.

supported_tags

Return list of all supported tags.

default_tag

Resolve the default tag for a given experimental context.

create

Instantiate a registered class by tag.

create_default_for

Instantiate the default class for a given context.

supported_for

Return classes matching conditions and/or calculator.

show_supported

Pretty-print a table of supported types.

Functions
__init_subclass__(**kwargs)

Give each subclass its own independent registry and rules.

register(klass) classmethod

Class decorator to register a concrete class.

Usage::

@SomeFactory.register class MyClass(SomeBase): type_info = TypeInfo(...)

Returns the class unmodified.

supported_tags() classmethod

Return list of all supported tags.

default_tag(**conditions) classmethod

Resolve the default tag for a given experimental context.

Uses largest-subset matching: the rule whose key is the biggest subset of the given conditions wins. A rule with an empty key (frozenset()) acts as a universal fallback.

Parameters:

Name Type Description Default
**conditions object

Experimental-axis values, e.g. scattering_type=ScatteringTypeEnum.BRAGG.

{}

Returns:

Type Description
str

The resolved default tag string.

Raises:

Type Description
ValueError

If no rule matches the given conditions.

create(tag, **kwargs) classmethod

Instantiate a registered class by tag.

Parameters:

Name Type Description Default
tag str

type_info.tag value.

required
**kwargs object

Forwarded to the class constructor.

{}

Returns:

Type Description
object

A new instance of the registered class.

Raises:

Type Description
ValueError

If tag is not in the registry.

create_default_for(**conditions) classmethod

Instantiate the default class for a given context.

Combines default_tag(**conditions) with create(tag).

Parameters:

Name Type Description Default
**conditions object

Experimental-axis values.

{}

Returns:

Type Description
object

A new instance of the default class.

supported_for(*, calculator=None, sample_form=None, scattering_type=None, beam_mode=None, radiation_probe=None) classmethod

Return classes matching conditions and/or calculator.

Parameters:

Name Type Description Default
calculator object

Optional CalculatorEnum value.

None
sample_form object

Optional SampleFormEnum value.

None
scattering_type object

Optional ScatteringTypeEnum value.

None
beam_mode object

Optional BeamModeEnum value.

None
radiation_probe object

Optional RadiationProbeEnum value.

None

Returns:

Type Description
list[type]

Classes matching the given conditions.

show_supported(*, calculator=None, sample_form=None, scattering_type=None, beam_mode=None, radiation_probe=None) classmethod

Pretty-print a table of supported types.

Parameters:

Name Type Description Default
calculator object

Optional CalculatorEnum filter.

None
sample_form object

Optional SampleFormEnum filter.

None
scattering_type object

Optional ScatteringTypeEnum filter.

None
beam_mode object

Optional BeamModeEnum filter.

None
radiation_probe object

Optional RadiationProbeEnum filter.

None
minimizer

Minimizer category implementations.

Modules:

Name Description
base

Base class for persisted minimizer category items.

bayesian_base

Behavior helpers for Bayesian minimizer categories.

bumps

Persisted category for the default BUMPS minimizer.

bumps_amoeba

Persisted category for the BUMPS amoeba minimizer.

bumps_de

Persisted category for the BUMPS de minimizer.

bumps_dream

Persisted category for the BUMPS DREAM minimizer.

bumps_lm

Persisted category for the BUMPS lm minimizer.

dfols

Persisted category for the DFO-LS minimizer.

emcee

Persisted category for the emcee minimizer.

factory

Factory for persisted minimizer category items.

lmfit

Persisted category for the default LMFIT minimizer.

lmfit_least_squares

Persisted category for the LMFIT least_squares minimizer.

lmfit_leastsq

Persisted category for the LMFIT leastsq minimizer.

lsq_base

Behavior helpers for deterministic minimizer categories.

Classes
Modules
base

Base class for persisted minimizer category items.

Classes:

Name Description
MinimizerCategoryBase

Base class for persisted minimizer settings and results.

Classes
MinimizerCategoryBase()

Base class for persisted minimizer settings and results.

Methods:

Name Description
show_supported

Print supported types and mark the active one.

__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print parameters, other properties, and methods.

from_cif

Populate this item from a CIF block.

Attributes:

Name Type Description
type str

Active factory tag for this category.

unique_name str

Fully qualified name: datablock, category, entry.

parameters list

All GenericDescriptorBase instances on this item.

as_cif str

Return CIF representation of this object.

Attributes
type property writable

Active factory tag for this category.

unique_name property

Fully qualified name: datablock, category, entry.

parameters property

All GenericDescriptorBase instances on this item.

as_cif property

Return CIF representation of this object.

Functions
show_supported()

Print supported types and mark the active one.

__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print parameters, other properties, and methods.

from_cif(block, idx=0)

Populate this item from a CIF block.

bayesian_base

Behavior helpers for Bayesian minimizer categories.

Classes:

Name Description
BayesianMinimizerBase

Shared behavior for Bayesian minimizer categories.

Classes
BayesianMinimizerBase()

Shared behavior for Bayesian minimizer categories.

Methods:

Name Description
show_supported

Print supported types and mark the active one.

__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print parameters, other properties, and methods.

from_cif

Populate this item from a CIF block.

Attributes:

Name Type Description
sampling_steps IntegerDescriptor

Total sampler iterations per chain.

burn_in_steps IntegerDescriptor

Sampler iterations discarded as warm-up.

thinning_interval IntegerDescriptor

Sampler thinning interval.

population_size IntegerDescriptor

Number of chains or walkers.

parallel_workers IntegerDescriptor

Worker count; 0 uses all available CPUs.

initialization_method StringDescriptor

Sampler initialization method.

random_seed IntegerDescriptor

Random seed; None uses a system-derived seed.

type str

Active factory tag for this category.

unique_name str

Fully qualified name: datablock, category, entry.

parameters list

All GenericDescriptorBase instances on this item.

as_cif str

Return CIF representation of this object.

Attributes
sampling_steps property writable

Total sampler iterations per chain.

burn_in_steps property writable

Sampler iterations discarded as warm-up.

thinning_interval property writable

Sampler thinning interval.

population_size property writable

Number of chains or walkers.

parallel_workers property writable

Worker count; 0 uses all available CPUs.

initialization_method property writable

Sampler initialization method.

random_seed property writable

Random seed; None uses a system-derived seed.

type property writable

Active factory tag for this category.

unique_name property

Fully qualified name: datablock, category, entry.

parameters property

All GenericDescriptorBase instances on this item.

as_cif property

Return CIF representation of this object.

Functions
show_supported()

Print supported types and mark the active one.

__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print parameters, other properties, and methods.

from_cif(block, idx=0)

Populate this item from a CIF block.

bumps

Persisted category for the default BUMPS minimizer.

Classes:

Name Description
BumpsMinimizer

Persisted settings for the default BUMPS minimizer.

Classes
BumpsMinimizer()

Persisted settings for the default BUMPS minimizer.

Methods:

Name Description
show_supported

Print supported types and mark the active one.

__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print parameters, other properties, and methods.

from_cif

Populate this item from a CIF block.

Attributes:

Name Type Description
type str

Active factory tag for this category.

unique_name str

Fully qualified name: datablock, category, entry.

parameters list

All GenericDescriptorBase instances on this item.

as_cif str

Return CIF representation of this object.

max_iterations IntegerDescriptor

Maximum solver iterations.

Attributes
type property writable

Active factory tag for this category.

unique_name property

Fully qualified name: datablock, category, entry.

parameters property

All GenericDescriptorBase instances on this item.

as_cif property

Return CIF representation of this object.

max_iterations property writable

Maximum solver iterations.

Functions
show_supported()

Print supported types and mark the active one.

__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print parameters, other properties, and methods.

from_cif(block, idx=0)

Populate this item from a CIF block.

bumps_amoeba

Persisted category for the BUMPS amoeba minimizer.

Classes:

Name Description
BumpsAmoebaMinimizer

Persisted settings for the BUMPS amoeba minimizer.

Classes
BumpsAmoebaMinimizer()

Persisted settings for the BUMPS amoeba minimizer.

Methods:

Name Description
show_supported

Print supported types and mark the active one.

__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print parameters, other properties, and methods.

from_cif

Populate this item from a CIF block.

Attributes:

Name Type Description
type str

Active factory tag for this category.

unique_name str

Fully qualified name: datablock, category, entry.

parameters list

All GenericDescriptorBase instances on this item.

as_cif str

Return CIF representation of this object.

max_iterations IntegerDescriptor

Maximum solver iterations.

Attributes
type property writable

Active factory tag for this category.

unique_name property

Fully qualified name: datablock, category, entry.

parameters property

All GenericDescriptorBase instances on this item.

as_cif property

Return CIF representation of this object.

max_iterations property writable

Maximum solver iterations.

Functions
show_supported()

Print supported types and mark the active one.

__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print parameters, other properties, and methods.

from_cif(block, idx=0)

Populate this item from a CIF block.

bumps_de

Persisted category for the BUMPS de minimizer.

Classes:

Name Description
BumpsDeMinimizer

Persisted settings for the BUMPS de minimizer.

Classes
BumpsDeMinimizer()

Persisted settings for the BUMPS de minimizer.

Methods:

Name Description
show_supported

Print supported types and mark the active one.

__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print parameters, other properties, and methods.

from_cif

Populate this item from a CIF block.

Attributes:

Name Type Description
type str

Active factory tag for this category.

unique_name str

Fully qualified name: datablock, category, entry.

parameters list

All GenericDescriptorBase instances on this item.

as_cif str

Return CIF representation of this object.

max_iterations IntegerDescriptor

Maximum solver iterations.

Attributes
type property writable

Active factory tag for this category.

unique_name property

Fully qualified name: datablock, category, entry.

parameters property

All GenericDescriptorBase instances on this item.

as_cif property

Return CIF representation of this object.

max_iterations property writable

Maximum solver iterations.

Functions
show_supported()

Print supported types and mark the active one.

__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print parameters, other properties, and methods.

from_cif(block, idx=0)

Populate this item from a CIF block.

bumps_dream

Persisted category for the BUMPS DREAM minimizer.

Classes:

Name Description
BumpsDreamMinimizer

Persisted settings for the BUMPS DREAM minimizer.

Classes
BumpsDreamMinimizer()

Persisted settings for the BUMPS DREAM minimizer.

Methods:

Name Description
show_supported

Print supported types and mark the active one.

__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print parameters, other properties, and methods.

from_cif

Populate this item from a CIF block.

Attributes:

Name Type Description
type str

Active factory tag for this category.

unique_name str

Fully qualified name: datablock, category, entry.

parameters list

All GenericDescriptorBase instances on this item.

as_cif str

Return CIF representation of this object.

sampling_steps IntegerDescriptor

Total sampler iterations per chain.

burn_in_steps IntegerDescriptor

Sampler iterations discarded as warm-up.

thinning_interval IntegerDescriptor

Sampler thinning interval.

population_size IntegerDescriptor

Number of chains or walkers.

parallel_workers IntegerDescriptor

Worker count; 0 uses all available CPUs.

initialization_method StringDescriptor

Sampler initialization method.

random_seed IntegerDescriptor

Random seed; None uses a system-derived seed.

Attributes
type property writable

Active factory tag for this category.

unique_name property

Fully qualified name: datablock, category, entry.

parameters property

All GenericDescriptorBase instances on this item.

as_cif property

Return CIF representation of this object.

sampling_steps property writable

Total sampler iterations per chain.

burn_in_steps property writable

Sampler iterations discarded as warm-up.

thinning_interval property writable

Sampler thinning interval.

population_size property writable

Number of chains or walkers.

parallel_workers property writable

Worker count; 0 uses all available CPUs.

initialization_method property writable

Sampler initialization method.

random_seed property writable

Random seed; None uses a system-derived seed.

Functions
show_supported()

Print supported types and mark the active one.

__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print parameters, other properties, and methods.

from_cif(block, idx=0)

Populate this item from a CIF block.

bumps_lm

Persisted category for the BUMPS lm minimizer.

Classes:

Name Description
BumpsLmMinimizer

Persisted settings for the BUMPS lm minimizer.

Classes
BumpsLmMinimizer()

Persisted settings for the BUMPS lm minimizer.

Methods:

Name Description
show_supported

Print supported types and mark the active one.

__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print parameters, other properties, and methods.

from_cif

Populate this item from a CIF block.

Attributes:

Name Type Description
type str

Active factory tag for this category.

unique_name str

Fully qualified name: datablock, category, entry.

parameters list

All GenericDescriptorBase instances on this item.

as_cif str

Return CIF representation of this object.

max_iterations IntegerDescriptor

Maximum solver iterations.

Attributes
type property writable

Active factory tag for this category.

unique_name property

Fully qualified name: datablock, category, entry.

parameters property

All GenericDescriptorBase instances on this item.

as_cif property

Return CIF representation of this object.

max_iterations property writable

Maximum solver iterations.

Functions
show_supported()

Print supported types and mark the active one.

__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print parameters, other properties, and methods.

from_cif(block, idx=0)

Populate this item from a CIF block.

dfols

Persisted category for the DFO-LS minimizer.

Classes:

Name Description
DfolsMinimizer

Persisted settings for the DFO-LS minimizer.

Classes
DfolsMinimizer()

Persisted settings for the DFO-LS minimizer.

Methods:

Name Description
show_supported

Print supported types and mark the active one.

__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print parameters, other properties, and methods.

from_cif

Populate this item from a CIF block.

Attributes:

Name Type Description
type str

Active factory tag for this category.

unique_name str

Fully qualified name: datablock, category, entry.

parameters list

All GenericDescriptorBase instances on this item.

as_cif str

Return CIF representation of this object.

max_iterations IntegerDescriptor

Maximum solver iterations.

Attributes
type property writable

Active factory tag for this category.

unique_name property

Fully qualified name: datablock, category, entry.

parameters property

All GenericDescriptorBase instances on this item.

as_cif property

Return CIF representation of this object.

max_iterations property writable

Maximum solver iterations.

Functions
show_supported()

Print supported types and mark the active one.

__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print parameters, other properties, and methods.

from_cif(block, idx=0)

Populate this item from a CIF block.

emcee

Persisted category for the emcee minimizer.

Classes:

Name Description
EmceeMinimizer

Persisted settings for the emcee minimizer.

Classes
EmceeMinimizer()

Persisted settings for the emcee minimizer.

Methods:

Name Description
show_supported

Print supported types and mark the active one.

__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print parameters, other properties, and methods.

from_cif

Populate this item from a CIF block.

Attributes:

Name Type Description
proposal_moves StringDescriptor

Single emcee proposal move.

type str

Active factory tag for this category.

unique_name str

Fully qualified name: datablock, category, entry.

parameters list

All GenericDescriptorBase instances on this item.

as_cif str

Return CIF representation of this object.

sampling_steps IntegerDescriptor

Total sampler iterations per chain.

burn_in_steps IntegerDescriptor

Sampler iterations discarded as warm-up.

thinning_interval IntegerDescriptor

Sampler thinning interval.

population_size IntegerDescriptor

Number of chains or walkers.

parallel_workers IntegerDescriptor

Worker count; 0 uses all available CPUs.

initialization_method StringDescriptor

Sampler initialization method.

random_seed IntegerDescriptor

Random seed; None uses a system-derived seed.

Attributes
proposal_moves property writable

Single emcee proposal move.

type property writable

Active factory tag for this category.

unique_name property

Fully qualified name: datablock, category, entry.

parameters property

All GenericDescriptorBase instances on this item.

as_cif property

Return CIF representation of this object.

sampling_steps property writable

Total sampler iterations per chain.

burn_in_steps property writable

Sampler iterations discarded as warm-up.

thinning_interval property writable

Sampler thinning interval.

population_size property writable

Number of chains or walkers.

parallel_workers property writable

Worker count; 0 uses all available CPUs.

initialization_method property writable

Sampler initialization method.

random_seed property writable

Random seed; None uses a system-derived seed.

Functions
show_supported()

Print supported types and mark the active one.

__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print parameters, other properties, and methods.

from_cif(block, idx=0)

Populate this item from a CIF block.

factory

Factory for persisted minimizer category items.

Classes:

Name Description
MinimizerCategoryFactory

Create minimizer category items by tag.

Classes
MinimizerCategoryFactory

Create minimizer category items by tag.

Methods:

Name Description
__init_subclass__

Give each subclass its own independent registry and rules.

register

Class decorator to register a concrete class.

supported_tags

Return list of all supported tags.

default_tag

Resolve the default tag for a given experimental context.

create

Instantiate a registered class by tag.

create_default_for

Instantiate the default class for a given context.

supported_for

Return classes matching conditions and/or calculator.

show_supported

Pretty-print a table of supported types.

Functions
__init_subclass__(**kwargs)

Give each subclass its own independent registry and rules.

register(klass) classmethod

Class decorator to register a concrete class.

Usage::

@SomeFactory.register class MyClass(SomeBase): type_info = TypeInfo(...)

Returns the class unmodified.

supported_tags() classmethod

Return list of all supported tags.

default_tag(**conditions) classmethod

Resolve the default tag for a given experimental context.

Uses largest-subset matching: the rule whose key is the biggest subset of the given conditions wins. A rule with an empty key (frozenset()) acts as a universal fallback.

Parameters:

Name Type Description Default
**conditions object

Experimental-axis values, e.g. scattering_type=ScatteringTypeEnum.BRAGG.

{}

Returns:

Type Description
str

The resolved default tag string.

Raises:

Type Description
ValueError

If no rule matches the given conditions.

create(tag, **kwargs) classmethod

Instantiate a registered class by tag.

Parameters:

Name Type Description Default
tag str

type_info.tag value.

required
**kwargs object

Forwarded to the class constructor.

{}

Returns:

Type Description
object

A new instance of the registered class.

Raises:

Type Description
ValueError

If tag is not in the registry.

create_default_for(**conditions) classmethod

Instantiate the default class for a given context.

Combines default_tag(**conditions) with create(tag).

Parameters:

Name Type Description Default
**conditions object

Experimental-axis values.

{}

Returns:

Type Description
object

A new instance of the default class.

supported_for(*, calculator=None, sample_form=None, scattering_type=None, beam_mode=None, radiation_probe=None) classmethod

Return classes matching conditions and/or calculator.

Parameters:

Name Type Description Default
calculator object

Optional CalculatorEnum value.

None
sample_form object

Optional SampleFormEnum value.

None
scattering_type object

Optional ScatteringTypeEnum value.

None
beam_mode object

Optional BeamModeEnum value.

None
radiation_probe object

Optional RadiationProbeEnum value.

None

Returns:

Type Description
list[type]

Classes matching the given conditions.

show_supported(*, calculator=None, sample_form=None, scattering_type=None, beam_mode=None, radiation_probe=None) classmethod

Pretty-print a table of supported types.

Parameters:

Name Type Description Default
calculator object

Optional CalculatorEnum filter.

None
sample_form object

Optional SampleFormEnum filter.

None
scattering_type object

Optional ScatteringTypeEnum filter.

None
beam_mode object

Optional BeamModeEnum filter.

None
radiation_probe object

Optional RadiationProbeEnum filter.

None
lmfit

Persisted category for the default LMFIT minimizer.

Classes:

Name Description
LmfitMinimizer

Persisted settings for the default LMFIT minimizer.

Classes
LmfitMinimizer()

Persisted settings for the default LMFIT minimizer.

Methods:

Name Description
show_supported

Print supported types and mark the active one.

__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print parameters, other properties, and methods.

from_cif

Populate this item from a CIF block.

Attributes:

Name Type Description
type str

Active factory tag for this category.

unique_name str

Fully qualified name: datablock, category, entry.

parameters list

All GenericDescriptorBase instances on this item.

as_cif str

Return CIF representation of this object.

max_iterations IntegerDescriptor

Maximum solver iterations.

Attributes
type property writable

Active factory tag for this category.

unique_name property

Fully qualified name: datablock, category, entry.

parameters property

All GenericDescriptorBase instances on this item.

as_cif property

Return CIF representation of this object.

max_iterations property writable

Maximum solver iterations.

Functions
show_supported()

Print supported types and mark the active one.

__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print parameters, other properties, and methods.

from_cif(block, idx=0)

Populate this item from a CIF block.

lmfit_least_squares

Persisted category for the LMFIT least_squares minimizer.

Classes:

Name Description
LmfitLeastSquaresMinimizer

Persisted settings for the LMFIT least_squares minimizer.

Classes
LmfitLeastSquaresMinimizer()

Persisted settings for the LMFIT least_squares minimizer.

Methods:

Name Description
show_supported

Print supported types and mark the active one.

__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print parameters, other properties, and methods.

from_cif

Populate this item from a CIF block.

Attributes:

Name Type Description
type str

Active factory tag for this category.

unique_name str

Fully qualified name: datablock, category, entry.

parameters list

All GenericDescriptorBase instances on this item.

as_cif str

Return CIF representation of this object.

max_iterations IntegerDescriptor

Maximum solver iterations.

Attributes
type property writable

Active factory tag for this category.

unique_name property

Fully qualified name: datablock, category, entry.

parameters property

All GenericDescriptorBase instances on this item.

as_cif property

Return CIF representation of this object.

max_iterations property writable

Maximum solver iterations.

Functions
show_supported()

Print supported types and mark the active one.

__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print parameters, other properties, and methods.

from_cif(block, idx=0)

Populate this item from a CIF block.

lmfit_leastsq

Persisted category for the LMFIT leastsq minimizer.

Classes:

Name Description
LmfitLeastsqMinimizer

Persisted settings for the LMFIT leastsq minimizer.

Classes
LmfitLeastsqMinimizer()

Persisted settings for the LMFIT leastsq minimizer.

Methods:

Name Description
show_supported

Print supported types and mark the active one.

__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print parameters, other properties, and methods.

from_cif

Populate this item from a CIF block.

Attributes:

Name Type Description
type str

Active factory tag for this category.

unique_name str

Fully qualified name: datablock, category, entry.

parameters list

All GenericDescriptorBase instances on this item.

as_cif str

Return CIF representation of this object.

max_iterations IntegerDescriptor

Maximum solver iterations.

Attributes
type property writable

Active factory tag for this category.

unique_name property

Fully qualified name: datablock, category, entry.

parameters property

All GenericDescriptorBase instances on this item.

as_cif property

Return CIF representation of this object.

max_iterations property writable

Maximum solver iterations.

Functions
show_supported()

Print supported types and mark the active one.

__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print parameters, other properties, and methods.

from_cif(block, idx=0)

Populate this item from a CIF block.

lsq_base

Behavior helpers for deterministic minimizer categories.

Classes:

Name Description
LeastSquaresMinimizerBase

Shared behavior for least-squares minimizer categories.

Classes
LeastSquaresMinimizerBase()

Shared behavior for least-squares minimizer categories.

Methods:

Name Description
show_supported

Print supported types and mark the active one.

__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print parameters, other properties, and methods.

from_cif

Populate this item from a CIF block.

Attributes:

Name Type Description
max_iterations IntegerDescriptor

Maximum solver iterations.

type str

Active factory tag for this category.

unique_name str

Fully qualified name: datablock, category, entry.

parameters list

All GenericDescriptorBase instances on this item.

as_cif str

Return CIF representation of this object.

Attributes
max_iterations property writable

Maximum solver iterations.

type property writable

Active factory tag for this category.

unique_name property

Fully qualified name: datablock, category, entry.

parameters property

All GenericDescriptorBase instances on this item.

as_cif property

Return CIF representation of this object.

Functions
show_supported()

Print supported types and mark the active one.

__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print parameters, other properties, and methods.

from_cif(block, idx=0)

Populate this item from a CIF block.

sequential_fit

Modules:

Name Description
default

Sequential-fit configuration category.

factory

Sequential-fit factory - delegates to FactoryBase.

Classes
Modules
default

Sequential-fit configuration category.

Stores persisted settings for directory-based sequential fitting.

Classes:

Name Description
SequentialFit

Persisted settings for sequential fitting.

Classes
SequentialFit()

Persisted settings for sequential fitting.

Methods:

Name Description
from_cif

Populate this sequential-fit category from a CIF block.

__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print parameters, other properties, and methods.

Attributes:

Name Type Description
data_dir StringDescriptor

Directory containing sequential-fit data files.

file_pattern StringDescriptor

Glob pattern selecting sequential-fit files.

max_workers StringDescriptor

Worker-count token for sequential fitting.

chunk_size StringDescriptor

Chunk-size token for sequential fitting.

reverse BoolDescriptor

Whether to process sequential-fit files in reverse.

as_cif str

Return CIF representation of this sequential-fit category.

unique_name str

Fully qualified name: datablock, category, entry.

parameters list

All GenericDescriptorBase instances on this item.

Attributes
data_dir property writable

Directory containing sequential-fit data files.

file_pattern property writable

Glob pattern selecting sequential-fit files.

max_workers property writable

Worker-count token for sequential fitting.

chunk_size property writable

Chunk-size token for sequential fitting.

reverse property writable

Whether to process sequential-fit files in reverse.

as_cif property

Return CIF representation of this sequential-fit category.

unique_name property

Fully qualified name: datablock, category, entry.

parameters property

All GenericDescriptorBase instances on this item.

Functions
from_cif(block, idx=0)

Populate this sequential-fit category from a CIF block.

__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print parameters, other properties, and methods.

factory

Sequential-fit factory - delegates to FactoryBase.

Classes:

Name Description
SequentialFitFactory

Create sequential-fit category items by tag.

Classes
SequentialFitFactory

Create sequential-fit category items by tag.

Methods:

Name Description
__init_subclass__

Give each subclass its own independent registry and rules.

register

Class decorator to register a concrete class.

supported_tags

Return list of all supported tags.

default_tag

Resolve the default tag for a given experimental context.

create

Instantiate a registered class by tag.

create_default_for

Instantiate the default class for a given context.

supported_for

Return classes matching conditions and/or calculator.

show_supported

Pretty-print a table of supported types.

Functions
__init_subclass__(**kwargs)

Give each subclass its own independent registry and rules.

register(klass) classmethod

Class decorator to register a concrete class.

Usage::

@SomeFactory.register class MyClass(SomeBase): type_info = TypeInfo(...)

Returns the class unmodified.

supported_tags() classmethod

Return list of all supported tags.

default_tag(**conditions) classmethod

Resolve the default tag for a given experimental context.

Uses largest-subset matching: the rule whose key is the biggest subset of the given conditions wins. A rule with an empty key (frozenset()) acts as a universal fallback.

Parameters:

Name Type Description Default
**conditions object

Experimental-axis values, e.g. scattering_type=ScatteringTypeEnum.BRAGG.

{}

Returns:

Type Description
str

The resolved default tag string.

Raises:

Type Description
ValueError

If no rule matches the given conditions.

create(tag, **kwargs) classmethod

Instantiate a registered class by tag.

Parameters:

Name Type Description Default
tag str

type_info.tag value.

required
**kwargs object

Forwarded to the class constructor.

{}

Returns:

Type Description
object

A new instance of the registered class.

Raises:

Type Description
ValueError

If tag is not in the registry.

create_default_for(**conditions) classmethod

Instantiate the default class for a given context.

Combines default_tag(**conditions) with create(tag).

Parameters:

Name Type Description Default
**conditions object

Experimental-axis values.

{}

Returns:

Type Description
object

A new instance of the default class.

supported_for(*, calculator=None, sample_form=None, scattering_type=None, beam_mode=None, radiation_probe=None) classmethod

Return classes matching conditions and/or calculator.

Parameters:

Name Type Description Default
calculator object

Optional CalculatorEnum value.

None
sample_form object

Optional SampleFormEnum value.

None
scattering_type object

Optional ScatteringTypeEnum value.

None
beam_mode object

Optional BeamModeEnum value.

None
radiation_probe object

Optional RadiationProbeEnum value.

None

Returns:

Type Description
list[type]

Classes matching the given conditions.

show_supported(*, calculator=None, sample_form=None, scattering_type=None, beam_mode=None, radiation_probe=None) classmethod

Pretty-print a table of supported types.

Parameters:

Name Type Description Default
calculator object

Optional CalculatorEnum filter.

None
sample_form object

Optional SampleFormEnum filter.

None
scattering_type object

Optional ScatteringTypeEnum filter.

None
beam_mode object

Optional BeamModeEnum filter.

None
radiation_probe object

Optional RadiationProbeEnum filter.

None
sequential_fit_extract

Modules:

Name Description
default

Sequential-fit extract-rule configuration.

factory

Sequential-fit-extract factory - delegates to FactoryBase.

Classes
Modules
default

Sequential-fit extract-rule configuration.

Stores persisted rules for extracting diffrn metadata from sequential fit input files.

Classes:

Name Description
SequentialFitExtractItem

A single sequential-fit extract rule.

SequentialFitExtractCollection

Collection of :class:SequentialFitExtractItem items.

Classes
SequentialFitExtractItem()

A single sequential-fit extract rule.

Methods:

Name Description
__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print parameters, other properties, and methods.

from_cif

Populate this item from a CIF block.

Attributes:

Name Type Description
id StringDescriptor

Identifier for this extract rule.

target StringDescriptor

Diffrn attribute updated by this extract rule.

pattern StringDescriptor

Regex used to extract one numeric capture group.

required BoolDescriptor

Whether this extract rule must match every file.

unique_name str

Fully qualified name: datablock, category, entry.

parameters list

All GenericDescriptorBase instances on this item.

as_cif str

Return CIF representation of this object.

Attributes
id property writable

Identifier for this extract rule.

target property writable

Diffrn attribute updated by this extract rule.

pattern property writable

Regex used to extract one numeric capture group.

required property writable

Whether this extract rule must match every file.

unique_name property

Fully qualified name: datablock, category, entry.

parameters property

All GenericDescriptorBase instances on this item.

as_cif property

Return CIF representation of this object.

Functions
__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print parameters, other properties, and methods.

from_cif(block, idx=0)

Populate this item from a CIF block.

SequentialFitExtractCollection()

Collection of :class:SequentialFitExtractItem items.

Methods:

Name Description
create

Create a validated sequential-fit extract rule.

__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print a summary of public attributes and contained items.

__getitem__

Return an item by name or positional index.

__setitem__

Insert or replace an item under the given identity key.

__delitem__

Delete an item by key or raise KeyError if missing.

__contains__

Check whether an item with the given key exists.

__iter__

Iterate over items in insertion order.

__len__

Return the number of items in the collection.

remove

Remove an item by its key.

keys

Yield keys for all items in insertion order.

values

Yield items in insertion order.

items

Yield (key, item) pairs in insertion order.

from_cif

Populate this collection from a CIF block.

add

Insert or replace a pre-built item into the collection.

Attributes:

Name Type Description
unique_name str | None

Return None; collections have no unique name.

parameters list

All parameters from all items in this collection.

as_cif str

Return CIF representation of this object.

names list[str | None]

List of all item keys in the collection.

scalar_descriptors list

Collection-level descriptors serialized outside the loop.

Attributes
unique_name property

Return None; collections have no unique name.

parameters property

All parameters from all items in this collection.

as_cif property

Return CIF representation of this object.

names property

List of all item keys in the collection.

scalar_descriptors property

Collection-level descriptors serialized outside the loop.

Functions
create(*, id, target, pattern, required=False)

Create a validated sequential-fit extract rule.

__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print a summary of public attributes and contained items.

__getitem__(key)

Return an item by name or positional index.

Parameters:

Name Type Description Default
key str | int

Identity key (str) or zero-based positional index (int).

required

Returns:

Type Description
GuardedBase

The item matching the given key or index.

Raises:

Type Description
TypeError

If key is neither str nor int.

__setitem__(name, item)

Insert or replace an item under the given identity key.

__delitem__(name)

Delete an item by key or raise KeyError if missing.

__contains__(name)

Check whether an item with the given key exists.

__iter__()

Iterate over items in insertion order.

__len__()

Return the number of items in the collection.

remove(name)

Remove an item by its key.

Parameters:

Name Type Description Default
name str

Identity key of the item to remove.

required
keys()

Yield keys for all items in insertion order.

values()

Yield items in insertion order.

items()

Yield (key, item) pairs in insertion order.

from_cif(block)

Populate this collection from a CIF block.

add(item)

Insert or replace a pre-built item into the collection.

Parameters:

Name Type Description Default
item object

A CategoryItem instance to add.

required
factory

Sequential-fit-extract factory - delegates to FactoryBase.

Classes:

Name Description
SequentialFitExtractFactory

Create sequential-fit-extract collections by tag.

Classes
SequentialFitExtractFactory

Create sequential-fit-extract collections by tag.

Methods:

Name Description
__init_subclass__

Give each subclass its own independent registry and rules.

register

Class decorator to register a concrete class.

supported_tags

Return list of all supported tags.

default_tag

Resolve the default tag for a given experimental context.

create

Instantiate a registered class by tag.

create_default_for

Instantiate the default class for a given context.

supported_for

Return classes matching conditions and/or calculator.

show_supported

Pretty-print a table of supported types.

Functions
__init_subclass__(**kwargs)

Give each subclass its own independent registry and rules.

register(klass) classmethod

Class decorator to register a concrete class.

Usage::

@SomeFactory.register class MyClass(SomeBase): type_info = TypeInfo(...)

Returns the class unmodified.

supported_tags() classmethod

Return list of all supported tags.

default_tag(**conditions) classmethod

Resolve the default tag for a given experimental context.

Uses largest-subset matching: the rule whose key is the biggest subset of the given conditions wins. A rule with an empty key (frozenset()) acts as a universal fallback.

Parameters:

Name Type Description Default
**conditions object

Experimental-axis values, e.g. scattering_type=ScatteringTypeEnum.BRAGG.

{}

Returns:

Type Description
str

The resolved default tag string.

Raises:

Type Description
ValueError

If no rule matches the given conditions.

create(tag, **kwargs) classmethod

Instantiate a registered class by tag.

Parameters:

Name Type Description Default
tag str

type_info.tag value.

required
**kwargs object

Forwarded to the class constructor.

{}

Returns:

Type Description
object

A new instance of the registered class.

Raises:

Type Description
ValueError

If tag is not in the registry.

create_default_for(**conditions) classmethod

Instantiate the default class for a given context.

Combines default_tag(**conditions) with create(tag).

Parameters:

Name Type Description Default
**conditions object

Experimental-axis values.

{}

Returns:

Type Description
object

A new instance of the default class.

supported_for(*, calculator=None, sample_form=None, scattering_type=None, beam_mode=None, radiation_probe=None) classmethod

Return classes matching conditions and/or calculator.

Parameters:

Name Type Description Default
calculator object

Optional CalculatorEnum value.

None
sample_form object

Optional SampleFormEnum value.

None
scattering_type object

Optional ScatteringTypeEnum value.

None
beam_mode object

Optional BeamModeEnum value.

None
radiation_probe object

Optional RadiationProbeEnum value.

None

Returns:

Type Description
list[type]

Classes matching the given conditions.

show_supported(*, calculator=None, sample_form=None, scattering_type=None, beam_mode=None, radiation_probe=None) classmethod

Pretty-print a table of supported types.

Parameters:

Name Type Description Default
calculator object

Optional CalculatorEnum filter.

None
sample_form object

Optional SampleFormEnum filter.

None
scattering_type object

Optional ScatteringTypeEnum filter.

None
beam_mode object

Optional BeamModeEnum filter.

None
radiation_probe object

Optional RadiationProbeEnum filter.

None
software

Analysis software-provenance category exports.

Modules:

Name Description
base

Shared software-provenance role helpers.

default

Analysis software-provenance category.

factory

Factory for analysis software-provenance categories.

Classes
Modules
base

Shared software-provenance role helpers.

Classes:

Name Description
SoftwareRole

Name, version, and URL for one software role.

Classes
SoftwareRole(*, role_name, description)

Name, version, and URL for one software role.

Parameters:

Name Type Description Default
role_name str

Role prefix used in persisted CIF item names.

required
description str

Human-readable role description.

required

Methods:

Name Description
__str__

Return the string representation of this object.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print a summary of public properties and methods.

Attributes:

Name Type Description
name StringDescriptor

Software name.

version StringDescriptor

Software version.

url StringDescriptor

Software project URL.

parameters list[StringDescriptor]

Descriptors owned by this software role.

as_cif str

Return CIF representation of this software role.

unique_name str

Fallback unique name: the class name.

Attributes
name property writable

Software name.

version property writable

Software version.

url property writable

Software project URL.

parameters property

Descriptors owned by this software role.

as_cif property

Return CIF representation of this software role.

unique_name property

Fallback unique name: the class name.

Functions
__str__()

Return the string representation of this object.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print a summary of public properties and methods.

default

Analysis software-provenance category.

Classes:

Name Description
Software

Software-provenance snapshot for the latest successful fit.

Classes
Software()

Software-provenance snapshot for the latest successful fit.

Methods:

Name Description
__str__

Human-readable representation of this component.

__repr__

Return the developer representation of this object.

__getattr__

Raise a descriptive error for unknown attribute access.

__setattr__

Set an attribute with access-control diagnostics.

help

Print parameters, other properties, and methods.

from_cif

Populate this item from a CIF block.

Attributes:

Name Type Description
framework SoftwareRole

EasyDiffraction framework provenance.

calculator SoftwareRole

Calculation-engine provenance.

minimizer SoftwareRole

Minimization-engine provenance.

timestamp StringDescriptor

UTC timestamp of the fit provenance snapshot.

parameters list[StringDescriptor]

Descriptors owned by this software category.

as_cif str

Return CIF representation of this software category.

unique_name str

Fully qualified name: datablock, category, entry.

Attributes
framework property

EasyDiffraction framework provenance.

calculator property

Calculation-engine provenance.

minimizer property

Minimization-engine provenance.

timestamp property writable

UTC timestamp of the fit provenance snapshot.

parameters property

Descriptors owned by this software category.

as_cif property

Return CIF representation of this software category.

unique_name property

Fully qualified name: datablock, category, entry.

Functions
__str__()

Human-readable representation of this component.

__repr__()

Return the developer representation of this object.

__getattr__(key)

Raise a descriptive error for unknown attribute access.

__setattr__(key, value)

Set an attribute with access-control diagnostics.

help()

Print parameters, other properties, and methods.

from_cif(block, idx=0)

Populate this item from a CIF block.

factory

Factory for analysis software-provenance categories.

Classes:

Name Description
SoftwareFactory

Create software-provenance categories.

Classes
SoftwareFactory

Create software-provenance categories.

Methods:

Name Description
__init_subclass__

Give each subclass its own independent registry and rules.

register

Class decorator to register a concrete class.

supported_tags

Return list of all supported tags.

default_tag

Resolve the default tag for a given experimental context.

create

Instantiate a registered class by tag.

create_default_for

Instantiate the default class for a given context.

supported_for

Return classes matching conditions and/or calculator.

show_supported

Pretty-print a table of supported types.

Functions
__init_subclass__(**kwargs)

Give each subclass its own independent registry and rules.

register(klass) classmethod

Class decorator to register a concrete class.

Usage::

@SomeFactory.register class MyClass(SomeBase): type_info = TypeInfo(...)

Returns the class unmodified.

supported_tags() classmethod

Return list of all supported tags.

default_tag(**conditions) classmethod

Resolve the default tag for a given experimental context.

Uses largest-subset matching: the rule whose key is the biggest subset of the given conditions wins. A rule with an empty key (frozenset()) acts as a universal fallback.

Parameters:

Name Type Description Default
**conditions object

Experimental-axis values, e.g. scattering_type=ScatteringTypeEnum.BRAGG.

{}

Returns:

Type Description
str

The resolved default tag string.

Raises:

Type Description
ValueError

If no rule matches the given conditions.

create(tag, **kwargs) classmethod

Instantiate a registered class by tag.

Parameters:

Name Type Description Default
tag str

type_info.tag value.

required
**kwargs object

Forwarded to the class constructor.

{}

Returns:

Type Description
object

A new instance of the registered class.

Raises:

Type Description
ValueError

If tag is not in the registry.

create_default_for(**conditions) classmethod

Instantiate the default class for a given context.

Combines default_tag(**conditions) with create(tag).

Parameters:

Name Type Description Default
**conditions object

Experimental-axis values.

{}

Returns:

Type Description
object

A new instance of the default class.

supported_for(*, calculator=None, sample_form=None, scattering_type=None, beam_mode=None, radiation_probe=None) classmethod

Return classes matching conditions and/or calculator.

Parameters:

Name Type Description Default
calculator object

Optional CalculatorEnum value.

None
sample_form object

Optional SampleFormEnum value.

None
scattering_type object

Optional ScatteringTypeEnum value.

None
beam_mode object

Optional BeamModeEnum value.

None
radiation_probe object

Optional RadiationProbeEnum value.

None

Returns:

Type Description
list[type]

Classes matching the given conditions.

show_supported(*, calculator=None, sample_form=None, scattering_type=None, beam_mode=None, radiation_probe=None) classmethod

Pretty-print a table of supported types.

Parameters:

Name Type Description Default
calculator object

Optional CalculatorEnum filter.

None
sample_form object

Optional SampleFormEnum filter.

None
scattering_type object

Optional ScatteringTypeEnum filter.

None
beam_mode object

Optional BeamModeEnum filter.

None
radiation_probe object

Optional RadiationProbeEnum filter.

None

enums

Enumeration types used by analysis components.

Classes:

Name Description
FitModeEnum

Fitting mode for the analysis.

FitResultKindEnum

Persisted kind of the latest fit-result projection.

FitCorrelationSourceEnum

Source of a persisted fit-parameter correlation summary.

Classes

FitModeEnum

Fitting mode for the analysis.

Methods:

Name Description
default

Return the default fit mode (SINGLE).

description

Return a human-readable description of this fit mode.

Functions
default() classmethod

Return the default fit mode (SINGLE).

description()

Return a human-readable description of this fit mode.

FitResultKindEnum

Persisted kind of the latest fit-result projection.

Methods:

Name Description
default

Return the default persisted fit-result kind.

description

Return a human-readable description of this fit-result kind.

Functions
default() classmethod

Return the default persisted fit-result kind.

description()

Return a human-readable description of this fit-result kind.

FitCorrelationSourceEnum

Source of a persisted fit-parameter correlation summary.

Methods:

Name Description
default

Return the default persisted correlation source.

description

Return a human-readable description of this correlation source.

Functions
default() classmethod

Return the default persisted correlation source.

description()

Return a human-readable description of this correlation source.

fit_helpers

Modules:

Name Description
bayesian

Bayesian fit result models and posterior data containers.

metrics
reporting
tracking

Classes

Modules

bayesian

Bayesian fit result models and posterior data containers.

Classes:

Name Description
PosteriorPredictiveSummary

Posterior predictive summaries for one experiment.

PosteriorSamples

Posterior samples and sample statistics from a Bayesian fit.

BayesianFitResults

Container for Bayesian fit results and posterior summaries.

Functions:

Name Description
posterior_predictive_cache_key

Return the cache key for one posterior predictive summary.

compute_convergence_diagnostics

Compute convergence diagnostics from posterior samples.

summarize_posterior_parameters

Build posterior parameter summaries in EasyDiffraction order.

standard_deviations_from_summaries

Return posterior standard deviations in summary order.

Classes
PosteriorPredictiveSummary(experiment_name, x_axis_name, x, best_sample_prediction, lower_95=None, upper_95=None, lower_68=None, upper_68=None, draws=None) dataclass

Posterior predictive summaries for one experiment.

Attributes:

Name Type Description
experiment_name str

Experiment identifier.

x_axis_name str

Name of the x-axis used for the predictive arrays.

x np.ndarray

X-axis values for the predictive curves.

best_sample_prediction np.ndarray

Prediction corresponding to the committed point estimate.

lower_95 np.ndarray | None, default=None

Lower bound of the 95% credible interval.

upper_95 np.ndarray | None, default=None

Upper bound of the 95% credible interval.

lower_68 np.ndarray | None, default=None

Lower bound of the 68% credible interval.

upper_68 np.ndarray | None, default=None

Upper bound of the 68% credible interval.

draws np.ndarray | None, default=None

Optional capped predictive draws with shape (n_draws, n_x).

PosteriorSamples(parameter_names, parameter_samples, log_posterior=None, draw_index=None) dataclass

Posterior samples and sample statistics from a Bayesian fit.

Attributes:

Name Type Description
parameter_names list[str]

Parameter names in the preserved EasyDiffraction order.

parameter_samples np.ndarray

Sample array with shape (n_draws, n_chains, n_parameters).

log_posterior np.ndarray | None, default=None

Log-posterior values with shape (n_draws, n_chains) when available.

draw_index np.ndarray | None, default=None

Optional draw or generation indices associated with the first axis of parameter_samples.

Methods:

Name Description
flattened

Return flattened posterior samples by parameter.

validate_shapes

Validate stored sample shapes.

Functions
flattened()

Return flattened posterior samples by parameter.

Returns:

Type Description
np.ndarray

Array with shape (n_draws * n_chains, n_parameters).

validate_shapes()

Validate stored sample shapes.

Returns:

Type Description
tuple[int, int, int]

Tuple (n_draws, n_chains, n_parameters).

Raises:

Type Description
ValueError

If the sample array is not 3-D, the parameter axis does not match parameter_names, or log_posterior (when present) does not match the first two sample axes.

BayesianFitResults(*, success=False, parameters=None, reduced_chi_square=None, engine_result=None, starting_parameters=None, fitting_time=None, sampler_name='dream', point_estimate_name='best_sample', posterior_samples=None, posterior_parameter_summaries=None, posterior_predictive=None, posterior_distribution_caches=None, posterior_pair_caches=None, credible_interval_levels=DEFAULT_CI_LEVELS, sampler_settings=None, convergence_diagnostics=None, sampler_completed=False, best_log_posterior=None) dataclass

Container for Bayesian fit results and posterior summaries.

Attributes:

Name Type Description
success bool, default=False

Whether the Bayesian fit produced usable posterior results.

parameters list[object] | None, default=None

Final committed parameter objects.

reduced_chi_square float | None, default=None

Reduced chi-square evaluated at the committed point estimate.

engine_result object | None, default=None

Opaque backend result object.

starting_parameters list[object] | None, default=None

Starting parameter objects or snapshots.

fitting_time float | None, default=None

Total fitting time in seconds.

sampler_name str, default='dream'

Sampler identifier.

point_estimate_name str, default='best_sample'

Name of the point estimate committed back to the project.

posterior_samples PosteriorSamples | None, default=None

Stored posterior samples.

posterior_parameter_summaries SummaryList, default=None

Posterior summaries for each sampled parameter.

posterior_predictive PredictiveMap, default=None

Posterior predictive summaries keyed by experiment name.

posterior_distribution_caches ArrayPayloadMap, default=None

Cached posterior density arrays keyed by parameter name.

posterior_pair_caches ArrayPayloadMap, default=None

Cached posterior pair-density arrays keyed by cache id.

credible_interval_levels IntervalLevels, default=DEFAULT_CI_LEVELS

Interval levels available in the summaries.

sampler_settings SettingsMap, default=None

Sampler settings recorded for reproducibility.

convergence_diagnostics DiagnosticsMap, default=None

Convergence diagnostics and status metadata.

sampler_completed bool, default=False

Whether the sampler completed a run and returned posterior data.

best_log_posterior float | None, default=None

Best log-posterior value reported by the sampler.

Methods:

Name Description
__post_init__

Initialize inherited FitResults state and normalize containers.

display_results

Render a Bayesian fit summary with posterior diagnostics.

Functions
__post_init__()

Initialize inherited FitResults state and normalize containers.

display_results(y_obs=None, y_calc=None, y_err=None, f_obs=None, f_calc=None)

Render a Bayesian fit summary with posterior diagnostics.

Parameters:

Name Type Description Default
y_obs list[float] | None

Observed intensities for pattern R-factor metrics.

None
y_calc list[float] | None

Calculated intensities for pattern R-factor metrics.

None
y_err list[float] | None

Standard deviations of observed intensities for wR.

None
f_obs list[float] | None

Observed structure-factor magnitudes for Bragg R.

None
f_calc list[float] | None

Calculated structure-factor magnitudes for Bragg R.

None
Functions
posterior_predictive_cache_key(experiment_name, x_axis_name, *, include_draws=True)

Return the cache key for one posterior predictive summary.

compute_convergence_diagnostics(posterior_samples)

Compute convergence diagnostics from posterior samples.

Parameters:

Name Type Description Default
posterior_samples PosteriorSamples

Posterior samples container.

required

Returns:

Type Description
dict[str, object]

Convergence metrics keyed by diagnostic name.

summarize_posterior_parameters(parameter_names, posterior_samples, best_sample_values, parameter_display_names=None, convergence_diagnostics=None)

Build posterior parameter summaries in EasyDiffraction order.

Parameters:

Name Type Description Default
parameter_names list[str]

Sampled parameter names in EasyDiffraction order.

required
posterior_samples PosteriorSamples

Posterior sample container.

required
best_sample_values np.ndarray

Best posterior sample values in the same order.

required
parameter_display_names list[str] | None

Human-readable parameter names in the same order.

None
convergence_diagnostics dict[str, object] | None

Optional convergence diagnostics keyed by parameter name.

None

Returns:

Type Description
list[PosteriorParameterSummary]

Summary rows matching the input parameter order.

Raises:

Type Description
ValueError

If the posterior sample array is incompatible with the parameter name list.

standard_deviations_from_summaries(summaries)

Return posterior standard deviations in summary order.

Parameters:

Name Type Description Default
summaries list[PosteriorParameterSummary]

Posterior summaries in parameter order.

required

Returns:

Type Description
np.ndarray

Standard deviations in the same order.

metrics

Functions:

Name Description
calculate_r_factor

Calculate the R-factor between observed and calculated data.

calculate_weighted_r_factor

Calculate weighted R-factor between observed and calculated data.

calculate_rb_factor

Calculate the Bragg R-factor between observed and calculated data.

calculate_r_factor_squared

Calculate the R-factor squared between observed and calculated data.

calculate_reduced_chi_square

Calculate the reduced chi-square statistic.

get_reliability_inputs

Collect observed and calculated data for reliability calculations.

Classes
Functions
calculate_r_factor(y_obs, y_calc)

Calculate the R-factor between observed and calculated data.

Parameters:

Name Type Description Default
y_obs np.ndarray

Observed data points.

required
y_calc np.ndarray

Calculated data points.

required

Returns:

Type Description
float

R-factor value.

calculate_weighted_r_factor(y_obs, y_calc, weights)

Calculate weighted R-factor between observed and calculated data.

Parameters:

Name Type Description Default
y_obs np.ndarray

Observed data points.

required
y_calc np.ndarray

Calculated data points.

required
weights np.ndarray

Weights for each data point.

required

Returns:

Type Description
float

Weighted R-factor value.

calculate_rb_factor(y_obs, y_calc)

Calculate the Bragg R-factor between observed and calculated data.

Parameters:

Name Type Description Default
y_obs np.ndarray

Observed data points.

required
y_calc np.ndarray

Calculated data points.

required

Returns:

Type Description
float

Bragg R-factor value.

calculate_r_factor_squared(y_obs, y_calc)

Calculate the R-factor squared between observed and calculated data.

Parameters:

Name Type Description Default
y_obs np.ndarray

Observed data points.

required
y_calc np.ndarray

Calculated data points.

required

Returns:

Type Description
float

R-factor squared value.

calculate_reduced_chi_square(residuals, num_parameters)

Calculate the reduced chi-square statistic.

Parameters:

Name Type Description Default
residuals np.ndarray

Residuals between observed and calculated data.

required
num_parameters int

Number of free parameters used in the model.

required

Returns:

Type Description
float

Reduced chi-square value.

get_reliability_inputs(structures, experiments)

Collect observed and calculated data for reliability calculations.

Parameters:

Name Type Description Default
structures Structures

Collection of structures.

required
experiments list[ExperimentBase]

List of experiments.

required

Returns:

Type Description
np.ndarray

Observed values.

np.ndarray

Calculated values.

np.ndarray | None

Error values, or None if not available.

reporting

Classes:

Name Description
FitResults

Container for results of a single optimization run.

Classes
FitResults(*, success=False, parameters=None, reduced_chi_square=None, engine_result=None, starting_parameters=None, fitting_time=None, **kwargs)

Container for results of a single optimization run.

Holds success flag, chi-square metrics, iteration counts, timing, and parameter objects. Provides a printer to summarize key indicators and a table of fitted parameters.

Parameters:

Name Type Description Default
success bool

Indicates if the fit was successful.

False
parameters list[object] | None

List of parameters used in the fit.

None
reduced_chi_square float | None

Reduced chi-square value of the fit.

None
engine_result object | None

Result from the fitting engine.

None
starting_parameters list[object] | None

Initial parameters for the fit.

None
fitting_time float | None

Time taken for the fitting process.

None
**kwargs object

Additional engine-specific fields. If redchi is provided and reduced_chi_square is not set, it is used as the reduced chi-square value.

{}

Methods:

Name Description
display_results

Render a human-readable summary of the fit.

Functions
display_results(y_obs=None, y_calc=None, y_err=None, f_obs=None, f_calc=None)

Render a human-readable summary of the fit.

Parameters:

Name Type Description Default
y_obs list[float] | None

Observed intensities for pattern R-factor metrics.

None
y_calc list[float] | None

Calculated intensities for pattern R-factor metrics.

None
y_err list[float] | None

Standard deviations of observed intensities for wR.

None
f_obs list[float] | None

Observed structure-factor magnitudes for Bragg R.

None
f_calc list[float] | None

Calculated structure-factor magnitudes for Bragg R.

None
Functions
tracking

Classes:

Name Description
SamplerProgressUpdate

Normalized sampler progress payload forwarded by monitor hooks.

FitProgressTracker

Track and report reduced chi-square during optimization.

Classes
SamplerProgressUpdate(iteration, total_iterations, phase, progress_percent, log_posterior, reduced_chi2, elapsed_time, force_report=False) dataclass

Normalized sampler progress payload forwarded by monitor hooks.

FitProgressTracker()

Track and report reduced chi-square during optimization.

The tracker keeps iteration counters, remembers the best observed reduced chi-square and when it occurred, and can display progress as a table in notebooks or a text UI in terminals.

Methods:

Name Description
reset

Reset internal state before a new optimization run.

track

Update progress with current residuals and parameters.

track_fit_progress

Update fit progress from a backend iteration callback.

track_sampler_progress

Update progress from a sampler monitor.

start_sampler_pre_processing

Mark sampler setup so a status row appears on update.

start_sampler_post_processing

Switch the activity indicator to post-processing.

start_timer

Begin timing of a fit run.

stop_timer

Stop timing and store elapsed time for the run.

start_tracking

Initialize display and headers and announce the minimizer.

add_tracking_info

Append a formatted row to the progress display.

finish_tracking

Finalize progress display and print best result summary.

Attributes:

Name Type Description
best_chi2 float | None

Best recorded reduced chi-square value or None.

best_iteration int | None

Iteration index at which the best chi-square was observed.

iteration int

Current iteration counter.

fitting_time float | None

Elapsed time of the last run in seconds, if available.

Attributes
best_chi2 property

Best recorded reduced chi-square value or None.

best_iteration property

Iteration index at which the best chi-square was observed.

iteration property

Current iteration counter.

fitting_time property

Elapsed time of the last run in seconds, if available.

Functions
reset()

Reset internal state before a new optimization run.

track(residuals, parameters)

Update progress with current residuals and parameters.

Parameters:

Name Type Description Default
residuals np.ndarray

Residuals between measured and calculated data.

required
parameters list[float]

Current free parameters being fitted.

required

Returns:

Type Description
np.ndarray

Residuals unchanged, for optimizer consumption.

track_fit_progress(*, iteration, reduced_chi2, elapsed_time)

Update fit progress from a backend iteration callback.

track_sampler_progress(update)

Update progress from a sampler monitor.

Parameters:

Name Type Description Default
update SamplerProgressUpdate

Sampler iteration, phase, timing, and fit-quality payload.

required
start_sampler_pre_processing(*, total_iterations)

Mark sampler setup so a status row appears on update.

start_sampler_post_processing(*, log_posterior=None)

Switch the activity indicator to post-processing.

start_timer()

Begin timing of a fit run.

stop_timer()

Stop timing and store elapsed time for the run.

start_tracking(minimizer_name, *, mode=TRACKING_MODE_FIT)

Initialize display and headers and announce the minimizer.

Parameters:

Name Type Description Default
minimizer_name str

Name of the minimizer used for the run.

required
mode str

Tracking mode for the run.

TRACKING_MODE_FIT
add_tracking_info(row)

Append a formatted row to the progress display.

Parameters:

Name Type Description Default
row list[str]

Columns corresponding to the active tracking headers.

required
finish_tracking()

Finalize progress display and print best result summary.

Functions

fitting

Classes:

Name Description
FitterFitOptions

Execution options for one fitter run.

Fitter

Handles the fitting workflow using a pluggable minimizer.

Classes

FitterFitOptions(use_physical_limits=False, random_seed=None, resume=False, extra_steps=None) dataclass

Execution options for one fitter run.

Methods:

Name Description
as_minimizer_options

Return equivalent minimizer options for this fitter run.

Functions
as_minimizer_options()

Return equivalent minimizer options for this fitter run.

Fitter(selection=MinimizerTypeEnum.default())

Handles the fitting workflow using a pluggable minimizer.

Methods:

Name Description
fit

Run the fitting process.

Functions
fit(structures, experiments, weights=None, analysis=None, verbosity=VerbosityEnum.FULL, *, options=None)

Run the fitting process.

This method performs the optimization but does not display results. Use :meth:show_fit_results on the Analysis object to display the fit results after fitting is complete.

Parameters:

Name Type Description Default
structures Structures

Collection of structures.

required
experiments list[ExperimentBase]

List of experiments to fit.

required
weights np.ndarray | None

Per-experiment weights as a 1-D array (length must match experiments). When None, equal weights are used.

None
analysis object

Optional Analysis object to update its categories during fitting.

None
verbosity VerbosityEnum

Console output verbosity.

VerbosityEnum.FULL
options FitterFitOptions | None

Execution options controlling limits, randomness and resume.

None

Raises:

Type Description
ValueError

If resume is requested without the same free parameter set used by the saved emcee chain.

Functions

minimizers

Modules:

Name Description
base
bumps

Minimizer using the bumps package.

bumps_amoeba

Bumps minimizer variant using the Nelder-Mead simplex method.

bumps_de

Bumps minimizer variant using the differential evolution method.

bumps_dream

Bumps minimizer variant using the DREAM sampler.

bumps_lm

Bumps minimizer variant using the Levenberg-Marquardt method.

dfols
emcee

Minimizer using the emcee ensemble sampler.

emcee_defaults

Shared defaults for the emcee minimizer.

enums

Enumerations for minimizer types.

factory

Minimizer factory — delegates to FactoryBase.

lmfit
lmfit_least_squares

LMFIT minimizer variant using trust region reflective method.

lmfit_leastsq

LMFIT minimizer variant using the Levenberg-Marquardt (leastsq) method.

Classes

Modules

base

Classes:

Name Description
MinimizerFitOptions

Execution options for one minimizer run.

MinimizerBase

Abstract base for concrete minimizers.

Classes
MinimizerFitOptions(finalize_tracking=True, use_physical_limits=False, random_seed=None, resume=False, extra_steps=None) dataclass

Execution options for one minimizer run.

MinimizerBase(name=None, method=None, max_iterations=None)

Abstract base for concrete minimizers.

Contract: - Subclasses must implement _prepare_solver_args, _run_solver, _sync_result_to_parameters and _check_success. - The fit method orchestrates the full workflow and returns :class:FitResults.

Methods:

Name Description
fit

Run the full minimization workflow.

Attributes:

Name Type Description
max_iterations int | None

User-facing iteration limit for the current minimizer.

Attributes
max_iterations property writable

User-facing iteration limit for the current minimizer.

Functions
fit(parameters, objective_function, verbosity=VerbosityEnum.FULL, *, options=None)

Run the full minimization workflow.

Parameters:

Name Type Description Default
parameters list[object]

Free parameters to optimize.

required
objective_function Callable[..., object]

Callable returning residuals for a given set of engine arguments.

required
verbosity VerbosityEnum

Console output verbosity.

VerbosityEnum.FULL
options MinimizerFitOptions | None

Execution options controlling limits, randomness, resume, and tracker finalization.

None

Returns:

Type Description
FitResults

FitResults with success flag, best chi2 and timing.

Raises:

Type Description
NotImplementedError

If resume is requested for a minimizer that does not support it.

bumps

Minimizer using the bumps package.

Classes:

Name Description
BumpsMinimizer

Minimizer using the BUMPS package.

Classes
BumpsMinimizer(name=MinimizerTypeEnum.BUMPS, method=DEFAULT_METHOD, max_iterations=DEFAULT_MAX_ITERATIONS)

Minimizer using the BUMPS package.

Methods:

Name Description
fit

Run the full minimization workflow.

Attributes:

Name Type Description
max_iterations int | None

User-facing iteration limit for the current minimizer.

Attributes
max_iterations property writable

User-facing iteration limit for the current minimizer.

Functions
fit(parameters, objective_function, verbosity=VerbosityEnum.FULL, *, options=None)

Run the full minimization workflow.

Parameters:

Name Type Description Default
parameters list[object]

Free parameters to optimize.

required
objective_function Callable[..., object]

Callable returning residuals for a given set of engine arguments.

required
verbosity VerbosityEnum

Console output verbosity.

VerbosityEnum.FULL
options MinimizerFitOptions | None

Execution options controlling limits, randomness, resume, and tracker finalization.

None

Returns:

Type Description
FitResults

FitResults with success flag, best chi2 and timing.

Raises:

Type Description
NotImplementedError

If resume is requested for a minimizer that does not support it.

bumps_amoeba

Bumps minimizer variant using the Nelder-Mead simplex method.

Classes:

Name Description
BumpsAmoebaMinimizer

Bumps minimizer using the Nelder-Mead simplex method.

Classes
BumpsAmoebaMinimizer(name=MinimizerTypeEnum.BUMPS_AMOEBA, method=DEFAULT_METHOD, max_iterations=DEFAULT_MAX_ITERATIONS)

Bumps minimizer using the Nelder-Mead simplex method.

Methods:

Name Description
fit

Run the full minimization workflow.

Attributes:

Name Type Description
max_iterations int | None

User-facing iteration limit for the current minimizer.

Attributes
max_iterations property writable

User-facing iteration limit for the current minimizer.

Functions
fit(parameters, objective_function, verbosity=VerbosityEnum.FULL, *, options=None)

Run the full minimization workflow.

Parameters:

Name Type Description Default
parameters list[object]

Free parameters to optimize.

required
objective_function Callable[..., object]

Callable returning residuals for a given set of engine arguments.

required
verbosity VerbosityEnum

Console output verbosity.

VerbosityEnum.FULL
options MinimizerFitOptions | None

Execution options controlling limits, randomness, resume, and tracker finalization.

None

Returns:

Type Description
FitResults

FitResults with success flag, best chi2 and timing.

Raises:

Type Description
NotImplementedError

If resume is requested for a minimizer that does not support it.

bumps_de

Bumps minimizer variant using the differential evolution method.

Classes:

Name Description
BumpsDEMinimizer

Bumps minimizer using the differential evolution method.

Classes
BumpsDEMinimizer(name=MinimizerTypeEnum.BUMPS_DE, method=DEFAULT_METHOD, max_iterations=DEFAULT_MAX_ITERATIONS)

Bumps minimizer using the differential evolution method.

Methods:

Name Description
fit

Run the full minimization workflow.

Attributes:

Name Type Description
max_iterations int | None

User-facing iteration limit for the current minimizer.

Attributes
max_iterations property writable

User-facing iteration limit for the current minimizer.

Functions
fit(parameters, objective_function, verbosity=VerbosityEnum.FULL, *, options=None)

Run the full minimization workflow.

Parameters:

Name Type Description Default
parameters list[object]

Free parameters to optimize.

required
objective_function Callable[..., object]

Callable returning residuals for a given set of engine arguments.

required
verbosity VerbosityEnum

Console output verbosity.

VerbosityEnum.FULL
options MinimizerFitOptions | None

Execution options controlling limits, randomness, resume, and tracker finalization.

None

Returns:

Type Description
FitResults

FitResults with success flag, best chi2 and timing.

Raises:

Type Description
NotImplementedError

If resume is requested for a minimizer that does not support it.

bumps_dream

Bumps minimizer variant using the DREAM sampler.

Classes:

Name Description
BumpsDreamMinimizer

Bumps minimizer using the DREAM Bayesian sampler.

Classes
BumpsDreamMinimizer(name=MinimizerTypeEnum.BUMPS_DREAM, method=DEFAULT_METHOD, max_iterations=DEFAULT_MAX_ITERATIONS)

Bumps minimizer using the DREAM Bayesian sampler.

Methods:

Name Description
fit

Run the full minimization workflow.

Attributes:

Name Type Description
max_iterations int

DREAM exposes sampler length through steps instead.

steps int

Number of DREAM generations retained after burn-in.

burn int | None

Explicit DREAM burn-in generations or None for auto.

thin int

DREAM thinning interval.

pop int

DREAM population multiplier.

parallel int

DREAM parallel worker count; 0 uses all CPUs.

init DreamPopulationInitializationEnum

DREAM population initializer.

Attributes
max_iterations property writable

DREAM exposes sampler length through steps instead.

steps property writable

Number of DREAM generations retained after burn-in.

burn property writable

Explicit DREAM burn-in generations or None for auto.

thin property writable

DREAM thinning interval.

pop property writable

DREAM population multiplier.

parallel property writable

DREAM parallel worker count; 0 uses all CPUs.

init property writable

DREAM population initializer.

Functions
fit(parameters, objective_function, verbosity=VerbosityEnum.FULL, *, options=None)

Run the full minimization workflow.

Parameters:

Name Type Description Default
parameters list[object]

Free parameters to optimize.

required
objective_function Callable[..., object]

Callable returning residuals for a given set of engine arguments.

required
verbosity VerbosityEnum

Console output verbosity.

VerbosityEnum.FULL
options MinimizerFitOptions | None

Execution options controlling limits, randomness, resume, and tracker finalization.

None

Returns:

Type Description
FitResults

FitResults with success flag, best chi2 and timing.

Raises:

Type Description
NotImplementedError

If resume is requested for a minimizer that does not support it.

Functions
bumps_lm

Bumps minimizer variant using the Levenberg-Marquardt method.

Classes:

Name Description
BumpsLmMinimizer

Bumps minimizer explicitly using the Levenberg-Marquardt method.

Classes
BumpsLmMinimizer(name=MinimizerTypeEnum.BUMPS_LM, method=DEFAULT_METHOD, max_iterations=DEFAULT_MAX_ITERATIONS)

Bumps minimizer explicitly using the Levenberg-Marquardt method.

Methods:

Name Description
fit

Run the full minimization workflow.

Attributes:

Name Type Description
max_iterations int | None

User-facing iteration limit for the current minimizer.

Attributes
max_iterations property writable

User-facing iteration limit for the current minimizer.

Functions
fit(parameters, objective_function, verbosity=VerbosityEnum.FULL, *, options=None)

Run the full minimization workflow.

Parameters:

Name Type Description Default
parameters list[object]

Free parameters to optimize.

required
objective_function Callable[..., object]

Callable returning residuals for a given set of engine arguments.

required
verbosity VerbosityEnum

Console output verbosity.

VerbosityEnum.FULL
options MinimizerFitOptions | None

Execution options controlling limits, randomness, resume, and tracker finalization.

None

Returns:

Type Description
FitResults

FitResults with success flag, best chi2 and timing.

Raises:

Type Description
NotImplementedError

If resume is requested for a minimizer that does not support it.

dfols

Classes:

Name Description
DfolsMinimizer

Minimizer using DFO-LS (derivative-free least-squares).

Classes
DfolsMinimizer(name=MinimizerTypeEnum.DFOLS, max_iterations=DEFAULT_MAX_ITERATIONS, **kwargs)

Minimizer using DFO-LS (derivative-free least-squares).

Methods:

Name Description
fit

Run the full minimization workflow.

Attributes:

Name Type Description
max_iterations int | None

User-facing iteration limit for the current minimizer.

Attributes
max_iterations property writable

User-facing iteration limit for the current minimizer.

Functions
fit(parameters, objective_function, verbosity=VerbosityEnum.FULL, *, options=None)

Run the full minimization workflow.

Parameters:

Name Type Description Default
parameters list[object]

Free parameters to optimize.

required
objective_function Callable[..., object]

Callable returning residuals for a given set of engine arguments.

required
verbosity VerbosityEnum

Console output verbosity.

VerbosityEnum.FULL
options MinimizerFitOptions | None

Execution options controlling limits, randomness, resume, and tracker finalization.

None

Returns:

Type Description
FitResults

FitResults with success flag, best chi2 and timing.

Raises:

Type Description
NotImplementedError

If resume is requested for a minimizer that does not support it.

emcee

Minimizer using the emcee ensemble sampler.

Classes:

Name Description
EmceeMinimizer

emcee affine-invariant ensemble Bayesian sampler.

Classes
EmceeMinimizer(name=MinimizerTypeEnum.EMCEE, method=DEFAULT_METHOD, max_iterations=DEFAULT_NSTEPS)

emcee affine-invariant ensemble Bayesian sampler.

Methods:

Name Description
fit

Run emcee sampling and return Bayesian fit results.

Attributes:

Name Type Description
nsteps int

Number of emcee steps to run per walker.

nburn int

Number of initial emcee steps discarded as burn-in.

thin int

Emcee thinning interval.

nwalkers int

Number of emcee walkers.

parallel_workers int

Worker count; 0 asks for all CPUs and 1 runs serially.

initialization_method InitializationMethodEnum

Emcee walker initialization method.

proposal_moves str

Emcee proposal move name.

max_iterations int | None

User-facing iteration limit for the current minimizer.

Attributes
nsteps property writable

Number of emcee steps to run per walker.

nburn property writable

Number of initial emcee steps discarded as burn-in.

thin property writable

Emcee thinning interval.

nwalkers property writable

Number of emcee walkers.

parallel_workers property writable

Worker count; 0 asks for all CPUs and 1 runs serially.

initialization_method property writable

Emcee walker initialization method.

proposal_moves property writable

Emcee proposal move name.

max_iterations property writable

User-facing iteration limit for the current minimizer.

Functions
fit(parameters, objective_function, verbosity=VerbosityEnum.FULL, *, options=None)

Run emcee sampling and return Bayesian fit results.

Functions
emcee_defaults

Shared defaults for the emcee minimizer.

Classes
enums

Enumerations for minimizer types.

Classes:

Name Description
MinimizerTypeEnum

Supported minimizer types.

InitializationMethodEnum

Supported Bayesian sampler initialization methods.

DreamPopulationInitializationEnum

Supported DREAM population initializers.

Classes
MinimizerTypeEnum

Supported minimizer types.

Methods:

Name Description
default

Return the default minimizer type.

description

Return a human-readable description of this minimizer type.

Functions
default() classmethod

Return the default minimizer type.

description()

Return a human-readable description of this minimizer type.

InitializationMethodEnum

Supported Bayesian sampler initialization methods.

DreamPopulationInitializationEnum

Supported DREAM population initializers.

factory

Minimizer factory — delegates to FactoryBase.

Classes:

Name Description
MinimizerFactory

Factory for creating minimizer instances.

Classes
MinimizerFactory

Factory for creating minimizer instances.

Methods:

Name Description
__init_subclass__

Give each subclass its own independent registry and rules.

register

Class decorator to register a concrete class.

supported_tags

Return list of all supported tags.

default_tag

Resolve the default tag for a given experimental context.

create

Instantiate a registered class by tag.

create_default_for

Instantiate the default class for a given context.

supported_for

Return classes matching conditions and/or calculator.

show_supported

Pretty-print a table of supported types.

Functions
__init_subclass__(**kwargs)

Give each subclass its own independent registry and rules.

register(klass) classmethod

Class decorator to register a concrete class.

Usage::

@SomeFactory.register class MyClass(SomeBase): type_info = TypeInfo(...)

Returns the class unmodified.

supported_tags() classmethod

Return list of all supported tags.

default_tag(**conditions) classmethod

Resolve the default tag for a given experimental context.

Uses largest-subset matching: the rule whose key is the biggest subset of the given conditions wins. A rule with an empty key (frozenset()) acts as a universal fallback.

Parameters:

Name Type Description Default
**conditions object

Experimental-axis values, e.g. scattering_type=ScatteringTypeEnum.BRAGG.

{}

Returns:

Type Description
str

The resolved default tag string.

Raises:

Type Description
ValueError

If no rule matches the given conditions.

create(tag, **kwargs) classmethod

Instantiate a registered class by tag.

Parameters:

Name Type Description Default
tag str

type_info.tag value.

required
**kwargs object

Forwarded to the class constructor.

{}

Returns:

Type Description
object

A new instance of the registered class.

Raises:

Type Description
ValueError

If tag is not in the registry.

create_default_for(**conditions) classmethod

Instantiate the default class for a given context.

Combines default_tag(**conditions) with create(tag).

Parameters:

Name Type Description Default
**conditions object

Experimental-axis values.

{}

Returns:

Type Description
object

A new instance of the default class.

supported_for(*, calculator=None, sample_form=None, scattering_type=None, beam_mode=None, radiation_probe=None) classmethod

Return classes matching conditions and/or calculator.

Parameters:

Name Type Description Default
calculator object

Optional CalculatorEnum value.

None
sample_form object

Optional SampleFormEnum value.

None
scattering_type object

Optional ScatteringTypeEnum value.

None
beam_mode object

Optional BeamModeEnum value.

None
radiation_probe object

Optional RadiationProbeEnum value.

None

Returns:

Type Description
list[type]

Classes matching the given conditions.

show_supported(*, calculator=None, sample_form=None, scattering_type=None, beam_mode=None, radiation_probe=None) classmethod

Pretty-print a table of supported types.

Parameters:

Name Type Description Default
calculator object

Optional CalculatorEnum filter.

None
sample_form object

Optional SampleFormEnum filter.

None
scattering_type object

Optional ScatteringTypeEnum filter.

None
beam_mode object

Optional BeamModeEnum filter.

None
radiation_probe object

Optional RadiationProbeEnum filter.

None
lmfit

Classes:

Name Description
LmfitMinimizer

Minimizer using the lmfit package.

Classes
LmfitMinimizer(name=MinimizerTypeEnum.LMFIT, method=DEFAULT_METHOD, max_iterations=DEFAULT_MAX_ITERATIONS)

Minimizer using the lmfit package.

Methods:

Name Description
fit

Run the full minimization workflow.

Attributes:

Name Type Description
max_iterations int | None

User-facing iteration limit for the current minimizer.

Attributes
max_iterations property writable

User-facing iteration limit for the current minimizer.

Functions
fit(parameters, objective_function, verbosity=VerbosityEnum.FULL, *, options=None)

Run the full minimization workflow.

Parameters:

Name Type Description Default
parameters list[object]

Free parameters to optimize.

required
objective_function Callable[..., object]

Callable returning residuals for a given set of engine arguments.

required
verbosity VerbosityEnum

Console output verbosity.

VerbosityEnum.FULL
options MinimizerFitOptions | None

Execution options controlling limits, randomness, resume, and tracker finalization.

None

Returns:

Type Description
FitResults

FitResults with success flag, best chi2 and timing.

Raises:

Type Description
NotImplementedError

If resume is requested for a minimizer that does not support it.

lmfit_least_squares

LMFIT minimizer variant using trust region reflective method.

Classes:

Name Description
LmfitLeastSquaresMinimizer

LMFIT minimizer using SciPy's trust region reflective algorithm.

Classes
LmfitLeastSquaresMinimizer(name=MinimizerTypeEnum.LMFIT_LEAST_SQUARES, method=DEFAULT_METHOD, max_iterations=DEFAULT_MAX_ITERATIONS)

LMFIT minimizer using SciPy's trust region reflective algorithm.

Methods:

Name Description
fit

Run the full minimization workflow.

Attributes:

Name Type Description
max_iterations int | None

User-facing iteration limit for the current minimizer.

Attributes
max_iterations property writable

User-facing iteration limit for the current minimizer.

Functions
fit(parameters, objective_function, verbosity=VerbosityEnum.FULL, *, options=None)

Run the full minimization workflow.

Parameters:

Name Type Description Default
parameters list[object]

Free parameters to optimize.

required
objective_function Callable[..., object]

Callable returning residuals for a given set of engine arguments.

required
verbosity VerbosityEnum

Console output verbosity.

VerbosityEnum.FULL
options MinimizerFitOptions | None

Execution options controlling limits, randomness, resume, and tracker finalization.

None

Returns:

Type Description
FitResults

FitResults with success flag, best chi2 and timing.

Raises:

Type Description
NotImplementedError

If resume is requested for a minimizer that does not support it.

lmfit_leastsq

LMFIT minimizer variant using the Levenberg-Marquardt (leastsq) method.

Classes:

Name Description
LmfitLeastsqMinimizer

LMFIT minimizer explicitly using the Levenberg-Marquardt method.

Classes
LmfitLeastsqMinimizer(name=MinimizerTypeEnum.LMFIT_LEASTSQ, method=DEFAULT_METHOD, max_iterations=DEFAULT_MAX_ITERATIONS)

LMFIT minimizer explicitly using the Levenberg-Marquardt method.

Methods:

Name Description
fit

Run the full minimization workflow.

Attributes:

Name Type Description
max_iterations int | None

User-facing iteration limit for the current minimizer.

Attributes
max_iterations property writable

User-facing iteration limit for the current minimizer.

Functions
fit(parameters, objective_function, verbosity=VerbosityEnum.FULL, *, options=None)

Run the full minimization workflow.

Parameters:

Name Type Description Default
parameters list[object]

Free parameters to optimize.

required
objective_function Callable[..., object]

Callable returning residuals for a given set of engine arguments.

required
verbosity VerbosityEnum

Console output verbosity.

VerbosityEnum.FULL
options MinimizerFitOptions | None

Execution options controlling limits, randomness, resume, and tracker finalization.

None

Returns:

Type Description
FitResults

FitResults with success flag, best chi2 and timing.

Raises:

Type Description
NotImplementedError

If resume is requested for a minimizer that does not support it.

sequential

Sequential fitting infrastructure: template, worker, CSV, recovery.

Classes:

Name Description
SequentialFitExtractRule

Picklable sequential-fit extract rule for worker execution.

SequentialFitTemplate

Snapshot of everything a worker needs to recreate and fit a project.

SequentialProgressState

Mutable live progress rows for sequential fitting.

SequentialProgressContext

Mutable sequential-fit progress handles and state.

SequentialRunPlan

Resolved sequential-fit inputs and bookkeeping.

Functions:

Name Description
fit_sequential

Run sequential fitting over all data files in a directory.

Classes

SequentialFitExtractRule(id, field_name, pattern, required) dataclass

Picklable sequential-fit extract rule for worker execution.

SequentialFitTemplate(structure_cif, experiment_cif, initial_params, free_param_unique_names, alias_defs, constraint_defs, constraints_enabled, minimizer_tag, calculator_tag, diffrn_extract_rules, diffrn_field_names) dataclass

Snapshot of everything a worker needs to recreate and fit a project.

All fields are plain Python types (str, dict, list) so that the template can be pickled for ProcessPoolExecutor.

SequentialProgressState(chunk_rows, file_rows) dataclass

Mutable live progress rows for sequential fitting.

SequentialProgressContext(verbosity, state, indicator=None) dataclass

Mutable sequential-fit progress handles and state.

SequentialRunPlan(verbosity, template, csv_path, header, remaining, chunks, max_workers, processed_count) dataclass

Resolved sequential-fit inputs and bookkeeping.

Functions

fit_sequential(analysis, data_dir, max_workers=1, chunk_size=None, file_pattern='*', *, reverse=False)

Run sequential fitting over all data files in a directory.

Parameters:

Name Type Description Default
analysis object

The Analysis instance (owns project reference).

required
data_dir str

Path to directory containing data files.

required
max_workers int | str

Number of parallel worker processes. 1 = sequential (no subprocess overhead). 'auto' = physical CPU count. Uses ProcessPoolExecutor with spawn context when > 1.

1
chunk_size int | None

Files per chunk. Default None uses max_workers.

None
file_pattern str

Glob pattern to filter files in data_dir.

'*'
reverse bool

When True, process data files in reverse order. Useful when starting values are better matched to the last file (e.g. highest-temperature dataset in a cooling scan).

False