Skip to content

uPrime v0.9.0

Choose a tag to compare

@CmdrRyder CmdrRyder released this 08 Nov 14:19
· 14 commits to main since this release

uPrime is now an installable Python package with a documented API, and drops the "alpha" label. This release also corrects how invalid vectors are handled when loading data — see the first entry under Fixed before reusing any result produced by an earlier version.

Breaking

  • Code now lives in the uprime package. from core.loader import ... becomes from uprime.core.loader import ...; likewise for gui.
  • core.dmd.build_snapshot_matrix returns (X, n_per, info) instead of (X, n_per). Pass info["mask"] to get_mode_components, not the dataset MASK — gappy points are dropped, so it no longer matches n_per.
  • pyfftw is now a required dependency, not an optional extra. The fftw extra is gone; spatial_spectra_fft imports it at module level.

Added

  • pip install -e . and a uprime command. The GUI launches from the console script; python main.py still works.
  • Distribution name uprime-piv on PyPI, since uprime is taken by an unrelated package. The import name is still uprime.
  • docs/API.md, documenting every public function in uprime.core, with a runnable examples/core_api_example.py covering the common workflow.
  • CI on Windows, macOS and Linux, running the suite across Python 3.10 and 3.12 on every push.
  • CONTRIBUTING.md and CITATION.cff, covering development setup, the build variants, the version-bump checklist and how to cite uPrime.
  • filled_fraction in POD and DMD results, the fraction of values entering the decomposition that had to be gap-filled; both windows show it in their status line when it is non-zero.

Fixed

  • Invalid vectors from every snapshot after the first were treated as real data when loading .dat files (v0.4.1 through v0.8.2). load_single_file read each snapshot's isValid column, but load_dataset kept only the first snapshot's. Every later snapshot's invalid vectors stayed in U, V and W as whatever the file contained — for a DaVis export that is normally 0.0 — and were averaged in as genuine measurements. This biases the mean toward zero and inflates every fluctuation statistic. On a synthetic case with 5% of vectors invalid and written as zero, the mean streamwise velocity read 4.75 m/s instead of 5.00, and <u'u'> read 1.42 (m/s)² instead of 0.25 — a factor of 5.7.

    If your .dat data contains invalid vectors, any mean, Reynolds stress, TKE, spectrum, correlation or modal result produced by v0.4.1 through v0.8.2 should be recomputed. Datasets with no invalid vectors, or whose files have no isValid column, are unaffected.

    All three loaders now follow one rule: a vector invalid in a snapshot is NaN in that snapshot, and MASK marks a grid point invalid only if it is invalid in every snapshot. This also fixes the opposite problem in the .vc7 and .mat loaders, which set MASK to the points valid in all snapshots, so a single bad vector blanked that grid point for the whole series.

  • DMD crashed on data with invalid vectors, and filled raw velocity with zero. compute_dmd had no gap handling and failed inside the SVD with LinAlgError: SVD did not converge on a snapshot matrix containing NaN. The DMD window did not crash, because DMDWorker called np.nan_to_num first, but that fills with a literal zero: with subtract mean switched off the matrix holds raw velocity, so every invalid vector became a spike of -U against the local mean, injecting broadband energy and shifting the mode frequencies. Gap handling now lives in core.dmd.build_snapshot_matrix on the same terms as POD — grid points that are NaN in 10% or more of the snapshots are dropped, and the remaining gaps are filled with that point's own temporal mean, which is zero for a mean-subtracted field and the local mean velocity for a raw one. The two settings now agree. compute_dmd additionally rejects non-finite input with a clear ValueError instead of failing in the SVD.

  • .dat files written with y ascending loaded mirrored vertically. load_grid flips rows only when y descends, so that row 0 always holds the smallest y, but load_single_file flipped unconditionally. DaVis writes y descending, so the two cancelled out on real exports and the bug never showed there; a file written the other way round — a Tecplot export from a non-DaVis source, or a hand-built file — loaded with the velocities upside down relative to x and y. Nothing warned, and no summary statistic changes under a row flip. load_grid now records its decision in header["flip_rows"] and load_single_file follows it. The flag defaults to True when absent, so a caller that skips load_grid keeps the old behaviour.

  • .mat files written with y descending loaded upside down relative to .dat and .vc7 cases. uPrime's convention is row 0 = smallest y; core.loader.load_grid and core.davis_io both enforce it, but mat_loader took the file's own row order as given. Such a file loaded self-consistently — y descended too, so every plot looked right — and nothing warned, but row indices were mirrored and a .mat case could not be compared with a .dat or .vc7 case of the same flow. x, y, U, V, W and the validity mask are now flipped together when y descends, and the decision is recorded in dataset["header"]["flip_rows"]. The flip uses reversed views, and the per-snapshot isValid path flips one plane at a time, so a multi-GB HDF5 case costs no extra memory.

  • Column order is now normalised too, so column 0 holds the smallest x. davis_io already flipped columns to make x ascend, but the .dat and .mat loaders took the file's column order as given. A file written with x descending loaded with column 0 at the far end of the domain. As with the row case it was self-consistent — x descended too, so every plot was correct and dx stayed positive — but column indices, line profiles taken by column, and Compare Cases were mirrored against a .vc7 case of the same flow. core.loader and core.mat_loader now reverse x, y, U, V, W, the vorticity and the validity mask along the column axis when x descends. load_grid records the decision in header["flip_cols"] and load_single_file follows it, exactly as for flip_rows; the flag defaults to False when absent, so a caller that skips load_grid is unaffected. All three loaders now share one convention: row 0 = smallest y, column 0 = smallest x.