Repository navigation
uPrime v0.9.0
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
uprimepackage.from core.loader import ...becomesfrom uprime.core.loader import ...; likewise forgui. core.dmd.build_snapshot_matrixreturns(X, n_per, info)instead of(X, n_per). Passinfo["mask"]toget_mode_components, not the datasetMASK— gappy points are dropped, so it no longer matchesn_per.pyfftwis now a required dependency, not an optional extra. Thefftwextra is gone;spatial_spectra_fftimports it at module level.
Added
pip install -e .and auprimecommand. The GUI launches from the console script;python main.pystill works.- Distribution name
uprime-pivon PyPI, sinceuprimeis taken by an unrelated package. The import name is stilluprime. docs/API.md, documenting every public function inuprime.core, with a runnableexamples/core_api_example.pycovering the common workflow.- CI on Windows, macOS and Linux, running the suite across Python 3.10 and 3.12 on every push.
CONTRIBUTING.mdandCITATION.cff, covering development setup, the build variants, the version-bump checklist and how to cite uPrime.filled_fractionin 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
.datfiles (v0.4.1 through v0.8.2).load_single_fileread each snapshot'sisValidcolumn, butload_datasetkept only the first snapshot's. Every later snapshot's invalid vectors stayed inU,VandWas whatever the file contained — for a DaVis export that is normally0.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
.datdata 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 noisValidcolumn, are unaffected.All three loaders now follow one rule: a vector invalid in a snapshot is NaN in that snapshot, and
MASKmarks a grid point invalid only if it is invalid in every snapshot. This also fixes the opposite problem in the.vc7and.matloaders, which setMASKto 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_dmdhad no gap handling and failed inside the SVD withLinAlgError: SVD did not convergeon a snapshot matrix containing NaN. The DMD window did not crash, becauseDMDWorkercallednp.nan_to_numfirst, 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-Uagainst the local mean, injecting broadband energy and shifting the mode frequencies. Gap handling now lives incore.dmd.build_snapshot_matrixon 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_dmdadditionally rejects non-finite input with a clearValueErrorinstead of failing in the SVD. -
.datfiles written with y ascending loaded mirrored vertically.load_gridflips rows only when y descends, so that row 0 always holds the smallest y, butload_single_fileflipped 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 toxandy. Nothing warned, and no summary statistic changes under a row flip.load_gridnow records its decision inheader["flip_rows"]andload_single_filefollows it. The flag defaults toTruewhen absent, so a caller that skipsload_gridkeeps the old behaviour. -
.matfiles written with y descending loaded upside down relative to.datand.vc7cases. uPrime's convention is row 0 = smallest y;core.loader.load_gridandcore.davis_ioboth enforce it, butmat_loadertook the file's own row order as given. Such a file loaded self-consistently —ydescended too, so every plot looked right — and nothing warned, but row indices were mirrored and a.matcase could not be compared with a.dator.vc7case of the same flow.x,y,U,V,Wand the validity mask are now flipped together when y descends, and the decision is recorded indataset["header"]["flip_rows"]. The flip uses reversed views, and the per-snapshotisValidpath 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_ioalready flipped columns to makexascend, but the.datand.matloaders took the file's column order as given. A file written withxdescending loaded with column 0 at the far end of the domain. As with the row case it was self-consistent —xdescended too, so every plot was correct anddxstayed positive — but column indices, line profiles taken by column, and Compare Cases were mirrored against a.vc7case of the same flow.core.loaderandcore.mat_loadernow reversex,y,U,V,W, the vorticity and the validity mask along the column axis whenxdescends.load_gridrecords the decision inheader["flip_cols"]andload_single_filefollows it, exactly as forflip_rows; the flag defaults toFalsewhen absent, so a caller that skipsload_gridis unaffected. All three loaders now share one convention: row 0 = smallesty, column 0 = smallestx.