registry
Fitter registry for descriptor lookup and matching.
Provides FitterRegistry for registering, querying, and prioritising
fitter descriptors by target, sources, and constraint tags.
The module-level fitter_registry() function returns a process-wide
singleton that is populated lazily on first access with all built-in
descriptors from pysatl_core.distributions.computations.continuous
and pysatl_core.distributions.computations.discrete.
- class pysatl_core.distributions.computations.registry.FitterRegistry[source]
Bases:
objectRegistry that stores fitter descriptors and selects the best match.
This class is a singleton: every call to
FitterRegistry()returns the same instance. UseFitterRegistry._reset()in tests to clear state.Examples
>>> registry = FitterRegistry() >>> registry.register(some_descriptor) >>> desc = registry.find("cdf", ["pdf"], required_tags={"continuous", "univariate"})
- Return type:
Self
- register(descriptor)[source]
Register a fitter descriptor.
- Parameters:
descriptor (
FitterDescriptor) – Fitter to register.- Return type:
- register_many(descriptors)[source]
Register multiple descriptors at once.
- Return type:
- Parameters:
descriptors (Sequence[FitterDescriptor])
- find(target, sources, *, required_tags=None)[source]
Find the first fitter matching the given target and sources.
- Parameters:
target (
str) – Target characteristic name.sources (
Sequence[str]) – Source characteristic names.required_tags (
frozenset[str] | None) – If provided, only fitters whoseconstraint_tagsare a superset of required_tags are considered.
- Returns:
First matching descriptor, or
Noneif no match.- Return type:
FitterDescriptor | None
- find_all(target, sources, *, required_tags=None)[source]
Return all matching fitters in registration order.
- pysatl_core.distributions.computations.registry.fitter_registry()[source]
Return the process-wide singleton
FitterRegistry, populated lazily.All built-in continuous and discrete fitter descriptors are created and registered on the first call. Subsequent calls return the cached instance. :rtype:
FitterRegistryNotes
Descriptors are not created at import time; they are built here on first access, keeping module-level side-effects to a minimum.
FitterRegistryis a singleton;FitterRegistry() is fitter_registry()is alwaysTrueafter the first call.To reset the singleton (e.g. in tests), call
reset_fitter_registry().
- Return type: