@barivia/barmesh-mcp 0.6.2 → 0.6.3

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.
package/dist/tools/cfd.js CHANGED
@@ -25,7 +25,8 @@ COMMON MISTAKES: omitting feature_columns (required); choosing a reference_mesh
25
25
  backend: z.enum(["auto", "cpu", "gpu", "gpu_graphs"]).optional().describe("Compute backend (default auto / preset)"),
26
26
  stratify_scale: z.number().optional().describe("[0,1] per-mesh training-row cap; 1 uses all cells (default 1)"),
27
27
  emd_method: z.enum(["exact", "sinkhorn"]).optional().describe("EMD solver: exact LP (default) or sinkhorn (fast approximation for large grids)"),
28
- te_inner_samples: z.number().int().optional().describe("Inner statistical sample count for per-batch topographic error estimates during SOM training (default clamp(grid_nodes*6, 500, 10000); display cap remains ≤1000 batch points/phase)"),
28
+ te_panel_size: z.number().int().optional().describe("Fixed evaluation-panel size for live topographic error during training (default clamp(grid_nodes*6, 500, 10000); curve stays on this panel end-to-end)"),
29
+ te_inner_samples: z.number().int().optional().describe("Deprecated alias for te_panel_size"),
29
30
  component_planes_physical: z.boolean().optional().describe("Physical-scale component-plane colorbars (default true)"),
30
31
  figures: z.boolean().optional().describe("Generate publication figures (default true)"),
31
32
  transforms: z.record(z.enum(["log", "log1p", "log10", "sqrt", "square", "abs", "invert", "none"])).optional().describe("Per-feature transform applied before normalization (e.g. log1p to compress k/epsilon/omega). Same preprocessing engine as barsom training."),
@@ -40,6 +41,9 @@ COMMON MISTAKES: omitting feature_columns (required); choosing a reference_mesh
40
41
  if (v !== undefined && v !== null)
41
42
  params[k] = v;
42
43
  }
44
+ if (params.te_panel_size == null && params.te_inner_samples != null) {
45
+ params.te_panel_size = params.te_inner_samples;
46
+ }
43
47
  const body = { dataset_id, params };
44
48
  if (typeof label === "string" && label.length > 0)
45
49
  body.label = label;
@@ -16,25 +16,8 @@ export function isKernelTrainingComplete(data, status) {
16
16
  return true;
17
17
  return status === "completed";
18
18
  }
19
- /** Snap the last TE curve point to authoritative full-map TE when kernel training is done. */
20
- export function snapTeCurvesToMapTe(data) {
21
- const mapTe = data.map_topographic_error ??
22
- (data.kernel_complete === true ? data.topographic_error : null);
23
- if (mapTe == null || !Number.isFinite(Number(mapTe)))
24
- return data;
25
- const out = { ...data };
26
- for (const key of ["ordering_topographic_errors", "convergence_topographic_errors"]) {
27
- const arr = out[key];
28
- if (Array.isArray(arr) && arr.length > 0) {
29
- const copy = arr.slice();
30
- copy[copy.length - 1] = Number(mapTe);
31
- out[key] = copy;
32
- }
33
- }
34
- return out;
35
- }
36
- export function teCurveLabel(base, kernelComplete) {
37
- return kernelComplete ? `${base} (→ map TE)` : `${base} (sampled)`;
19
+ export function teCurveLabel(base, _kernelComplete = false) {
20
+ return `${base} (panel)`;
38
21
  }
39
22
  export function formatCurveSourceNote(data) {
40
23
  const src = data.training_curve_source_batches;
@@ -49,17 +32,20 @@ export function formatCurveSourceNote(data) {
49
32
  if (convTotal != null && convTotal > convShown) {
50
33
  parts.push(`${convShown} of ${convTotal.toLocaleString()} convergence batch samples`);
51
34
  }
52
- const mapTe = data.map_topographic_error;
53
- const epochTe = data.epoch_topographic_error;
54
- if (mapTe != null &&
55
- epochTe != null &&
56
- Number.isFinite(Number(mapTe)) &&
57
- Number.isFinite(Number(epochTe)) &&
58
- Math.abs(Number(epochTe) - Number(mapTe)) > 0.0005) {
59
- parts.push(`Live TE is a subsampled batch estimate during training; final point snaps to map TE ${Number(mapTe).toFixed(4)} (last sampled ${Number(epochTe).toFixed(4)})`);
35
+ const teEval = data.te_evaluation;
36
+ const panelM = teEval?.te_panel_size;
37
+ const panelN = teEval?.te_panel_n_train;
38
+ if (typeof panelM === "number" && typeof panelN === "number" && panelN > 0) {
39
+ const strat = teEval?.te_panel_stratified === true ? ", stratified by mesh" : "";
40
+ parts.push(`TE curve uses a fixed panel of ${panelM.toLocaleString()} of ${panelN.toLocaleString()} training rows${strat}`);
60
41
  }
61
- else if (mapTe != null && Number.isFinite(Number(mapTe))) {
62
- parts.push(`TE curve final point is full-map topographic error (${Number(mapTe).toFixed(4)}).`);
42
+ const panelTe = data.panel_topographic_error;
43
+ const mapTe = data.map_topographic_error;
44
+ if (panelTe != null &&
45
+ mapTe != null &&
46
+ Number.isFinite(Number(panelTe)) &&
47
+ Number.isFinite(Number(mapTe))) {
48
+ parts.push(`Panel TE ${Number(panelTe).toFixed(4)} · Map TE ${Number(mapTe).toFixed(4)} (full training set)`);
63
49
  }
64
50
  if (parts.length === 0)
65
51
  return null;
@@ -82,8 +68,7 @@ export function alignTeToQeAxis(te, qeLen) {
82
68
  return [...Array(pad).fill(null), ...te];
83
69
  }
84
70
  /**
85
- * Last sampled TE point from the (batch-aligned) live TE curve. This is the most
86
- * recent per-epoch TE estimate, distinct from the final trained-map TE in the summary.
71
+ * Last panel TE point from the (batch-aligned) live TE curve.
87
72
  */
88
73
  export function lastEpochTeFromCurves(data) {
89
74
  const conv = data.convergence_topographic_errors;
@@ -5,7 +5,7 @@
5
5
  import { apiCall } from "./shared.js";
6
6
  import { formatSnapshotLine, snapshotFromJob, } from "./job_monitor.js";
7
7
  import { formatJobStatusText } from "./job_status_format.js";
8
- import { lastEpochTeFromCurves, snapTeCurvesToMapTe } from "./training_monitor_curve.js";
8
+ import { lastEpochTeFromCurves } from "./training_monitor_curve.js";
9
9
  export const REVIEW_MAX_SNAPSHOTS = 16;
10
10
  function isTerminalStatus(status) {
11
11
  return status === "completed" || status === "failed" || status === "cancelled";
@@ -60,13 +60,13 @@ export async function enrichWithTrainingLog(job_id, data) {
60
60
  if (isTerminalStatus(status)) {
61
61
  merged.topographic_error = mapTe;
62
62
  }
63
- return snapTeCurvesToMapTe(merged);
63
+ return merged;
64
64
  }
65
65
  catch {
66
66
  if (epochTe != null) {
67
- return snapTeCurvesToMapTe({ ...data, epoch_topographic_error: epochTe });
67
+ return { ...data, epoch_topographic_error: epochTe };
68
68
  }
69
- return data.kernel_complete === true ? snapTeCurvesToMapTe(data) : data;
69
+ return data;
70
70
  }
71
71
  }
72
72
  /** Evenly sample indices for a compact epoch/QE timeline in review mode. */