Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion src/easyreflectometry/fitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,10 @@ class FitRun:
zero). The per-dataset objective values add up to the pooled one: the
engine's per-dataset results are disjoint slices of the pooled residuals.

A record is history: read it, do not write to its dictionaries.
A record is history: read it, do not write to it. Being frozen, it
protects its fields from reassignment, but not the ``pooled`` and
``per_dataset`` dictionaries inside them, which are plain and shared with
every holder of the record. Copy them before changing anything.
"""

status: str
Expand Down
7 changes: 6 additions & 1 deletion src/easyreflectometry/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,12 @@ def record_fit(self, prepared: PreparedFit, results: Optional[list] = None, stat

@property
def last_fit(self) -> Optional[FitRun]:
"""The record of the latest fit recorded with :meth:`record_fit`, or None."""
"""The record of the latest fit recorded with :meth:`record_fit`, or None.

The record is read-only history. Its ``pooled`` and ``per_dataset``
dictionaries are shared with the record itself, so copy them before
changing anything; see :class:`~easyreflectometry.fitting.FitRun`.
"""
return self._last_fit

# ----- structural parameter paths -----
Expand Down
Loading