chromasurr.sensitivity module

chromasurr.sensitivity.run_sensitivity_analysis(process, param_config, bounds, metric_names=None, n_samples=512)[source]

Perform Sobol sensitivity analysis using a CADETProcess simulation.

Parameters:
  • process (Any) – A CADET Process object representing the base model (type is untyped because CADET does not ship type hints).

  • param_config (Mapping[str, str]) – Maps parameter nameattribute path inside the process object. Example path: "binding_model.adsorption_rate[0]".

  • bounds (Mapping[str, Sequence[float]]) – Parameter bounds as [min, max] per parameter name.

  • metric_names (Sequence[str] or None, optional) – Which metrics to extract via chromasurr.metrics.extract(). Defaults to ["retention_time"].

  • n_samples (int, optional) – Base sample size for Saltelli; total sims ~ n_samples * (2D + 2).

Returns:

dict[str, dict[str, ArrayF | float]] – Mapping metric_name → Sobol result dict from SALib. Each dict typically contains keys like "S1", "ST", "S2" and their confidence intervals (some values are arrays, some scalars).

Raises:
  • KeyError – If a requested metric is not present in extracted results.

  • ValueError – If simulation repeatedly fails and no metrics can be produced.

chromasurr.sensitivity.set_nested_attr(obj, attr_path, value)[source]

Set a nested attribute on an object, including indexed lists.

Parameters:
  • obj (object) – The object whose attribute is to be set.

  • attr_path (str) – Dot-separated path to the attribute. Indexing supported, e.g. "binding_model.adsorption_rate[0]".

  • value (float or int) – The value to assign to the attribute.

Return type:

None

Notes

This walks the object graph following the components in attr_path. When a component looks like name[index], it indexes the list/sequence.