Expand description
spectrafit-core — PyO3 cdylib bindings.
Exposes Python-callable functions:
fit(graph_json, data_json, options_json) -> strfit_arrays(graph_json, x, y, sigma, dataset_sizes, n_dims, options_json) -> strfit_arrays_numpy(graph_json, x, y, sigma, dataset_sizes, n_dims, options_json) -> (str, ndarray)— likefit_arrays, but bypasses JSON serialisation of per-point arrays and returns the fitted curve as a NumPy arrayevaluate(graph_json, params_json, data_json) -> strevaluate_components(graph_json, params_json, data_json) -> strmodel_type_wire_strings() -> str— returns the canonical wire-format string of every supported model type, inModelTypeStrdeclaration order
fit accepts JSON-encoded data (backwards-compatible, MCP-friendly).
fit_arrays accepts raw numpy buffers and eliminates JSON serialisation
of measurement data — the dominant bottleneck for large datasets.
fit_arrays_numpy extends fit_arrays: returns (compact_json, best_fit_ndarray)
so the large per-point arrays bypass JSON entirely, cutting 2–3 ms per call.
Graph/options remain JSON for reproducibility and language-neutrality.
CoreError maps to PyValueError so Python callers receive a descriptive
ValueError.