Wave 8 — depth across four fronts: Studio — @lawsynth/api-client gains the real discovery-run endpoints; the Studio discovery flow now drives the LIVE client (submit -> bounded-poll -> getWorld -> feed screens), with an in-memory fake transport for offline end-to-end tests. Export — lawsynth export --format c|onnx|matlab. The C compiles clean and matches the engine to ~1e-14; ONNX is an honest computation-graph JSON (each node mapped to its standard ONNX op, DAG-interned, evaluator-verified); MATLAB .m emitted. Notebook — WorldExplorerWidget: a self-contained embedded-JS widget that re-simulates in-browser on slider drag (no kernel round-trip); factors each discovered coefficient into a tunable parameter. study.discover().explore(). Performance — single-pass streaming CSV parser: 3.19x faster ingest (500k rows 224ms->70ms, 328 MiB/s; 1M rows 7.2M rows/s), byte-for-byte identical output (equivalence-tested), plus streaming Read-based loaders + progress callbacks + a scale benchmark. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
29 lines
1.3 KiB
Rust
29 lines
1.3 KiB
Rust
use lawsynth_core::Identifier;
|
|
use lawsynth_data::{Dataset, NumericColumn, TimeAxis};
|
|
use lawsynth_preprocess::{resample_linear_with_report, standardize, unstandardize};
|
|
|
|
#[test]
|
|
fn resampling_and_scale_roundtrip_preserve_interpolated_values_and_units() {
|
|
let original = Dataset::new(
|
|
TimeAxis::new(vec![0.0, 2.0]).unwrap(),
|
|
[NumericColumn::new(Identifier::new("x").unwrap(), vec![1.0, 5.0]).with_unit("m")],
|
|
)
|
|
.unwrap();
|
|
let (resampled, report) =
|
|
resample_linear_with_report(&original, TimeAxis::new(vec![0.0, 1.0, 2.0]).unwrap())
|
|
.unwrap();
|
|
assert_eq!(resampled.columns()[&Identifier::new("x").unwrap()].values, vec![1.0, 3.0, 5.0]);
|
|
assert_eq!(report.target_time, resampled.time().values());
|
|
let (scaled, scale_report) = standardize(&resampled).unwrap();
|
|
let restored = unstandardize(&scaled, &scale_report).unwrap();
|
|
assert_eq!(restored.time(), resampled.time());
|
|
assert_eq!(restored.columns()[&Identifier::new("x").unwrap()].unit, Some("m".into()));
|
|
assert!(
|
|
restored.columns()[&Identifier::new("x").unwrap()]
|
|
.values
|
|
.iter()
|
|
.zip(&resampled.columns()[&Identifier::new("x").unwrap()].values)
|
|
.all(|(actual, expected)| (actual - expected).abs() < 1e-12)
|
|
);
|
|
}
|