mirror of
https://github.com/K-Dense-AI/scientific-agent-skills.git
synced 2026-12-04 17:53:59 +08:00
* add OpenPIV skill under skills/openpiv
* Fix spec violations and unverified APIs in the OpenPIV skill
Verified everything against openpiv 0.25.4 in a clean venv; all 14 SKILL.md
snippets and both reference snippets now execute, and runner.py/run_example.py
run end to end on OpenPIV's bundled test1 pair.
Spec adherence:
- metadata was a JSON flow mapping, which strictyaml rejects outright -- the
skill failed `skills-ref validate` and would not have registered at all.
Converted to a block mapping.
- compatibility claimed Python 3.8+; openpiv 0.25.4 requires >=3.10.
- Added allowed-tools and a version-pinned install line.
APIs that do not exist and now do:
- `openpiv.masking` -> `openpiv.preprocess.dynamic_masking`, which returns
(image, mask). method="shirai" is not a method; it is "edges" or "intensity".
The masked image is returned already zeroed, so multiplying the frame by the
mask is wrong -- for "edges" the mask is uint8 0/255 and rescales by 255.
- `pyprocess.iterative_warping_piv` -> `openpiv.windef.simple_multipass`.
- `openpiv.smooth.smooth` -> `openpiv.smoothn.smoothn`.
- `global_val(u, v, u_threshold=, v_threshold=)` -> positional (min, max) tuples
as u_thresholds/v_thresholds.
- `local_median_val(u, v)` -> u_threshold and v_threshold are required.
- `replace_outliers(method="disc")` -> "disk"; an unknown method is not
rejected, it silently yields an all-zero kernel.
- Combining flags with np.maximum -> boolean OR; validators return bool arrays
where True marks a spurious vector.
references/advanced_algorithms.md described algorithms that do not exist in
OpenPIV ("epi-div_div", "pritzmd_piv", EDD, PrTrZMD) alongside invented
throughput and memory figures. Replaced with the real correlation, subpixel,
s2n, multi-pass, 3D, and phase-separation APIs plus the full PIVSettings table.
Two units traps found while testing and now documented:
- windef ignores settings.dt and settings.scaling_factor -- first_pass calls
extended_search_area_piv without dt, so the chain returns px/frame.
- global_val/local_median_val thresholds are in the units of u and v. After
extended_search_area_piv(dt=0.02) that is px/s, so the conventional (-30, 30)
px/frame limit rejects the entire field.
Scripts:
- runner.py: dropped --algorithm and --threads, which were accepted and never
used (--algorithm even offered a nonexistent "synthetic_aperture"), and
--mask static, which nothing implemented. --mask dynamic silently did nothing
because it caught the ImportError from the nonexistent module. Selects
correlation_method="linear" when search_area > window_size, since the default
"circular" aliases via FFT wrap-around. Validates argument ranges, pins the
Agg backend before pyplot, and no longer NaNs out the vectors it just
interpolated -- that is now opt-in via --drop_invalid.
- analyze.py: class was named PypivAnalyzer and documented as "using pivpy"
while importing neither. Renamed to PIVAnalyzer, added compute_strain and
compute_statistics to match what SKILL.md advertises, and derived the physical
grid spacing from the saved coordinates so the gradients are per unit length.
- run_example.py: was a subprocess wrapper around a hardcoded relative path.
Rewritten as a self-contained smoke test on OpenPIV's bundled image pair.
Security scan: SAFE, 0 findings.
---------
Co-authored-by: Timothy Kassis <timothy.kassis@k-dense.ai>