proef 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- proef/__init__.py +25 -0
- proef/acquisition.py +244 -0
- proef/ad.py +159 -0
- proef/adapters/__init__.py +0 -0
- proef/adapters/admet.py +196 -0
- proef/adapters/bio/__init__.py +0 -0
- proef/adapters/bio/rdkit_ops.py +52 -0
- proef/adapters/bio/safety_rules.json +146 -0
- proef/adapters/bio/seq_alerts.py +79 -0
- proef/adapters/bio/structure_score.py +85 -0
- proef/adapters/bio/tox_alerts.py +99 -0
- proef/adapters/data/__init__.py +0 -0
- proef/adapters/data/admet.py +62 -0
- proef/adapters/data/chembl.py +110 -0
- proef/adapters/data/frozen/admet/MANIFEST.json +48 -0
- proef/adapters/data/frozen/admet/bbb_martins/test.csv +407 -0
- proef/adapters/data/frozen/admet/bbb_martins/train_val.csv +1625 -0
- proef/adapters/data/frozen/admet/caco2_wang/test.csv +183 -0
- proef/adapters/data/frozen/admet/caco2_wang/train_val.csv +729 -0
- proef/adapters/data/frozen/admet/hia_hou/test.csv +118 -0
- proef/adapters/data/frozen/admet/hia_hou/train_val.csv +462 -0
- proef/adapters/data/moleculenet.py +60 -0
- proef/adapters/databases/__init__.py +0 -0
- proef/adapters/databases/chembl_gates.py +121 -0
- proef/adapters/databases/chembl_lookup.py +35 -0
- proef/adapters/databases/open_targets.py +102 -0
- proef/adapters/databases/pubmed.py +94 -0
- proef/adapters/devices/__init__.py +0 -0
- proef/adapters/devices/ezo_ph.py +251 -0
- proef/adapters/devices/hcs_microscope.py +143 -0
- proef/adapters/devices/lcms.py +123 -0
- proef/adapters/devices/scheduler.py +84 -0
- proef/adapters/devices/sila2.py +134 -0
- proef/adapters/genomics/alphagenome.py +146 -0
- proef/adapters/lab/__init__.py +0 -0
- proef/adapters/lab/bioprocess.py +32 -0
- proef/adapters/lab/devices.py +170 -0
- proef/adapters/lab/imaging.py +226 -0
- proef/adapters/lab/mhs_driver.py +124 -0
- proef/adapters/lab/opentrons.py +222 -0
- proef/adapters/lab/ot2_sim.py +174 -0
- proef/adapters/lab/plate_reader_share.py +108 -0
- proef/adapters/lab/protein_design.py +199 -0
- proef/adapters/lab/recording.py +119 -0
- proef/adapters/lab/replay.py +107 -0
- proef/adapters/lab/simulator.py +282 -0
- proef/adapters/lab/synthesis.py +92 -0
- proef/adapters/models/__init__.py +0 -0
- proef/adapters/models/anthropic_provider.py +157 -0
- proef/adapters/models/assayloop_ranker.py +67 -0
- proef/adapters/models/from_env.py +93 -0
- proef/adapters/models/gp_policy.py +93 -0
- proef/adapters/models/gp_policy_gp.py +36 -0
- proef/adapters/models/llm_policy.py +187 -0
- proef/adapters/models/openai_compat.py +150 -0
- proef/adapters/models/sklearn_policy.py +65 -0
- proef/adapters/retrosynthesis.py +247 -0
- proef/adapters/sandbox/__init__.py +20 -0
- proef/adapters/sandbox/agentenv.py +145 -0
- proef/adapters/sandbox/docker.py +217 -0
- proef/adapters/sandbox/local.py +164 -0
- proef/adapters/sandbox/opensandbox.py +122 -0
- proef/adapters/store/__init__.py +0 -0
- proef/adapters/store/sqlite.py +207 -0
- proef/adaptive.py +108 -0
- proef/advisory.py +76 -0
- proef/analysis_profiles/__init__.py +8 -0
- proef/analysis_profiles/measurements.py +266 -0
- proef/analysis_profiles/plate_assay.py +316 -0
- proef/analysis_report.py +195 -0
- proef/analysis_store.py +183 -0
- proef/anchor.py +154 -0
- proef/api/app.py +107 -0
- proef/api/launch.py +170 -0
- proef/api/v1/__init__.py +29 -0
- proef/api/v1/analyses.py +367 -0
- proef/api/v1/campaigns.py +802 -0
- proef/api/v1/deps.py +10 -0
- proef/api/v1/evals.py +16 -0
- proef/api/v1/evidence.py +132 -0
- proef/api/v1/governance.py +35 -0
- proef/api/v1/inbox.py +119 -0
- proef/api/v1/lab.py +110 -0
- proef/api/v1/pauses.py +77 -0
- proef/api/v1/programs.py +397 -0
- proef/api/v1/results.py +147 -0
- proef/api/v1/schemas.py +932 -0
- proef/api/v1/system.py +79 -0
- proef/api/v1/trees.py +216 -0
- proef/api/wizard_sessions.py +253 -0
- proef/approvals.py +102 -0
- proef/assays/__init__.py +15 -0
- proef/assays/dls.py +114 -0
- proef/assays/dsf.py +81 -0
- proef/assays/elisa.py +58 -0
- proef/assays/properties.py +65 -0
- proef/assays/simulate.py +157 -0
- proef/audit.py +152 -0
- proef/autoloop.py +1620 -0
- proef/benchmark.py +442 -0
- proef/campaign_fsm.py +151 -0
- proef/citations.py +141 -0
- proef/cli.py +1249 -0
- proef/connect.py +74 -0
- proef/core/__init__.py +0 -0
- proef/core/contracts/__init__.py +35 -0
- proef/core/contracts/analysis.py +100 -0
- proef/core/contracts/models.py +395 -0
- proef/core/device_card.py +125 -0
- proef/core/hypothesis.py +720 -0
- proef/core/interfaces.py +164 -0
- proef/core/registry.py +123 -0
- proef/core/safety.py +324 -0
- proef/core/workflow.py +159 -0
- proef/critic.py +62 -0
- proef/demo.py +164 -0
- proef/derivation.py +128 -0
- proef/diary.py +301 -0
- proef/eln.py +87 -0
- proef/evals/__init__.py +1 -0
- proef/evals/hallucination.py +86 -0
- proef/evals/harness.py +358 -0
- proef/evals/orchestration.py +254 -0
- proef/evals/tasks.py +1010 -0
- proef/evals/toolcalls.py +425 -0
- proef/experiment.py +172 -0
- proef/experiment_analysis.py +114 -0
- proef/experiments/__init__.py +0 -0
- proef/experiments/grounding_exp.py +689 -0
- proef/figures.py +218 -0
- proef/fitting.py +309 -0
- proef/fixtures.py +140 -0
- proef/flywheel.py +125 -0
- proef/followup.py +126 -0
- proef/governance.py +290 -0
- proef/groundedness.py +361 -0
- proef/grounding.py +202 -0
- proef/hypothesis_agent.py +369 -0
- proef/ingest.py +157 -0
- proef/instruments.json +173 -0
- proef/interpret.py +95 -0
- proef/kinetic.py +102 -0
- proef/labread/__init__.py +45 -0
- proef/labread/analysis.py +428 -0
- proef/labread/common.py +153 -0
- proef/labread/formats.py +190 -0
- proef/labread/layout.py +168 -0
- proef/labread/pubchem.py +179 -0
- proef/labselect.py +431 -0
- proef/materials.py +140 -0
- proef/mcp_instrument.py +396 -0
- proef/mcp_server.py +283 -0
- proef/modality.py +111 -0
- proef/model_guard.py +245 -0
- proef/output_blocks.py +183 -0
- proef/paths.py +32 -0
- proef/physfail.py +55 -0
- proef/plan.py +160 -0
- proef/plots.py +123 -0
- proef/predictors.py +217 -0
- proef/probes.py +79 -0
- proef/problem_tree.py +581 -0
- proef/program.py +308 -0
- proef/protocol_design.py +42 -0
- proef/proxy.py +78 -0
- proef/readiness.py +259 -0
- proef/reliability.py +49 -0
- proef/report.py +117 -0
- proef/reproduce.py +310 -0
- proef/reviewer.py +254 -0
- proef/sandbox_session.py +247 -0
- proef/sandboxd.py +109 -0
- proef/scaffold.py +195 -0
- proef/series.py +327 -0
- proef/skills.py +203 -0
- proef/sweep.py +83 -0
- proef/taste.py +177 -0
- proef/templates/confirmatory-followup.json +34 -0
- proef/templates/dose-response-screen.json +39 -0
- proef/templates/sar-exploration.json +38 -0
- proef/templates.py +124 -0
- proef/toolkit.py +433 -0
- proef/toolloop.py +133 -0
- proef/tools.py +441 -0
- proef/tpp.py +185 -0
- proef/views/__init__.py +14 -0
- proef/views/counts.py +102 -0
- proef/views/experiment.py +154 -0
- proef/views/ids.py +49 -0
- proef/views/narrative.py +294 -0
- proef/views/pipeline.py +370 -0
- proef/vision.py +165 -0
- proef/watch.py +790 -0
- proef/wizard_chain.py +25 -0
- proef/wizard_store.py +373 -0
- proef-0.2.0.dist-info/METADATA +662 -0
- proef-0.2.0.dist-info/RECORD +200 -0
- proef-0.2.0.dist-info/WHEEL +4 -0
- proef-0.2.0.dist-info/entry_points.txt +14 -0
- proef-0.2.0.dist-info/licenses/LICENSE +202 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"""experiment_analysis — the generic analysis lifecycle (modality-neutral).
|
|
2
|
+
|
|
3
|
+
The application-facing seam: source artifact + selected profile + explicit
|
|
4
|
+
configuration -> deterministic preview / analysis result. This module owns
|
|
5
|
+
NOTHING domain-specific (no plates, no IC50, no controls) and nothing
|
|
6
|
+
infrastructural (no HTTP, no browser state, no file persistence, no
|
|
7
|
+
provenance writes — those belong to the API layer).
|
|
8
|
+
|
|
9
|
+
Profile contract (the seam): a profile module exposes
|
|
10
|
+
CONFIG_TYPE — its pydantic config class (extra=forbid)
|
|
11
|
+
preview(source: Path, cfg) -> dict
|
|
12
|
+
analyze(source: Path, cfg, source_sha256=None) -> dict
|
|
13
|
+
|
|
14
|
+
Guarantees the interface makes to every caller:
|
|
15
|
+
- deterministic for identical bytes + config + profile + pinned versions;
|
|
16
|
+
- profile-detected values are provisional until confirmed when they affect
|
|
17
|
+
scientific meaning;
|
|
18
|
+
- unsupported regimes / unreadable input surface as typed errors, never as
|
|
19
|
+
partial confident results;
|
|
20
|
+
- the source artifact is never modified.
|
|
21
|
+
"""
|
|
22
|
+
from __future__ import annotations
|
|
23
|
+
|
|
24
|
+
from pathlib import Path
|
|
25
|
+
from typing import Any, Callable
|
|
26
|
+
|
|
27
|
+
from proef.analysis_profiles import measurements, plate_assay
|
|
28
|
+
from proef.core.contracts.analysis import AnalysisProfile, AnalysisState
|
|
29
|
+
|
|
30
|
+
PROFILES = {
|
|
31
|
+
AnalysisProfile.plate_assay: plate_assay,
|
|
32
|
+
AnalysisProfile.measurements: measurements,
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class AnalysisError(Exception):
|
|
37
|
+
"""Typed failure: `code` is a stable machine code, message is human."""
|
|
38
|
+
|
|
39
|
+
def __init__(self, code: str, message: str):
|
|
40
|
+
super().__init__(message)
|
|
41
|
+
self.code = code
|
|
42
|
+
self.message = message
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _profile(name: str):
|
|
46
|
+
try:
|
|
47
|
+
key = AnalysisProfile(name)
|
|
48
|
+
except ValueError:
|
|
49
|
+
raise AnalysisError("unknown_profile",
|
|
50
|
+
f"no such analysis profile: {name}") from None
|
|
51
|
+
mod = PROFILES.get(key)
|
|
52
|
+
if mod is None: # pragma: no cover — registry is complete today
|
|
53
|
+
raise AnalysisError("profile_unavailable",
|
|
54
|
+
f"profile {name} is registered but not wired")
|
|
55
|
+
return mod
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _call(profile_name: str, op: str, source: Path, config: dict,
|
|
59
|
+
fail_code: str, fn: Callable[[Any, Any], dict],
|
|
60
|
+
**kwargs: Any) -> dict:
|
|
61
|
+
"""One dispatch + one typed-error ladder for every lifecycle op. A typo
|
|
62
|
+
or unsupported knob in the config is a typed error, never a silent
|
|
63
|
+
default (the profile's pydantic config is extra=forbid)."""
|
|
64
|
+
mod = _profile(profile_name)
|
|
65
|
+
if not Path(source).exists():
|
|
66
|
+
raise AnalysisError("missing_source", f"source not found: {source}")
|
|
67
|
+
try:
|
|
68
|
+
cfg = mod.CONFIG_TYPE(**config)
|
|
69
|
+
except Exception as exc:
|
|
70
|
+
raise AnalysisError("invalid_config", str(exc)[:300]) from None
|
|
71
|
+
try:
|
|
72
|
+
return fn(mod, cfg)
|
|
73
|
+
except AnalysisError:
|
|
74
|
+
raise
|
|
75
|
+
except FileNotFoundError as exc:
|
|
76
|
+
raise AnalysisError("missing_source", str(exc)) from None
|
|
77
|
+
except ImportError as exc:
|
|
78
|
+
raise AnalysisError("missing_dependency", str(exc)) from None
|
|
79
|
+
except ValueError as exc:
|
|
80
|
+
raise AnalysisError("unreadable_source", str(exc)[:300]) from None
|
|
81
|
+
except Exception as exc: # noqa: BLE001 — fail loud, typed, no partial result
|
|
82
|
+
raise AnalysisError(fail_code, str(exc)[:300]) from None
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def preview(profile_name: str, source: Path, config: dict,
|
|
86
|
+
layout_path: str | Path | None = None) -> dict:
|
|
87
|
+
"""Parse-level preview: diagnostics + inferred interpretation, no fits,
|
|
88
|
+
no verdicts. Never modifies the source."""
|
|
89
|
+
return _call(
|
|
90
|
+
profile_name, "preview", source, config, "preview_failed",
|
|
91
|
+
lambda mod, cfg: mod.preview(Path(source), cfg,
|
|
92
|
+
layout_path=(Path(layout_path)
|
|
93
|
+
if layout_path else None)))
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def analyze(profile_name: str, source: Path, config: dict,
|
|
97
|
+
source_sha256: str | None = None,
|
|
98
|
+
layout_path: str | Path | None = None) -> dict:
|
|
99
|
+
"""Deterministic analysis; threshold-conditional preliminary calls.
|
|
100
|
+
Regime refusals and QC holds are RETURNED states, not errors."""
|
|
101
|
+
return _call(
|
|
102
|
+
profile_name, "analyze", source, config, "analysis_failed",
|
|
103
|
+
lambda mod, cfg: mod.analyze(Path(source), cfg,
|
|
104
|
+
source_sha256=source_sha256,
|
|
105
|
+
layout_path=(Path(layout_path)
|
|
106
|
+
if layout_path else None)))
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def is_terminal_hold(payload: dict) -> bool:
|
|
110
|
+
"""True when the analysis completed honestly but must not be read as a
|
|
111
|
+
pass (regime refusal, QC hold, unreadable)."""
|
|
112
|
+
return payload.get("state") in (
|
|
113
|
+
AnalysisState.unsupported_regime, AnalysisState.qc_hold,
|
|
114
|
+
AnalysisState.unreadable, AnalysisState.needs_mapping)
|
|
File without changes
|