autoemx.runners.reinitialize_ledger module

Reset quantification and clustering state for a sample ledger.

This runner removes performed quantifications (including their saved quantification/clustering configs) and associated analysis outputs from the ledger, so processing can start from scratch while preserving acquisition data.

WARNING: This operation is destructive and cannot be undone.

autoemx.runners.reinitialize_ledger.reinitialize_ledger(sample_path: str | None = None, sample_ID: str | None = None, project_path: str | None = None, quant_config_ids: int | Sequence[int] | None = None, dry_run: bool = False, force: bool = False, verbose: bool = True) → Dict[str, object][source]

Remove quantification/clustering state and outputs for one sample.

Parameters:
  • sample_path (str, optional) – Full path to the sample folder containing ledger.json.

  • sample_ID (str, optional) – Sample identifier. Used only when sample_path is not provided.

  • project_path (str, optional) – Parent directory containing sample folders. Used with sample_ID.

  • quant_config_ids (int or list of int, optional) – When provided, only the specified quantification config id(s) are removed (together with their per-spectrum results and matching analysis_quant<id>_clust* directories), and the active quantification pointer is reverted to the latest remaining config. When None (default), all quantification/clustering history is cleared.

  • dry_run (bool, optional) – If True, only print planned actions.

  • force (bool, optional) – If True, skip interactive confirmation.

  • verbose (bool, optional) – If True, print detailed progress.

Returns:

summary – Dictionary with cleanup results and counts, including quant_configs_removed (number of saved quantification configs cleared from the ledger) and quant_results_removed (number of per-spectrum quantification result records cleared). In targeted mode it also includes requested_quant_config_ids, removed_quant_config_ids, missing_quant_config_ids and active_quant (the new active id).

Return type:

dict