state - Manage bumps server state and session files¶
Information about the currently active fit. |
|
Whether or not the current model has custom plots. |
|
Webview client treats a path as a filename plus a list of leading folder names. |
|
Stores the result of a fit operation. |
|
Manages the history of fit results. |
|
Represents a single item in the fit history. |
|
Stores the state of a Bumps fit problem. |
|
Server state that automatically synchronizes with the attached clients. |
|
Manage the state for a bumps server session. |
|
ISO8601 time string |
|
Singleton value which is undefined. |
|
Type for the UNDEFINED singleton. |
|
Whether or not the fit results contain MCMC samples. |
|
Manage bumps server state and session files.
- class bumps.state.ActiveFit[source]¶
Bases:
TypedDictInformation about the currently active fit. This is used to share information between the webview client and the server.
- class bumps.state.CustomPlotsAvailable[source]¶
Bases:
TypedDictWhether or not the current model has custom plots.
If parameter_based is True then new plots need to be generated whenever the parameter values are updated.
If uncertainty_based is True then new plots need to be generated whenever the MCMC sample is updated.
- class bumps.state.FileInfo[source]¶
Bases:
TypedDictWebview client treats a path as a filename plus a list of leading folder names.
- class bumps.state.FitResult(method: str = 'amoeba', options: Dict[str, ~typing.Any]=<factory>, convergence: List | None = None, fit_state: Any = None)[source]¶
Bases:
objectStores the result of a fit operation.
- Attributes:
method: The fitting method used.
options: Options used to run the fitters.
convergence: List of quantiles for each fit iteration.
fit_state: Fit state for resume, and for sampling from Monte Carlo fitters.
- convergence: List | None = None¶
List of best or (best, min, -1sigma, median, +1sigma, max) for the population at each step of the fit.
- class bumps.state.History[source]¶
Bases:
objectManages the history of fit results.
- Attributes:
store: A dictionary mapping history item names to HistoryItem instances.
- add_item(item: HistoryItem, target_length: int)[source]¶
Add a new history item to the history.
- Args:
item: The history item to add.
target_length: The maximum length of the history.
- Returns:
The name of the added history item.
- get_item(name: str | UNDEFINED_TYPE | None, default=None)[source]¶
Get a history item by name.
- Args:
name: The name of the history item.
default: The default value to return if the item is not found.
- Returns:
The history item, or the default value if not found.
- list()[source]¶
List the history items.
- Returns:
A list of dictionaries containing information about each history item.
- prune(target_length: int)[source]¶
Prune the history to a target length.
- Args:
target_length: The desired length of the history.
- read(parent: Group)[source]¶
Read the history from an HDF5 group.
- Args:
parent: The parent HDF5 group.
- remove_item(name: str)[source]¶
Remove a history item by name.
- Args:
name: The name of the history item to remove.
- set_keep(name: str, keep: bool)[source]¶
Set whether to keep a history item.
- Args:
name: The name of the history item.
keep: Whether to keep the history item.
- store: Dict[str, HistoryItem]¶
- class bumps.state.HistoryItem[source]¶
Bases:
objectRepresents a single item in the fit history.
- Attributes:
problem: The problem state at this point in history.
fitting: The fit result associated with this history item.
timestamp: The timestamp when this history item was created.
label: A label for this history item.
chisq_str: A string representation of the chi-squared value.
keep: Whether to permanently keep this history item, or drop it when too many history items are saved.
- problem: ProblemState¶
- class bumps.state.ProblemState(fitProblem: bumps.fitproblem.FitProblem | None = None, serializer: Literal['dataclass', 'pickle', 'cloudpickle', 'dill'] | None = None)[source]¶
Bases:
objectStores the state of a Bumps fit problem.
- Attributes:
fitProblem: The Bumps fit problem instance.
serializer: The serialization method to use.
- fitProblem: bumps.fitproblem.FitProblem | None = None¶
Bases:
objectServer state that automatically synchronizes with the attached clients.
- class bumps.state.State[source]¶
Bases:
objectManage the state for a bumps server session.
There is a primary state object for the current webview instance defined in bumps.api. Temporary state objects are created to save the temporary fit results as a session file.
- client_path: Path = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/bumps/checkouts/latest/bumps/webview/client')¶
- fit_complete_event: Event¶
Cleared before the fit starts and set when the fit is complete and saved.
- mapper: BaseMapper | None = None¶
- problem: ProblemState¶
- read_session_bytestring(session_bytestring: str, read_problem: bool = True, read_fitstate: bool = True)[source]¶
- read_session_file(session_fullpath: str, read_problem: bool = True, read_fitstate: bool = True)[source]¶
- reset_fitstate(copy: bool = False)[source]¶
Unlink the fitting state from a history item.
This action occurs when fitProblem object is modified so that it is no longer compatible with fit results.
- setup_backing(session_file_name: str, session_pathlist: List[str], read_only: bool = False)[source]¶
- bumps.state.UNDEFINED = UNDEFINED_TYPE()¶
Singleton value which is undefined. This is different from a value which is present but None.”
- class bumps.state.UncertaintyAvailable[source]¶
Bases:
TypedDictWhether or not the fit results contain MCMC samples.
- bumps.state.deserialize_problem(serialized: str, method: Literal['dataclass', 'pickle', 'cloudpickle', 'dill']) bumps.fitproblem.FitProblem[source]¶
- bumps.state.deserialize_problem_bytes(serialized: bytes, method: Literal['dataclass', 'pickle', 'cloudpickle', 'dill']) bumps.fitproblem.FitProblem[source]¶
- bumps.state.get_custom_plots_available(problem: bumps.fitproblem.FitProblem)[source]¶
- bumps.state.read_fitproblem(group: Group, name: str, method: Literal['dataclass', 'pickle', 'cloudpickle', 'dill']) bumps.fitproblem.FitProblem[source]¶
- bumps.state.serialize_problem(problem: bumps.fitproblem.FitProblem, method: Literal['dataclass', 'pickle', 'cloudpickle', 'dill'] | None = None) str | bytes[source]¶
- bumps.state.serialize_problem_bytes(problem: bumps.fitproblem.FitProblem, method: Literal['dataclass', 'pickle', 'cloudpickle', 'dill']) bytes[source]¶
- bumps.state.write_fitproblem(group: Group, name: str, fitProblem: bumps.fitproblem.FitProblem, method: Literal['dataclass', 'pickle', 'cloudpickle', 'dill'])[source]¶