Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
980529f
Add math module with sine, cosine, and tangent functions
markbujehein Oct 6, 2026
419828c
Update pixi.lock to specify platform names and correct package refere…
markbujehein Oct 6, 2026
0dc3fed
Add updated typing, doc strings, and custom Callables
markbujehein Oct 6, 2026
962cbb7
Enhance math module documentation and improve error handling for trig…
markbujehein Oct 7, 2026
f96b414
refactor(math): restrict trig inputs to Parameter and add inverse fun…
markbujehein Oct 7, 2026
4745d6f
docs: add inverse trig TODOs
markbujehein Oct 7, 2026
9c2cf23
typing: use Self type hint in from_scipp method
markbujehein Oct 8, 2026
9de57d9
refactor(math): clean up operations and enhance trig functions
markbujehein Oct 8, 2026
0eabf5e
feat(math): complete maths module with exact bounds and value guards
markbujehein Oct 11, 2026
9d7972d
docs(math): add examples to all function docstrings
markbujehein Oct 11, 2026
49a6593
test(math): structure unit tests as WHEN / THEN / EXPECT
markbujehein Oct 12, 2026
b82f49b
fix(descriptor): update return type in docstring to Self for clarity
markbujehein Oct 12, 2026
a0e5718
refactor(math): optimize caching, tighten type hints, and improve var…
markbujehein Oct 12, 2026
16bc527
feat(math): add inverse trigonometric functions with unit support and…
markbujehein Oct 12, 2026
37e12dd
feat(math): pad collapsed result bounds to ensure valid Parameter cre…
markbujehein Oct 12, 2026
9753727
fix(init): list public names as strings in __all__, export math
markbujehein Oct 12, 2026
fbd9e57
feat(math): add math module documentation and tests for namespace
markbujehein Oct 12, 2026
07c3b8d
fix(math): remove custom math module to avoid native conflicts
markbujehein Oct 12, 2026
25763dd
feat(math): refine tan bounds, add in-fit tests and usage notes
markbujehein Oct 12, 2026
fc4d8b5
feat(math): accept DescriptorNumber as well as Parameter
markbujehein Oct 12, 2026
379cd18
fix: docstrings linting
markbujehein Oct 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/docs/api-reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ available in EasyScience.
persisting EasyScience objects (serializers and components).
- [job](job.md) – Job and experiment abstractions for running and
organizing analyses.
- [math](math.md) – Maths functions on `Parameter` objects (for example
`es.math.sin`, `es.math.log`, `es.math.arctan2`) that propagate units,
uncertainties and fitting bounds.
- [models](models.md) – Predefined model implementations (e.g.
polynomial models) used in fitting workflows.
- [utils](utils.md) – Miscellaneous utility functions and helpers (class
Expand Down
1 change: 1 addition & 0 deletions docs/docs/api-reference/math.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: easyscience.math
1 change: 1 addition & 0 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ nav:
- global_object: api-reference/global_object.md
- io: api-reference/io.md
- job: api-reference/job.md
- math: api-reference/math.md
- models: api-reference/models.md
- utils: api-reference/utils.md
- variable: api-reference/variable.md
20 changes: 10 additions & 10 deletions pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 9 additions & 8 deletions src/easyscience/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
global_object.stack.enabled = False


from . import math # noqa: E402
from .base_classes import ObjBase # noqa: E402
from .fitting import AvailableMinimizers # noqa: E402
from .fitting import Fitter # noqa: E402
Expand All @@ -21,12 +22,12 @@
__version__ = version('easyscience')

__all__ = [
__version__,
global_object,
ObjBase,
CollectionBase,
AvailableMinimizers,
Fitter,
DescriptorNumber,
Parameter,
'__version__',
'global_object',
'ObjBase',
'CollectionBase',
'AvailableMinimizers',
'Fitter',
'DescriptorNumber',
'Parameter',
]
85 changes: 46 additions & 39 deletions src/easyscience/fitting/minimizers/minimizer_bumps.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,42 +417,45 @@ def mcmc_sample(
weights : np.ndarray
Flattened weight array.
samples : int, default=10000
Number of raw samples to draw across all chains, before thinning.
A guaranteed minimum, not an exact count: DREAM advances in
blocks of 10 generations (one generation = one draw per chain)
and stops at the first block boundary at or past ``samples``.
Number of raw samples to draw across all chains, before
thinning. A guaranteed minimum, not an exact count: DREAM
advances in blocks of 10 generations (one generation = one
draw per chain) and stops at the first block boundary at or
past ``samples``.
burn : int, default=2000
Burn-in generations to discard. BUMPS counts ``burn`` in
generations while ``samples`` counts raw draws, so ``burn=500``
discards ``500 * n_chains`` raw samples.
generations while ``samples`` counts raw draws, so
``burn=500`` discards ``500 * n_chains`` raw samples.
thin : int, default=10
Thinning interval — only every ``thin``-th generation is stored.
Thinning interval — only every ``thin``-th generation is
stored.
population : int | None, default=None
BUMPS DREAM population count per parameter (number of parallel
chains): BUMPS creates ``ceil(population * n_parameters)`` chains.
BUMPS DREAM population count per parameter (number of
parallel chains): BUMPS creates ``ceil(population *
n_parameters)`` chains.
resume_state : MCMCDraw | None, default=None
A BUMPS ``MCMCDraw`` state object from a previous
``mcmc_sample()`` call (e.g. ``PosteriorResults.sampler_state``).
When provided, DREAM **continues** the saved chain instead of
starting cold. The population, parameter count, and parameter
names must match the current model — a ``ValueError`` is raised
otherwise.

``samples`` must be the **total** number of raw samples, not an
increment: to extend an existing chain of ``N`` raw samples by
``M``, pass ``samples=N + M`` (DREAM keeps only the last
``samples`` draws in its buffer). The `Sampler.extend` helper
computes this for you.

``burn`` is forced to 0 on resume: a previously-converged chain is
never re-burned.

The ``population`` and ``initializer`` parameters
have **no effect** when ``resume_state`` is provided — they
are determined by the saved state.

Resuming against *different* data is undefined behaviour (the
chain's likelihood changes underneath it).
``mcmc_sample()`` call (e.g.
``PosteriorResults.sampler_state``). When provided, DREAM
**continues** the saved chain instead of starting cold. The
population, parameter count, and parameter names must match
the current model — a ``ValueError`` is raised otherwise.

``samples`` must be the **total** number of raw samples, not
an increment: to extend an existing chain of ``N`` raw
samples by ``M``, pass ``samples=N + M`` (DREAM keeps only
the last ``samples`` draws in its buffer). The
``Sampler.extend`` helper computes this for you.

``burn`` is forced to 0 on resume: a previously-converged
chain is never re-burned.

The ``population`` and ``initializer`` parameters have **no
effect** when ``resume_state`` is provided — they are
determined by the saved state.

Resuming against *different* data is undefined behaviour
(the chain's likelihood changes underneath it).
sampler_kwargs : dict | None, default=None
Additional keyword arguments forwarded to
``bumps.fitters.fit``.
Expand All @@ -475,9 +478,9 @@ def mcmc_sample(
------
ValueError
If the input shapes or weights are invalid, if
``progress_callback`` is not callable, or if ``resume_state``
is incompatible with the current model (parameter count,
names/order, or population mismatch).
``progress_callback`` is not callable, or if
``resume_state`` is incompatible with the current model
(parameter count, names/order, or population mismatch).
FitError
If DREAM sampling was aborted by the user (via
``abort_test``).
Expand Down Expand Up @@ -608,28 +611,32 @@ def _validate_resume_state(
population: int | None,
burn: int,
) -> tuple[int, int]:
"""Check that ``resume_state`` is compatible with ``problem`` and
"""
Check that ``resume_state`` is compatible with ``problem`` and
resolve the population and burn values to use when resuming.

Parameters
----------
problem : FitProblem
The freshly built BUMPS ``FitProblem`` for the current model.
The freshly built BUMPS ``FitProblem`` for the current
model.
resume_state : MCMCDraw
The saved chain state to resume from.
population : int | None
The caller-supplied population scale factor, or ``None``.
burn : int
The caller-supplied burn-in, ignored (with a warning) on resume.
The caller-supplied burn-in, ignored (with a warning) on
resume.

Returns
-------
tuple[int, int]
``(population, burn)`` to pass to DREAM. The population is
returned as a **negative** number, which BUMPS'
``initpop.generate`` reads as an absolute chain count, exactly
reproducing the saved state's population. ``burn`` is always 0:
a previously converged chain is never re-burned.
``initpop.generate`` reads as an absolute chain count,
exactly reproducing the saved state's population. ``burn``
is always 0: a previously converged chain is never
re-burned.

Raises
------
Expand Down
Loading
Loading