SCIENTIFIC WORKFLOWS / HONEST COMPARISONS

Follow a question through the data.

What gets simpler—and what the preview cannot do yet.

These examples connect the founder’s research frustrations to concrete programs. The working spectroscopy task uses a fully visible in-memory fixture. HDF5 ingestion, general lazy data pipelines and stacked-image browsing are separately labelled design goals. Speed and peak-memory comparisons are UNMEASURED.

1. Compare spectra along the energy axis

Four sampling sites × three energy channels. Find each spectrum’s maximum minus minimum, select site 2, then plot it. Inputs use floating-point values in both languages. The calculation has no file I/O.

The useful difference: NumPy already expresses this reduction concisely with np.ptp(..., axis=1). VKF makes the selected dimension part of function application: span_u(spectra_pu) keeps energy intact and lifts over sites. The function does not need to know which positional axis it occupies.

This is a clarity comparison, not a claim that VKF is always shorter. Setup and the complete core task are shown for both; no helper implementation or plotting work is hidden.

Python · setup and fixture

import numpy as np
import matplotlib.pyplot as plt

energy = np.array([-1., 0., 1.], dtype=np.float64)
spectra = np.array([[1., 5., 2.], [2., 3., 4.],
                    [3., 8., 4.], [4., 5., 6.]], dtype=np.float64)

Python · complete core task

contrast = np.ptp(spectra, axis=1)
selected = spectra[2, :]
print(contrast)
print(selected)
fig, ax = plt.subplots(dpi=96)
ax.plot(energy, selected, color=(.25, .72, 1., 1.), linewidth=.75)
ax.set(xlim=(-1, 1), ylim=(0, 10))
plt.show()

VKF · setup and fixture

stat:.stat
energy:[-1.0,0.0,1.0]_u
spectra:[[1.0,5.0,2.0],[2.0,3.0,4.0],
         [3.0,8.0,4.0],[4.0,5.0,6.0]]_pu

VKF · complete core task

span(x):stat.max(x)-stat.min(x)
contrast:span_u(spectra)
::contrast
selected:spectra.(2,:)
::selected
view:.ui.viewport
view.add(x:energy_u,y:selected_u,color:[0.25,0.72,1,1])
view.push(x_lim:[-1,1],y_lim:[0,10])
view.show()

Run this exact VKF program →

Expected numerical results: contrast [4, 2, 5, 2]; selected spectrum [3, 8, 4]. Both plots request the same blue RGBA color and x/y bounds. The VKF packet contains three float32 render vertices; Python computes with float64 arrays. The fixture values are exactly representable; this is not a general precision or pixel-equivalence claim. Native plot defaults, fonts and controls differ.

Reference APIs: NumPy ptp and Matplotlib plot. NumPy supports reductions over one or several axes; this working VKF workflow verifies one selected energy axis only.

Bind a model parameter without a wrapper

Keep a cubic response function while leaving its input free. Both languages support this naturally: Python provides functools.partial; VKF makes named argument binding part of the call grammar. This removes a separate import and keeps the binding alongside the language’s ordinary function syntax.

Python · setup

from functools import partial

Python · complete core task

def power(x, n):
    return x ** n

cube = partial(power, n=3)
print(cube(2))

VKF · no setup import

The operation is part of the language.

VKF · complete core task

power(x,n):x^n
cube:power[n:3]
::cube(2)

Both print 8. The shorter function definition and built-in binding syntax are visible here; no speed advantage is inferred. Run the canonical partial-application examples →

2. Inspect a small part of an HDF5 dataset

Python can already read selected elements and slices directly. Apply the transformation after selecting the data. This is the appropriate baseline, rather than loading an entire dataset just to inspect one element.

Python · optional fixture-file setup

import h5py

with h5py.File("spectra.h5", "w") as file:
    file.create_dataset("intensity", data=spectra)

Python · complete selected-read task

with h5py.File("spectra.h5", "r") as file:
    dataset = file["intensity"]
    one = np.sin(dataset[2, 1])
    region = np.sin(dataset[1:3, 0:2])

The logical selection is one scalar and a 2 × 2 region. Physical disk reads depend on storage layout, compression, chunks and caches; bytes read and cold/warm performance are unmeasured here. h5py documents direct hyperslab selection and chunked I/O.

VKF · design goal, no runnable equivalent yet

The goal is for consumer demand to flow through transformations so that asking for one transformed value avoids unrelated work. This 0.7.2 site has no verified public HDF5 reader or out-of-core pipeline. There is intentionally no invented VKF import, API or Run button for that workflow. The finite-demand range example establishes a smaller capability only.

3. Browse related maps without rebuilding the viewer

The founder once built a viewer simply to step through 100 images. VKF’s visual design aims to reuse one layer/property model and append states for stacked views. That would reduce the glue between a calculation and the views used to inspect it.

Matplotlib already has image display, widgets and animation tools; a fixed imshow image can be updated with set_data. A custom stack browser still needs an input/control connection. No executed, equivalent 100-image comparison is claimed here.

Current boundary: the preview’s coordinate layers, push with explicit bounds, and displayed plots are tested. General append-driven image stacks and a published HDF5-to-viewer path remain unqualified. See the UI module inventory. Automatic CPU/GPU placement and speed are also not established by this example.

4. Solve constraints, derive a path, inspect its motion

A cubic trajectory is useful when designing an experimental scan or controlled motion. This unchanged program solves four endpoint constraints, differentiates the resulting parameterized function and draws time curves and a position–velocity portrait. It demonstrates .linalg.solve and an exact function transform, not a complete first-class symbolic library.

Run it, then change exit_slope:0 to exit_slope:-2. A requested negative arrival velocity makes the path overshoot and reverse before reaching its endpoint.

Loading compiler…
Compiler output · blue position · orange velocity · green phase portrait

Your model, two views

From constraints to a curve

p(0) = 0
p(1) = 1
p′(0) = 0
p′(1) = exit_slope

Run to see the compiler’s output here.

Blue · position over time
Orange · velocity over time
Green · position against velocity

Change the endpoint slope in the source, then run again to compare the motion.

Expected behavior

Zero endpoint slopes give coefficients [0,0,3,-2]. At t = 0.5, position is 0.5 and velocity is 1.5. Two actual viewports appear after execution.

What is verified, and what is not

Machine-readable comparison coverage records the fixture, code hashes, version pins, actual checks and remaining claims. The site verification report records each promoted source program. Fewer lines do not establish less I/O, lower memory use or greater speed.

ClaimScopeStatus
Named-axis spectral contrast and selected curve4 × 3 explicit fixture, 0.7.2 browser compilerActual execution checked; full UI qualification passed; see the evidence
Equivalent Python numerical task and selected HDF5 readsSame explicit fixture; versions in evidenceExecuted locally
General VKF HDF5/out-of-core demandNo verified API in this previewUnsupported / design goal
General stacked-image browsingNo equivalent paired program qualifiedDesign goal / unqualified
Speed, I/O bytes and peak memory advantageNeeds versioned matched benchmark evidenceUNMEASURED