calibmap 0.1.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.
calibmap/__init__.py ADDED
@@ -0,0 +1,99 @@
1
+ """Offline calibration records and publication-aware historical queries."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from collections.abc import Iterable
6
+ from dataclasses import dataclass
7
+ from datetime import datetime
8
+ from math import isfinite
9
+
10
+
11
+ @dataclass(frozen=True)
12
+ class Record:
13
+ backend: str
14
+ metric: str
15
+ qubits: tuple[int, ...]
16
+ calibrated: datetime
17
+ acquired: datetime
18
+ published: datetime | None
19
+ value: float | None
20
+ unit: str
21
+ source: str
22
+ kind: str
23
+ gate: str | None = None
24
+ stderr: float | None = None
25
+ sample_size: int | None = None
26
+
27
+ protocol: str | None = None
28
+
29
+ def identity(self, unit: str) -> tuple:
30
+ key = (
31
+ self.backend,
32
+ self.metric,
33
+ self.qubits,
34
+ self.gate,
35
+ unit,
36
+ self.source,
37
+ self.kind,
38
+ )
39
+ return key if self.protocol is None else (*key, self.protocol)
40
+
41
+ def __post_init__(self) -> None:
42
+ if not all(
43
+ isinstance(v, str) and v.strip()
44
+ for v in (self.backend, self.metric, self.source, self.unit)
45
+ ):
46
+ raise ValueError("Backend, metric, source and unit are required")
47
+ if self.kind not in {"measured", "provider_estimate", "simulated", "synthetic"}:
48
+ raise ValueError("Unknown evidence kind")
49
+ if (
50
+ not isinstance(self.qubits, tuple)
51
+ or len(set(self.qubits)) != len(self.qubits)
52
+ or any(type(q) is not int or q < 0 for q in self.qubits)
53
+ ):
54
+ raise ValueError("Expected distinct nonnegative physical qubits")
55
+ if not all(isinstance(v, datetime) for v in (self.acquired, self.calibrated)):
56
+ raise ValueError("Calibration and acquisition timestamps required")
57
+ for timestamp in (self.calibrated, self.acquired, self.published):
58
+ if timestamp is not None and (
59
+ not isinstance(timestamp, datetime) or timestamp.utcoffset() is None
60
+ ):
61
+ raise ValueError("Expected timezone-aware timestamp")
62
+ if self.value is not None and not isfinite(self.value):
63
+ raise ValueError("Expected finite value or missing observation")
64
+ if self.stderr is not None and (not isfinite(self.stderr) or self.stderr < 0):
65
+ raise ValueError("Invalid standard error")
66
+ if self.sample_size is not None and (
67
+ type(self.sample_size) is not int or self.sample_size < 1
68
+ ):
69
+ raise ValueError("Invalid sample size")
70
+
71
+
72
+ def as_of(records: Iterable[Record], at: datetime) -> tuple[Record, ...]:
73
+ """Return latest observations available to the collector by the cutoff."""
74
+ if at.utcoffset() is None:
75
+ raise ValueError("Expected timezone-aware cutoff")
76
+ from .records import normalize
77
+
78
+ latest: dict[tuple, tuple[tuple, set[Record]]] = {}
79
+ for row in records:
80
+ available = max(row.calibrated, row.acquired, row.published or row.acquired)
81
+ if available > at:
82
+ continue
83
+ key = row.identity(normalize(row).unit)
84
+ rank = (row.calibrated, available, row.acquired)
85
+ if key not in latest or rank > latest[key][0]:
86
+ latest[key] = (rank, {row})
87
+ elif rank == latest[key][0]:
88
+ latest[key][1].add(row)
89
+ snapshot = []
90
+ for key in sorted(latest, key=repr):
91
+ rows = latest[key][1]
92
+ if len(rows) == 1:
93
+ snapshot.append(next(iter(rows)))
94
+ continue
95
+ equivalents = {normalize(row) for row in rows}
96
+ if len(equivalents) != 1:
97
+ raise ValueError("Conflicting observations at identical priority")
98
+ snapshot.append(equivalents.pop())
99
+ return tuple(snapshot)
@@ -0,0 +1,92 @@
1
+ """Pairwise dependence and gate-specific connectivity diagnostics."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from collections.abc import Iterable, Mapping
6
+ from itertools import combinations
7
+
8
+ import numpy as np
9
+ from scipy.stats import pearsonr
10
+
11
+
12
+ def dependence(series: Mapping[str, Mapping[float, float]]) -> dict:
13
+ """Exact-time pairwise deletion. Holm p-values assume valid individual Pearson tests."""
14
+ labels = sorted(series)
15
+ n = len(labels)
16
+ if not n:
17
+ raise ValueError("At least one series required")
18
+ covariance = np.full((n, n), np.nan)
19
+ overlap = np.zeros((n, n), dtype=int)
20
+ tests = []
21
+ for i, a in enumerate(labels):
22
+ for j in range(i, n):
23
+ b = labels[j]
24
+ times = sorted(series[a].keys() & series[b].keys())
25
+ pairs = [
26
+ (series[a][t], series[b][t])
27
+ for t in times
28
+ if np.isfinite([series[a][t], series[b][t]]).all()
29
+ ]
30
+ overlap[i, j] = overlap[j, i] = len(pairs)
31
+ if len(pairs) < 2:
32
+ continue
33
+ x, y = np.asarray(pairs).T
34
+ covariance[i, j] = covariance[j, i] = np.cov(x, y)[0, 1]
35
+ if i != j and len(x) >= 3 and min(np.ptp(x), np.ptp(y)) > 0:
36
+ tests.append((float(pearsonr(x, y)[1]), a, b))
37
+ adjusted = {}
38
+ previous = 0.0
39
+ for k, (p, a, b) in enumerate(sorted(tests)):
40
+ previous = min(1.0, max(previous, (n * (n - 1) // 2 - k) * p))
41
+ adjusted[a, b] = previous
42
+ psd = None
43
+ if np.isfinite(covariance).all():
44
+ tolerance = 16 * np.finfo(float).eps * n * np.max(abs(covariance))
45
+ psd = bool(np.linalg.eigvalsh(covariance).min() >= -tolerance)
46
+ return {
47
+ "labels": labels,
48
+ "covariance": covariance,
49
+ "overlap": overlap,
50
+ "psd": psd,
51
+ "holm": adjusted,
52
+ }
53
+
54
+
55
+ def components(
56
+ nodes: Iterable[int], edges: Iterable[tuple[int, int]]
57
+ ) -> tuple[tuple[int, ...], ...]:
58
+ """Weak components of a directed coupling graph, including isolated qubits."""
59
+ adjacent: dict[int, set[int]] = {node: set() for node in nodes}
60
+ for a, b in edges:
61
+ if a not in adjacent or b not in adjacent:
62
+ raise ValueError("Edge endpoint absent from device")
63
+ adjacent[a].add(b)
64
+ adjacent[b].add(a)
65
+ pending = set(adjacent)
66
+ result = []
67
+ while pending:
68
+ stack = [min(pending)]
69
+ found = set()
70
+ while stack:
71
+ node = stack.pop()
72
+ if node not in found:
73
+ found.add(node)
74
+ stack.extend(adjacent[node] - found)
75
+ pending -= found
76
+ result.append(tuple(sorted(found)))
77
+ return tuple(result)
78
+
79
+
80
+ def candidates(
81
+ nodes: Iterable[int], edges: Iterable[tuple[int, int]], size: int
82
+ ) -> Iterable[tuple[int, ...]]:
83
+ """Enumerate weakly connected subsets. Intended for small device regions."""
84
+ physical = tuple(sorted(set(nodes)))
85
+ links = tuple(edges)
86
+ if type(size) is not int or not 1 <= size <= len(physical):
87
+ raise ValueError("Invalid candidate size")
88
+ components(physical, links)
89
+ for group in combinations(physical, size):
90
+ subset = [(a, b) for a, b in links if a in group and b in group]
91
+ if len(components(group, subset)) == 1:
92
+ yield group
calibmap/experiment.py ADDED
@@ -0,0 +1,177 @@
1
+ """Evidence-level readiness checks for a declared experiment."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from collections.abc import Iterable
6
+ from dataclasses import dataclass
7
+ from datetime import datetime, timedelta
8
+
9
+ from . import Record, as_of
10
+ from .records import normalize
11
+
12
+
13
+ @dataclass(frozen=True)
14
+ class Criterion:
15
+ key: tuple
16
+ lower: float | None = None
17
+ upper: float | None = None
18
+ max_stderr: float | None = None
19
+
20
+
21
+ @dataclass(frozen=True)
22
+ class Decision:
23
+ status: str
24
+ checks: tuple[dict, ...]
25
+
26
+
27
+ def evaluate(
28
+ records: Iterable[Record],
29
+ at: datetime,
30
+ age: timedelta,
31
+ criteria: Iterable[Criterion],
32
+ *,
33
+ required_qubits: Iterable[int] = (),
34
+ required_gates: Iterable[tuple] = (),
35
+ device_qubits: set[int] | None = None,
36
+ available_gates: set[tuple] | None = None,
37
+ drift_alarms: set[tuple] | None = None,
38
+ require_drift: bool = False,
39
+ ) -> Decision:
40
+ """Topology and alarms must describe the device as known at the cutoff. Thresholds use canonical units."""
41
+ from math import isfinite
42
+
43
+ if age < timedelta() or at.utcoffset() is None:
44
+ raise ValueError("Invalid cutoff or maximum age")
45
+ rows = tuple(normalize(r) for r in records)
46
+ checks = []
47
+
48
+ def add(name, key, expected, actual, stamp, status, reason):
49
+ checks.append(
50
+ {
51
+ "criterion": name,
52
+ "key": key,
53
+ "required": expected,
54
+ "actual": actual,
55
+ "calibrated": stamp.isoformat() if stamp else None,
56
+ "status": status,
57
+ "reason": reason,
58
+ }
59
+ )
60
+
61
+ for name, required, known in (
62
+ ("qubit", required_qubits, device_qubits),
63
+ ("gate", required_gates, available_gates),
64
+ ):
65
+ for item in required:
66
+ if known is None:
67
+ add(name, item, True, None, None, "UNKNOWN", "inventory unavailable")
68
+ else:
69
+ present = item in known
70
+ add(
71
+ name,
72
+ item,
73
+ True,
74
+ present,
75
+ None,
76
+ "READY" if present else "NOT_READY",
77
+ "present" if present else "absent",
78
+ )
79
+ for criterion in criteria:
80
+ key = criterion.key
81
+ if any(
82
+ v is not None and not isfinite(v)
83
+ for v in (criterion.lower, criterion.upper, criterion.max_stderr)
84
+ ):
85
+ raise ValueError("Finite bounds required")
86
+ if (
87
+ criterion.lower is not None
88
+ and criterion.upper is not None
89
+ and criterion.lower > criterion.upper
90
+ ):
91
+ raise ValueError("Reversed bounds")
92
+ if criterion.max_stderr is not None and criterion.max_stderr < 0:
93
+ raise ValueError("Negative standard error bound")
94
+ try:
95
+ matches = as_of((r for r in rows if r.identity(r.unit) == key), at)
96
+ except ValueError:
97
+ add(
98
+ "record",
99
+ key,
100
+ "unique revision",
101
+ None,
102
+ None,
103
+ "UNKNOWN",
104
+ "conflicting revisions",
105
+ )
106
+ continue
107
+ if not matches:
108
+ add(
109
+ "record",
110
+ key,
111
+ "available",
112
+ None,
113
+ None,
114
+ "UNKNOWN",
115
+ "no available observation",
116
+ )
117
+ continue
118
+ r = matches[0]
119
+ for name, value, limit, lower in (
120
+ (
121
+ "age_seconds",
122
+ (at - r.calibrated).total_seconds(),
123
+ age.total_seconds(),
124
+ False,
125
+ ),
126
+ ("lower", r.value, criterion.lower, True),
127
+ ("upper", r.value, criterion.upper, False),
128
+ ("stderr", r.stderr, criterion.max_stderr, False),
129
+ ):
130
+ if limit is None:
131
+ continue
132
+ if value is None:
133
+ add(name, key, limit, None, r.calibrated, "UNKNOWN", "missing value")
134
+ else:
135
+ passed = value >= limit if lower else value <= limit
136
+ add(
137
+ name,
138
+ key,
139
+ limit,
140
+ value,
141
+ r.calibrated,
142
+ "READY" if passed else "NOT_READY",
143
+ "within bound" if passed else "outside bound",
144
+ )
145
+ if r.value is None:
146
+ add(
147
+ "value",
148
+ key,
149
+ "observed",
150
+ None,
151
+ r.calibrated,
152
+ "UNKNOWN",
153
+ "missing observation",
154
+ )
155
+ if require_drift or drift_alarms is not None:
156
+ alarm = None if drift_alarms is None else key in drift_alarms
157
+ status = "UNKNOWN" if alarm is None else "NOT_READY" if alarm else "READY"
158
+ add(
159
+ "drift",
160
+ key,
161
+ False,
162
+ alarm,
163
+ r.calibrated,
164
+ status,
165
+ "alarm inventory" if alarm is not None else "missing alarm evidence",
166
+ )
167
+ if not checks:
168
+ raise ValueError("At least one criterion required")
169
+ statuses = {c["status"] for c in checks}
170
+ return Decision(
171
+ "NOT_READY"
172
+ if "NOT_READY" in statuses
173
+ else "UNKNOWN"
174
+ if "UNKNOWN" in statuses
175
+ else "READY",
176
+ tuple(checks),
177
+ )
calibmap/history.py ADDED
@@ -0,0 +1,98 @@
1
+ """Grouped revision history and irregular-time diagnostics."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import itertools
6
+ from collections.abc import Iterable
7
+ from datetime import datetime, timedelta
8
+
9
+ import numpy as np
10
+
11
+ from . import Record
12
+ from .records import normalize
13
+ from .series import describe
14
+
15
+
16
+ def timelines(
17
+ records: Iterable[Record], at: datetime
18
+ ) -> dict[tuple, tuple[Record, ...]]:
19
+ """All available revisions, separate by backend, ordered operands, metric, source and unit."""
20
+ if at.utcoffset() is None:
21
+ raise ValueError("Timezone required")
22
+ groups: dict[tuple, set[Record]] = {}
23
+ for item in records:
24
+ r = normalize(item)
25
+ if max(r.calibrated, r.acquired, r.published or r.acquired) > at:
26
+ continue
27
+ key = r.identity(r.unit)
28
+ groups.setdefault(key, set()).add(r)
29
+ return {
30
+ k: tuple(
31
+ sorted(
32
+ v,
33
+ key=lambda r: (
34
+ r.calibrated,
35
+ max(r.acquired, r.published or r.acquired),
36
+ r.acquired,
37
+ repr(r),
38
+ ),
39
+ )
40
+ )
41
+ for k, v in groups.items()
42
+ }
43
+
44
+
45
+ def stability(
46
+ records: Iterable[Record], at: datetime, window: timedelta, gap: timedelta
47
+ ) -> dict:
48
+ """Descriptive dispersion on latest available revisions at distinct physical epochs."""
49
+ if min(window, gap) <= timedelta():
50
+ raise ValueError("Positive windows required")
51
+ result = {}
52
+ for key, rows in timelines(records, at).items():
53
+ selected: dict[datetime, Record] = {}
54
+ for r in rows:
55
+ if at - r.calibrated <= window:
56
+ old = selected.get(r.calibrated)
57
+ if (
58
+ old
59
+ and (old.acquired, old.published) == (r.acquired, r.published)
60
+ and old != r
61
+ ):
62
+ raise ValueError("Conflicting revision")
63
+ selected[r.calibrated] = r
64
+ values = [r.value for r in selected.values() if r.value is not None]
65
+ epochs = list(selected)
66
+ result[key] = {
67
+ "epochs": len(epochs),
68
+ "missing": sum(r.value is None for r in selected.values()),
69
+ "age_seconds": (at - rows[-1].calibrated).total_seconds(),
70
+ "gaps": [(a, b) for a, b in itertools.pairwise(epochs) if b - a > gap],
71
+ "standard_errors": [r.stderr for r in selected.values()],
72
+ "statistics": describe(np.asarray(values)) if len(values) >= 2 else None,
73
+ }
74
+ return result
75
+
76
+
77
+ def gate_changes(
78
+ records: Iterable[Record], earlier: datetime, later: datetime
79
+ ) -> tuple[dict, ...]:
80
+ """Compare matched ordered gates across as-of epochs in canonical units."""
81
+ from . import as_of
82
+
83
+ if later < earlier:
84
+ raise ValueError("Reversed epochs")
85
+ rows = tuple(normalize(r) for r in records if r.gate is not None)
86
+ before, after = (
87
+ {r.identity(r.unit): r for r in as_of(rows, t)} for t in (earlier, later)
88
+ )
89
+ comparisons = []
90
+ for key in sorted(before.keys() | after.keys(), key=repr):
91
+ left, right = before.get(key), after.get(key)
92
+ change = None
93
+ if left and right and left.value is not None and right.value is not None:
94
+ change = right.value - left.value
95
+ comparisons.append(
96
+ {"key": key, "earlier": left, "later": right, "difference": change}
97
+ )
98
+ return tuple(comparisons)
calibmap/planning.py ADDED
@@ -0,0 +1,193 @@
1
+ """Calibrated graph, held-out noise diagnostics, forecasting and planning."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from collections.abc import Iterable
6
+ from datetime import datetime, timedelta
7
+ from heapq import heappop, heappush
8
+
9
+ import numpy as np
10
+ from scipy.stats import chi2, norm
11
+
12
+ from . import Record, as_of
13
+ from .series import vector
14
+
15
+
16
+ def shortest_path(
17
+ edges: dict[tuple[int, int], float], start: int, end: int
18
+ ) -> tuple[float, tuple[int, ...]]:
19
+ """Costs must share a user-defined additive objective and unit."""
20
+ neighbors: dict[int, list[tuple[int, float]]] = {}
21
+ for (a, b), weight in edges.items():
22
+ if not 0 <= weight < np.inf:
23
+ raise ValueError("Costs must be finite and nonnegative")
24
+ neighbors.setdefault(a, []).append((b, weight))
25
+ queue: list[tuple[float, tuple[int, ...]]] = [(0.0, (start,))]
26
+ visited = set()
27
+ while queue:
28
+ cost, path = heappop(queue)
29
+ node = path[-1]
30
+ if node in visited:
31
+ continue
32
+ if node == end:
33
+ return cost, path
34
+ visited.add(node)
35
+ for successor, weight in neighbors.get(node, []):
36
+ heappush(queue, (cost + weight, path + (successor,)))
37
+ raise ValueError("Unreachable target")
38
+
39
+
40
+ def goodness(counts: np.ndarray, probabilities: np.ndarray) -> dict:
41
+ """Fixed, externally specified multinomial model. Sparse cells suppress asymptotic p."""
42
+ x, p = vector(counts, 2), vector(probabilities, 2)
43
+ if (
44
+ x.shape != p.shape
45
+ or (x < 0).any()
46
+ or (x != np.floor(x)).any()
47
+ or x.sum() == 0
48
+ or (p < 0).any()
49
+ or not np.isclose(p.sum(), 1.0, rtol=0, atol=1e-12)
50
+ ):
51
+ raise ValueError("Invalid multinomial data")
52
+ expected = x.sum() * p
53
+ mask = p > 0
54
+ residual = x - expected
55
+ impossible = bool(np.any(x[~mask] > 0))
56
+ stat = (
57
+ float("inf")
58
+ if impossible
59
+ else float(np.sum(residual[mask] ** 2 / expected[mask]))
60
+ )
61
+ pv = None
62
+ if impossible:
63
+ pv = 0.0
64
+ elif mask.sum() > 1 and min(expected[mask]) >= 5:
65
+ pv = float(chi2.sf(stat, mask.sum() - 1))
66
+ return {
67
+ "residual": residual.tolist(),
68
+ "statistic": stat,
69
+ "p_value": pv,
70
+ "impossible": impossible,
71
+ }
72
+
73
+
74
+ def forecast(
75
+ times: np.ndarray,
76
+ values: np.ndarray,
77
+ horizon: float,
78
+ process_rate: float,
79
+ observation_var: float,
80
+ alpha: float = 0.05,
81
+ ) -> tuple[float, float, float]:
82
+ """Local-level model, known variance rates, diffuse initial level at first observation."""
83
+ t, x = vector(times), vector(values)
84
+ if (
85
+ t.shape != x.shape
86
+ or np.any(np.diff(t) <= 0)
87
+ or not all(np.isfinite([horizon, process_rate, observation_var]))
88
+ or horizon <= 0
89
+ or process_rate < 0
90
+ or observation_var <= 0
91
+ or not 0 < alpha < 1
92
+ ):
93
+ raise ValueError("Invalid time series or model")
94
+ level, var = x[0], observation_var
95
+ for dt, y in zip(np.diff(t), x[1:]):
96
+ var += process_rate * dt
97
+ gain = var / (var + observation_var)
98
+ level += gain * (y - level)
99
+ var = (1 - gain) * var
100
+ width = norm.isf(alpha / 2) * np.sqrt(
101
+ var + process_rate * horizon + observation_var
102
+ )
103
+ return float(level), float(level - width), float(level + width)
104
+
105
+
106
+ def readiness(
107
+ records: Iterable[Record],
108
+ at: datetime,
109
+ max_age: timedelta,
110
+ upper_bounds: dict[tuple, float],
111
+ ) -> tuple[str, dict]:
112
+ """Keys are (backend, metric, qubits, gate, unit, source, kind)."""
113
+ if (
114
+ max_age < timedelta()
115
+ or not upper_bounds
116
+ or not np.isfinite(list(upper_bounds.values())).all()
117
+ ):
118
+ raise ValueError("Explicit criteria and nonnegative maximum age required")
119
+ from .records import normalize
120
+
121
+ latest = {}
122
+ for row in as_of(records, at):
123
+ canonical = normalize(row)
124
+ for key in upper_bounds:
125
+ if row.identity(key[4]) != key:
126
+ continue
127
+ probe = normalize(
128
+ Record(
129
+ row.backend,
130
+ row.metric,
131
+ row.qubits,
132
+ row.calibrated,
133
+ row.acquired,
134
+ row.published,
135
+ 1.0,
136
+ key[4],
137
+ row.source,
138
+ row.kind,
139
+ )
140
+ )
141
+ if probe.unit == canonical.unit and probe.value is not None:
142
+ from dataclasses import replace
143
+
144
+ latest[key] = replace(
145
+ canonical,
146
+ value=None
147
+ if canonical.value is None
148
+ else canonical.value / probe.value,
149
+ unit=key[4],
150
+ )
151
+ outcomes = {}
152
+ for key, limit in upper_bounds.items():
153
+ observation = latest.get(key)
154
+ if observation is None or observation.value is None:
155
+ outcomes[key] = "missing evidence"
156
+ elif at - observation.calibrated > max_age:
157
+ outcomes[key] = "stale"
158
+ elif observation.value > limit:
159
+ outcomes[key] = "above threshold"
160
+ else:
161
+ outcomes[key] = "pass"
162
+ reasons = set(outcomes.values())
163
+ state = (
164
+ "NOT_READY"
165
+ if reasons & {"stale", "above threshold"}
166
+ else "UNKNOWN"
167
+ if "missing evidence" in reasons
168
+ else "READY"
169
+ )
170
+ return state, outcomes
171
+
172
+
173
+ def multinomial_mc(
174
+ counts: np.ndarray, probabilities: np.ndarray, draws: int, seed: int
175
+ ) -> dict:
176
+ """Plus-one Monte Carlo test with a prespecified fixed multinomial null."""
177
+ result = goodness(counts, probabilities)
178
+ if type(draws) is not int or draws < 1:
179
+ raise ValueError("Positive replicate count required")
180
+ p = np.asarray(probabilities, dtype=float)
181
+ n = int(np.sum(counts))
182
+ result["total_variation"] = float(np.sum(abs(np.asarray(counts) / n - p)) / 2)
183
+ if result["impossible"]:
184
+ result["mc_p"] = 0.0
185
+ return result
186
+ mask = p > 0
187
+ expected = n * p[mask]
188
+ sim = np.random.default_rng(seed).multinomial(n, p, size=draws)[:, mask]
189
+ simulated_stat = np.sum((sim - expected) ** 2 / expected, axis=1)
190
+ result["mc_p"] = (1 + int(np.sum(simulated_stat >= result["statistic"]))) / (
191
+ 1 + draws
192
+ )
193
+ return result
calibmap/py.typed ADDED
File without changes
calibmap/readout.py ADDED
@@ -0,0 +1,100 @@
1
+ """Binary assignment with observed rows and prepared columns."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from dataclasses import dataclass
6
+
7
+ import numpy as np
8
+ from scipy.stats import beta
9
+
10
+
11
+ def interval(k: int, n: int, alpha: float = 0.05) -> tuple[float, float]:
12
+ """Equal-tailed Clopper-Pearson interval for independent Bernoulli trials."""
13
+ if (
14
+ type(k) is not int
15
+ or type(n) is not int
16
+ or not 0 <= k <= n
17
+ or n < 1
18
+ or not 0 < alpha < 1
19
+ ):
20
+ raise ValueError("Invalid binomial experiment")
21
+ return (
22
+ float(beta.ppf(alpha / 2, k, n - k + 1)) if k else 0.0,
23
+ float(beta.ppf(1 - alpha / 2, k + 1, n - k)) if k < n else 1.0,
24
+ )
25
+
26
+
27
+ @dataclass(frozen=True)
28
+ class Binary:
29
+ e0: float
30
+ e1: float
31
+
32
+ def __post_init__(self) -> None:
33
+ if not all(0 <= p <= 1 for p in (self.e0, self.e1)):
34
+ raise ValueError("Expected directional probabilities")
35
+
36
+ @property
37
+ def matrix(self) -> np.ndarray:
38
+ return np.array([[1 - self.e0, self.e1], [self.e0, 1 - self.e1]])
39
+
40
+ @property
41
+ def contrast(self) -> float:
42
+ return 1 - self.e0 - self.e1
43
+
44
+ @property
45
+ def asymmetry(self) -> float:
46
+ return self.e0 - self.e1
47
+
48
+ def invert(
49
+ self, observed: float, max_condition: float = 1e6
50
+ ) -> tuple[float, float]:
51
+ """Unclipped inverse and conditional variance amplification."""
52
+ if not 0 <= observed <= 1 or not 1 <= max_condition < np.inf:
53
+ raise ValueError("Invalid observation or condition limit")
54
+ if np.linalg.cond(self.matrix) > max_condition:
55
+ raise ValueError("Ill-conditioned assignment")
56
+ return (observed - self.e0) / self.contrast, 1 / self.contrast**2
57
+
58
+
59
+ def delta(jacobian: np.ndarray, covariance: np.ndarray) -> np.ndarray:
60
+ j, c = np.atleast_2d(jacobian), np.atleast_2d(covariance)
61
+ if (
62
+ j.ndim != 2
63
+ or not j.size
64
+ or c.shape != (j.shape[1], j.shape[1])
65
+ or not all(np.isfinite(x).all() for x in (j, c))
66
+ ):
67
+ raise ValueError("Incompatible finite Jacobian and covariance required")
68
+ tolerance = 16 * np.finfo(float).eps * len(c) * np.max(np.abs(c))
69
+ if np.max(np.abs(c - c.T)) > tolerance or np.linalg.eigvalsh(c).min() < -tolerance:
70
+ raise ValueError("Covariance must be positive semidefinite and symmetric")
71
+ return j @ c @ j.T
72
+
73
+
74
+ def joint_inverse(
75
+ matrix: np.ndarray, observed: np.ndarray, max_condition: float = 1e6
76
+ ) -> np.ndarray:
77
+ """Invert a supplied full joint assignment on an explicitly ordered outcome basis."""
78
+ a = np.asarray(matrix, dtype=float)
79
+ q = np.asarray(observed, dtype=float)
80
+ if (
81
+ q.ndim != 1
82
+ or len(q) < 2
83
+ or len(q) & (len(q) - 1)
84
+ or a.shape != (len(q), len(q))
85
+ ):
86
+ raise ValueError("Expected a square assignment on binary joint outcomes")
87
+ if (
88
+ not np.isfinite(a).all()
89
+ or not np.isfinite(q).all()
90
+ or np.any(a < 0)
91
+ or np.any(q < 0)
92
+ ):
93
+ raise ValueError("Expected finite nonnegative probabilities")
94
+ if not np.allclose(a.sum(axis=0), 1, rtol=0, atol=1e-12) or not np.isclose(
95
+ q.sum(), 1, rtol=0, atol=1e-12
96
+ ):
97
+ raise ValueError("Columns and observed distribution must each sum to one")
98
+ if not 1 <= max_condition < np.inf or np.linalg.cond(a) > max_condition:
99
+ raise ValueError("Invalid condition bound or ill-conditioned assignment")
100
+ return np.linalg.solve(a, q)
calibmap/records.py ADDED
@@ -0,0 +1,123 @@
1
+ """Portable records, provider imports and deterministic reports."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import csv
6
+ import hashlib
7
+ import html
8
+ import io
9
+ import json
10
+ from collections.abc import Iterable
11
+ from dataclasses import asdict, replace
12
+ from datetime import datetime
13
+ from typing import Protocol
14
+
15
+ from . import Record
16
+
17
+
18
+ def normalize(row: Record) -> Record:
19
+ factors = {"s": 1.0, "ms": 1e-3, "us": 1e-6, "µs": 1e-6, "ns": 1e-9}
20
+ if row.unit not in factors:
21
+ return row
22
+ scale = factors[row.unit]
23
+ return replace(
24
+ row,
25
+ unit="s",
26
+ value=None if row.value is None else row.value * scale,
27
+ stderr=None if row.stderr is None else row.stderr * scale,
28
+ )
29
+
30
+
31
+ def encode(record: Record) -> dict:
32
+ data = asdict(record)
33
+ for key in ("calibrated", "acquired", "published"):
34
+ if data[key] is not None:
35
+ data[key] = data[key].isoformat()
36
+ return data
37
+
38
+
39
+ def decode(data: dict) -> Record:
40
+ fields = dict(data)
41
+ fields["qubits"] = tuple(fields["qubits"])
42
+ for key in ("calibrated", "acquired", "published"):
43
+ if fields.get(key) is not None:
44
+ fields[key] = datetime.fromisoformat(fields[key])
45
+ return Record(**fields)
46
+
47
+
48
+ def export(records: Iterable[Record], fmt: str = "json") -> str:
49
+ data = [encode(r) for r in records]
50
+ canonical = json.dumps(data, sort_keys=True, allow_nan=False, separators=(",", ":"))
51
+ if fmt == "json":
52
+ return canonical
53
+ if fmt == "html":
54
+ return "<pre>" + html.escape(canonical) + "</pre>"
55
+ if fmt != "csv":
56
+ raise ValueError("Unknown record format")
57
+ stream = io.StringIO()
58
+ writer = csv.DictWriter(stream, fieldnames=list(Record.__dataclass_fields__))
59
+ writer.writeheader()
60
+ for row in data:
61
+ writer.writerow({k: json.dumps(v, allow_nan=False) for k, v in row.items()})
62
+ return stream.getvalue()
63
+
64
+
65
+ def load(text: str, fmt: str = "json") -> tuple[Record, ...]:
66
+ if fmt == "json":
67
+ rows = json.loads(text)
68
+ elif fmt == "csv":
69
+ rows = [
70
+ {k: json.loads(v) for k, v in row.items()}
71
+ for row in csv.DictReader(io.StringIO(text))
72
+ ]
73
+ else:
74
+ raise ValueError("Unsupported input format")
75
+ return tuple(decode(row) for row in rows)
76
+
77
+
78
+ def fingerprint(records: Iterable[Record]) -> str:
79
+ return hashlib.sha256(export(records).encode()).hexdigest()
80
+
81
+
82
+ class ProviderProperties(Protocol):
83
+ def to_dict(self) -> dict: ...
84
+
85
+
86
+ def ibm_properties(
87
+ properties: ProviderProperties,
88
+ acquired: datetime,
89
+ published: datetime | None = None,
90
+ ) -> tuple[Record, ...]:
91
+ """Accept Runtime BackendProperties. The caller supplies actual availability evidence."""
92
+ raw = properties.to_dict()
93
+ rows = []
94
+
95
+ def append(param, qubits, gate):
96
+ stamp = param["date"]
97
+ if isinstance(stamp, str):
98
+ stamp = datetime.fromisoformat(stamp)
99
+ rows.append(
100
+ normalize(
101
+ Record(
102
+ raw["backend_name"],
103
+ param["name"],
104
+ tuple(qubits),
105
+ stamp,
106
+ acquired,
107
+ published,
108
+ param.get("value"),
109
+ param.get("unit") or "1",
110
+ "IBM Runtime",
111
+ "provider_estimate",
112
+ gate,
113
+ )
114
+ )
115
+ )
116
+
117
+ for i, params in enumerate(raw["qubits"]):
118
+ for param in params:
119
+ append(param, (i,), None)
120
+ for item in raw["gates"]:
121
+ for param in item["parameters"]:
122
+ append(param, item["qubits"], item["gate"])
123
+ return tuple(rows)
calibmap/reporting.py ADDED
@@ -0,0 +1,86 @@
1
+ """Deterministic reports over calibration inputs and declared analysis results."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import csv
6
+ import html
7
+ import io
8
+ import json
9
+ import math
10
+ from collections.abc import Iterable, Mapping
11
+ from dataclasses import dataclass
12
+
13
+ import numpy as np
14
+
15
+ from . import Record
16
+ from .records import encode, fingerprint
17
+
18
+
19
+ def _portable(value):
20
+ if isinstance(value, np.ndarray):
21
+ return _portable(value.tolist())
22
+ if isinstance(value, np.generic):
23
+ return _portable(value.item())
24
+ if isinstance(value, float) and not math.isfinite(value):
25
+ return {"undefined": str(value)}
26
+ if isinstance(value, Mapping):
27
+ if not all(isinstance(k, str) for k in value):
28
+ raise ValueError("Report fields require explicit string labels")
29
+ return {k: _portable(v) for k, v in value.items()}
30
+ if isinstance(value, (list, tuple)):
31
+ return [_portable(v) for v in value]
32
+ return value
33
+
34
+
35
+ @dataclass(frozen=True)
36
+ class Report:
37
+ """Canonical JSON fixes the report at creation time."""
38
+
39
+ canonical: str
40
+
41
+ @classmethod
42
+ def create(
43
+ cls,
44
+ records: Iterable[Record],
45
+ *,
46
+ definitions: Mapping,
47
+ assumptions: Iterable[str],
48
+ results: Mapping,
49
+ missing: Iterable[str],
50
+ parameters: Mapping,
51
+ ) -> Report:
52
+ rows = tuple(records)
53
+ data = {
54
+ "version": "0.1.0",
55
+ "backends": sorted({r.backend for r in rows}),
56
+ "records": [encode(r) for r in rows],
57
+ "input_sha256": fingerprint(rows),
58
+ "definitions": definitions,
59
+ "assumptions": list(assumptions),
60
+ "results": results,
61
+ "missing": list(missing),
62
+ "parameters": parameters,
63
+ }
64
+ return cls(
65
+ json.dumps(
66
+ _portable(data), allow_nan=False, sort_keys=True, separators=(",", ":")
67
+ )
68
+ )
69
+
70
+ def render(self, fmt: str) -> str:
71
+ if fmt == "json":
72
+ return self.canonical
73
+ if fmt == "html":
74
+ return (
75
+ "<article><h1>Calibration report</h1><pre>"
76
+ + html.escape(self.canonical)
77
+ + "</pre></article>"
78
+ )
79
+ if fmt != "csv":
80
+ raise ValueError("Report format must be json, csv or html")
81
+ stream = io.StringIO()
82
+ writer = csv.writer(stream)
83
+ writer.writerow(["section", "json_value"])
84
+ for key, value in json.loads(self.canonical).items():
85
+ writer.writerow([key, json.dumps(value, allow_nan=False, sort_keys=True)])
86
+ return stream.getvalue()
calibmap/series.py ADDED
@@ -0,0 +1,145 @@
1
+ """Offline descriptive and monitoring statistics."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from math import pi
6
+
7
+ import numpy as np
8
+ from scipy.optimize import curve_fit
9
+ from scipy.stats import norm, pearsonr, spearmanr
10
+
11
+
12
+ def vector(values: np.ndarray, minimum: int = 1) -> np.ndarray:
13
+ x = np.asarray(values, dtype=float)
14
+ if x.ndim != 1 or len(x) < minimum or not np.isfinite(x).all():
15
+ raise ValueError("Expected a finite one-dimensional sample")
16
+ return x
17
+
18
+
19
+ def describe(values: np.ndarray) -> dict[str, float]:
20
+ x = vector(values, 2)
21
+ median = np.median(x)
22
+ return {
23
+ "mean": float(x.mean()),
24
+ "median": float(median),
25
+ "variance": float(x.var(ddof=1)),
26
+ "mad": float(np.median(abs(x - median))),
27
+ "q05": float(np.quantile(x, 0.05)),
28
+ "q95": float(np.quantile(x, 0.95)),
29
+ }
30
+
31
+
32
+ def decay(times: np.ndarray, values: np.ndarray) -> tuple[float, float, float]:
33
+ t, x = vector(times, 4), vector(values, 4)
34
+ if t.shape != x.shape or np.any(np.diff(t) <= 0) or t[0] < 0 or np.ptp(x) == 0:
35
+ raise ValueError("Decay needs increasing times and an identifiable amplitude")
36
+ scale = t[-1] - t[0]
37
+
38
+ def model(s: np.ndarray, a: float, tau: float, b: float) -> np.ndarray:
39
+ return a * np.exp(-s / tau) + b
40
+
41
+ params, _ = curve_fit(
42
+ model,
43
+ t / scale,
44
+ x,
45
+ p0=(x[0] - x[-1], 0.5, x[-1]),
46
+ bounds=([-np.inf, 1e-12, -np.inf], np.inf),
47
+ maxfev=10000,
48
+ )
49
+ return float(params[0]), float(params[1] * scale), float(params[2])
50
+
51
+
52
+ def monitor(
53
+ values: np.ndarray, mean: float, sigma: float, alpha: float = 0.05, metrics: int = 1
54
+ ) -> np.ndarray:
55
+ """Two-sided Gaussian marginal alarms with summable alpha spending."""
56
+ x = vector(values)
57
+ if (
58
+ not np.isfinite([mean, sigma]).all()
59
+ or sigma <= 0
60
+ or type(metrics) is not int
61
+ or metrics < 1
62
+ or not 0 < alpha < 1
63
+ ):
64
+ raise ValueError("Invalid prespecified Gaussian reference")
65
+ t = np.arange(1, len(x) + 1, dtype=float)
66
+ return abs(x - mean) / sigma > norm.isf(3 * alpha / (pi * pi * metrics * t * t))
67
+
68
+
69
+ def segments(values: np.ndarray, penalty: float, minimum: int = 2) -> tuple[int, ...]:
70
+ """Exact retrospective least-squares partition, penalty per internal boundary."""
71
+ x = vector(values)
72
+ if (
73
+ type(minimum) is not int
74
+ or not 1 <= minimum <= len(x)
75
+ or not 0 <= penalty < np.inf
76
+ ):
77
+ raise ValueError("Invalid segmentation constraints")
78
+ x = x - x.mean()
79
+ s = np.r_[0.0, x.cumsum()]
80
+ q = np.r_[0.0, (x * x).cumsum()]
81
+ cost = np.full(len(s), np.inf)
82
+ cost[0] = -penalty
83
+ prev = np.zeros(len(s), dtype=int)
84
+ for end in range(minimum, len(s)):
85
+ starts = np.arange(end - minimum + 1)
86
+ scores = (
87
+ cost[starts]
88
+ + penalty
89
+ + q[end]
90
+ - q[starts]
91
+ - (s[end] - s[starts]) ** 2 / (end - starts)
92
+ )
93
+ prev[end] = starts[np.argmin(scores)]
94
+ cost[end] = scores.min()
95
+ cuts = []
96
+ at = int(prev[-1])
97
+ while at:
98
+ cuts.append(at)
99
+ at = int(prev[at])
100
+ return tuple(reversed(cuts))
101
+
102
+
103
+ def correlation(
104
+ a: dict[float, float], b: dict[float, float], lag: float = 0.0
105
+ ) -> dict[str, float]:
106
+ """Exact timestamp match at t and t+lag. Missing pairs are dropped."""
107
+ pairs = [
108
+ (v, b[t + lag])
109
+ for t, v in sorted(a.items())
110
+ if t + lag in b and np.isfinite([v, b[t + lag]]).all()
111
+ ]
112
+ if len(pairs) < 3:
113
+ raise ValueError("At least three aligned pairs required")
114
+ x, y = np.array(pairs).T
115
+ if min(np.ptp(x), np.ptp(y)) == 0:
116
+ raise ValueError("Constant matched series")
117
+ return {
118
+ "overlap": len(x),
119
+ "pearson": float(pearsonr(x, y)[0]),
120
+ "spearman": float(spearmanr(x, y)[0]),
121
+ }
122
+
123
+
124
+ def decay_diagnostics(times: np.ndarray, values: np.ndarray) -> dict:
125
+ """OLS residuals and local uncertainty for iid Gaussian, equal-variance errors."""
126
+ a, tau, b = decay(times, values)
127
+ t = np.asarray(times)
128
+ exponential = np.exp(-t / tau)
129
+ residual = np.asarray(values) - (a * exponential + b)
130
+ jac = np.column_stack((exponential, a * exponential * t / tau**2, np.ones(len(t))))
131
+ norms = np.linalg.norm(jac, axis=0)
132
+ condition = float(np.linalg.cond(jac / np.where(norms > 0, norms, 1)))
133
+ identifiable = bool(condition < 1e6 and np.all(norms > 0))
134
+ stderr = None
135
+ if identifiable:
136
+ inverse = np.linalg.pinv(jac)
137
+ variance = float(residual @ residual / (len(t) - 3))
138
+ stderr = np.sqrt(np.sum(inverse**2, axis=1) * variance).tolist()
139
+ return {
140
+ "parameters": (a, tau, b),
141
+ "residuals": residual.tolist(),
142
+ "stderr": stderr,
143
+ "scaled_condition": condition,
144
+ "locally_identifiable": identifiable,
145
+ }
@@ -0,0 +1,58 @@
1
+ """Uncertainty propagation under explicitly supplied calibration assumptions."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from collections.abc import Callable
6
+
7
+ import numpy as np
8
+ from scipy.stats import beta
9
+
10
+ from .readout import Binary, delta, interval
11
+
12
+
13
+ def posterior(
14
+ k: int, n: int, prior: tuple[float, float] = (1.0, 1.0), alpha: float = 0.05
15
+ ) -> dict:
16
+ interval(k, n, alpha)
17
+ if len(prior) != 2 or not all(0 < x < np.inf for x in prior):
18
+ raise ValueError("Positive finite beta prior required")
19
+ a, b = k + prior[0], n - k + prior[1]
20
+ return {
21
+ "shape": (a, b),
22
+ "mean": a / (a + b),
23
+ "credible": tuple(beta.ppf([alpha / 2, 1 - alpha / 2], a, b)),
24
+ }
25
+
26
+
27
+ def corrected_variance(
28
+ observed: float, assignment: Binary, covariance: np.ndarray
29
+ ) -> float:
30
+ """Joint covariance order is observed frequency, e0, e1."""
31
+ p, _ = assignment.invert(observed)
32
+ j = np.array([1.0, p - 1, p]) / assignment.contrast
33
+ return float(delta(j, covariance).item())
34
+
35
+
36
+ def propagate(
37
+ transform: Callable, mean: np.ndarray, cov: np.ndarray, draws: int, seed: int
38
+ ) -> np.ndarray:
39
+ """Gaussian parameter simulation. The transform receives one parameter vector at a time."""
40
+ mu = np.asarray(mean, dtype=float)
41
+ if mu.ndim != 1 or not np.isfinite(mu).all() or type(draws) is not int or draws < 2:
42
+ raise ValueError("Invalid mean or replicate count")
43
+ delta(np.eye(len(mu)), cov)
44
+ eigenvalues, axes = np.linalg.eigh(cov)
45
+ factor = axes * np.sqrt(np.maximum(eigenvalues, 0))
46
+ normals = np.random.default_rng(seed).standard_normal((draws, len(mu)))
47
+ samples = mu + np.einsum("ij,kj->ik", normals, factor)
48
+ return np.asarray([transform(x) for x in samples])
49
+
50
+
51
+ def independent_assignment(models: tuple[Binary, ...]) -> np.ndarray:
52
+ """Tensor factors in supplied order, first physical qubit most significant."""
53
+ if not models:
54
+ raise ValueError("Explicit qubit order required")
55
+ matrix = np.ones((1, 1))
56
+ for model in models:
57
+ matrix = np.kron(matrix, model.matrix)
58
+ return matrix
@@ -0,0 +1,41 @@
1
+ Metadata-Version: 2.4
2
+ Name: calibmap
3
+ Version: 0.1.0
4
+ Summary: Offline quantum calibration analytics and hardware stability diagnostics
5
+ License-Expression: Apache-2.0
6
+ Project-URL: Repository, https://github.com/Phasetensor/CalibMap
7
+ Requires-Python: >=3.11
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: numpy>=1.23
11
+ Requires-Dist: scipy>=1.9
12
+ Provides-Extra: ibm
13
+ Requires-Dist: qiskit-ibm-runtime; extra == "ibm"
14
+ Provides-Extra: interop
15
+ Requires-Dist: shotweave==0.2.0; extra == "interop"
16
+ Requires-Dist: bornlens==0.3.1; extra == "interop"
17
+ Dynamic: license-file
18
+
19
+ # CalibMap
20
+
21
+ Offline quantum calibration analytics for PhaseTensor. Development branch. Use timezone-aware calibration, acquisition and publication timestamps to reconstruct historical evidence. Keep provider estimates, synthetic experiments and acquired measurements identifiable throughout analysis.
22
+
23
+ ## Running the examples
24
+
25
+ With NumPy, SciPy and pytest installed, run the following from the checkout.
26
+
27
+ python -m pytest
28
+ PYTHONPATH=. python benchmarks/principal.py
29
+ PYTHONPATH=. python benchmarks/interoperability.py
30
+
31
+ The interoperability example also needs ShotWeave 0.2.0 and BornLens 0.3.1. It uses independent random calibration and confirmatory draws, fixed physical qubit ordering and a 10,000-shot design budget. The examples incur no hardware charges.
32
+
33
+ ## Methods
34
+
35
+ See [scientific design](docs/methodology.md) and [benchmark results](benchmarks/principal.json). Assignment matrices use observed rows and prepared columns. Converting a measured frequency back to prepared probability requires directional calibration and a well-conditioned matrix. The Gaussian monitoring thresholds require a prespecified mean and variance. Offline segmentation uses future observations and supports retrospective analysis only.
36
+
37
+ ## Evidence and installation
38
+
39
+ The development package builds with python -m build. Install the optional interop extra for the integrated example or the ibm extra for IBM Runtime property objects. The public API and limits are indexed in [the module matrix](docs/traceability.md). [Reproduction instructions](docs/advanced.md) cover the three case studies and figures. The scientific-studies artifact in Actions contains the generated figures and numerical results from the same run.
40
+
41
+ The [API guide](docs/api.md) lists input and output contracts by module. Python 3.11–3.14 have been exercised in CI. IBM Runtime and interoperation workflows are tested separately on the environments recorded in the validation workflow.
@@ -0,0 +1,16 @@
1
+ calibmap/__init__.py,sha256=QYmah4xUzFJoNBsvznOBvbRN-zvN9zDOyIRtvkIRNpY,3711
2
+ calibmap/diagnostics.py,sha256=LAbga98LFXfR-p3ZNzSnKhDzE9u9bNizg3WiF1tKSsU,3297
3
+ calibmap/experiment.py,sha256=0jF1l1zyU6D1XjksWiam62hVDkvhTB_bwadG6DtC9Qo,5516
4
+ calibmap/history.py,sha256=ggsebT1hnDFfq4n6EbiwPO0C1dQIdFMJkqimWZZVNew,3470
5
+ calibmap/planning.py,sha256=YqnaDmfNKo7fMpntofH9YbxcuSdbAu4IsXl1CL4S7Lk,6328
6
+ calibmap/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ calibmap/readout.py,sha256=-q1t3sKnmhOsMelHwrAL8U-5wAUWVNTGDa28O3fyzf0,3476
8
+ calibmap/records.py,sha256=QExGmxI-cHdbUbyOA2nALcX6qJub-Jkl77QUzm_cteE,3657
9
+ calibmap/reporting.py,sha256=bVxVO20eSAbpeZDnT2oEaLTh2k246-GrS1IIezgUaNk,2631
10
+ calibmap/series.py,sha256=lnKCW7Yl-iVv1egk-LTcszbWFYHz13GQR05LPR1JGWo,4860
11
+ calibmap/uncertainty.py,sha256=s_mPEjkYy8gP6LEBFXiM3cJpOdBGf3W-kLEHQtciPPg,2081
12
+ calibmap-0.1.0.dist-info/licenses/LICENSE,sha256=H4O_u2q2EtJEuWGbz2FeVMLhB_x4oF624WvBzkH9L48,10281
13
+ calibmap-0.1.0.dist-info/METADATA,sha256=iSvQHlovVoGfrgBl5YE4KsUt3gDivj-ivEoVz2IoaBs,2545
14
+ calibmap-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
15
+ calibmap-0.1.0.dist-info/top_level.txt,sha256=u1vfrZ0u3xFzWHSY51qQLYO9N7I1wOzqckCYWYI-bi8,9
16
+ calibmap-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,74 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
10
+
11
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
12
+
13
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
14
+
15
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
16
+
17
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
18
+
19
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
20
+
21
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
22
+
23
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
24
+
25
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
26
+
27
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
28
+
29
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
30
+
31
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
32
+
33
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
34
+
35
+ (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
36
+
37
+ (b) You must cause any modified files to carry prominent notices stating that You changed the files; and
38
+
39
+ (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
40
+
41
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
42
+
43
+ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
44
+
45
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
46
+
47
+ 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
48
+
49
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
50
+
51
+ 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
52
+
53
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
54
+
55
+ END OF TERMS AND CONDITIONS
56
+
57
+ APPENDIX: How to apply the Apache License to your work.
58
+
59
+ To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
60
+
61
+ Copyright [yyyy] [name of copyright owner]
62
+
63
+ Licensed under the Apache License, Version 2.0 (the "License");
64
+ you may not use this file except in compliance with the License.
65
+ You may obtain a copy of the License at
66
+
67
+ http://www.apache.org/licenses/LICENSE-2.0
68
+
69
+ Unless required by applicable law or agreed to in writing, software
70
+ distributed under the License is distributed on an "AS IS" BASIS,
71
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
72
+ See the License for the specific language governing permissions and
73
+ limitations under the License.
74
+
@@ -0,0 +1 @@
1
+ calibmap