Pipeline

The xarray-based post-processing track: pure Dataset → Dataset stages driven by a YAML recipe, chained in the order they are meant to run. “Post-processing” here means: bin Lagrangian particle data to an Eulerian grid, phase/ensemble-average it, derive turbulence metrics, and export.

flowtracks.eulerian

flowtracks.eulerian.eulerian_grid() is the central stage: it bins ZarrScene/Scene particle observations onto a regular (x, y, z, phase) grid, returning a xarray.Dataset whose dimensions and coordinates come from the input data. Companion functions:

  • flowtracks.eulerian.eulerian_windowed() — per-time-window binning

  • flowtracks.eulerian.clean_field() — mask or remove bad cells

  • flowtracks.eulerian.fluid_mask() / flowtracks.eulerian.qc_mask() — plausibility masks

  • flowtracks.eulerian.finite_difference_velocity() — derivatives from a grid

  • flowtracks.eulerian.derived_fields() — MKE, TKE, VSS, …

  • flowtracks.eulerian.save_zarr() / flowtracks.eulerian.save_dataset() / flowtracks.eulerian.save_netcdf() — writers

The per-run ensemble and pooled (per-voxel moment) workflows are described in docs/eulerian_statistics.md in the repository; the same module also hosts flowtracks.eulerian.run_post_analysis_ds(), flowtracks.eulerian.run_pooled_analysis_ds(), flowtracks.eulerian.combine_moments() and flowtracks.eulerian.moment_statistics().

flowtracks.phase_average

Phase averaging as pure Dataset → Dataset functions, driven by a YAML recipe:

  • flowtracks.phase_average.phase_average()

  • flowtracks.phase_average.fluctuations()

flowtracks.phasing

Canonical phase-bin definitions shared with the OpenPTV family: flowtracks.phasing.validate_bins(), flowtracks.phasing.phase_of_frame(), flowtracks.phasing.bin_of_frame(), flowtracks.phasing.assign_bins().

flowtracks.pipeline

Thin per-stage wrappers, each independently runnable — the unit the openptv-cloud orchestrator distributes:

Each reads its configuration from a YAML recipe.

flowtracks.provenance

flowtracks.provenance.record_run() and flowtracks.provenance.read_runs() record what was run, with which parameters, and what it produced — entries appended to run.zarr’s meta.attrs["runs"].

Modular pipeline for 3DPTV data processing.

Each function is one independently-runnable stage (the decomposition the cloud orchestrator will distribute). All computation lives in the xr modules and the stage wrappers — nothing is implemented here twice.

flowtracks.pipeline.ptv_is_to_lagrangian(set_name, config, base='.')[source]
flowtracks.pipeline.lagrangian_to_eulerian(set_name, config, grid_params, base='.')[source]
flowtracks.pipeline.phase_average_all_sets(config, grid_params)[source]
flowtracks.pipeline.compute_fluctuations(set_name, config)[source]
flowtracks.pipeline.compute_turbulent_statistics(config)[source]
flowtracks.pipeline.streamlined_pipeline(config_path='config.yaml', grid_path='grid.yaml', recipe_path='post_recipe.yaml', base='.')[source]

Streamlined in-memory pipeline.

  1. Step 1: ptv_is -> Lagrangian HDF5 (via flowtracks).

  2. Step 2: Bin Lagrangian scenes directly into in-memory xarray Datasets.

  3. Steps 3-5: Run phase-averaging, fluctuations, turbulent statistics and derived fields directly on xarray Datasets in memory.

  4. Save final output as NetCDF or Zarr with rich CF metadata for ParaView, and optionally export binary VTK files.

flowtracks.pipeline.main()[source]