pyphi.mcp.server.estimate_cost#

pyphi.mcp.server.estimate_cost(handle, subset=None, compute='full', formalism=None, scope=None)[source]#

Count the workload of an analysis before running it.

Reports what analyze would evaluate — system partitions, candidate mechanisms, connectivity-pruned purview evaluations, and mechanism-partition sweeps — without computing any φ. The counts reflect the partition schemes, connectivity, and alphabet under the requested formalism.

estimated_cpu_seconds converts the distinction axis to time at pyphi.cost.SECONDS_PER_UNIT, which is calibrated on reference hardware and holds to roughly 20% there. It excludes the system-partition axis, whose cost per partition is not calibrated against the same unit, and it is None when the distinction axis was not counted.

Parameters:
  • handle (str) – A substrate handle from load_example or build_substrate.

  • subset (list of int or str, optional) – The candidate system, as in analyze. Default prices the whole substrate.

  • compute (str) – "full" (default), "sia", "ces", or "distinctions" — the analysis whose workload to estimate, as in analyze. Under IIT 4.0, "ces" is charged on the system-partition axis too, since unfolding a cause-effect structure computes a system irreducibility analysis first.

  • formalism (str, optional) – As in analyze.

  • scope (dict, optional) – Restricts the counted mechanisms and purviews, as a scoped campaign does; it affects only the distinction axis. Keys: "mechanisms", "cause_purviews" and "effect_purviews", each a mapping with any of "explicit" (a list of unit lists, which cannot combine with the other keys), "min_order", "max_order", "containing" (units every admitted set contains) and "within" (units every admitted set lies within); and "max_purview_order_by_mechanism_order", a list of [mechanism order, max purview order] pairs applied to both purview directions. Units may be labels or indices. An unknown key raises an error. Example: {"mechanisms": {"max_order": 2, "containing": ["A"]}, "cause_purviews": {"within": ["A", "B"]}}.

Returns:

dict – A card (human-readable text), an estimate mapping with the counts, and estimated_cpu_seconds with a note on what it covers: the distinction axis only, so a "sia" estimate has no seconds and a "full" estimate is a lower bound. capped=true marks counts that are lower bounds: the count stops at a fixed work budget, which it reaches within seconds.

Return type:

dict[str, Any]