itasc.contact_analysis.dynamics¶
Track-dynamics compute core: motion read off tracked label stacks.
The headless backend for the dynamics quantifiers. A tracked label stack becomes
per-track centroid trajectories (trajectories), then instantaneous
velocities + per-track motility summaries (kinematics), an ensemble
mean-square-displacement curve with a power-law fit (msd), and
tissue-scale collective metrics — alignment, velocity correlation, length scale
(collective). build_track_dynamics() runs all of it and persists a
multi-table .h5; read_track_dynamics() loads it back. No Qt / napari
import, so scripts and the standalone wheel can use it.
- class itasc.contact_analysis.dynamics.TrackDynamics(instantaneous, tracks, msd, dac, collective, corr_curve, msd_D_um2_per_s, msd_alpha, msd_r2, dac_persistence_time_s, corr_length_um)[source]¶
Bases:
objectIn-memory view of a dynamics
.h5— every table plus the fit scalars.- Parameters:
- class itasc.contact_analysis.dynamics.Trajectory(track_id, frames, xy)[source]¶
Bases:
objectOne track’s centroid path in µm, in frame order.
framesis strictly increasing (one entry per frame the track is present);xyis the matching(N, 2)array of(x_um, y_um)centroids. A jump of more than 1 between consecutiveframesis a gap.
- itasc.contact_analysis.dynamics.build_track_dynamics(label_path, output_path, *, pixel_size_um, time_interval_s, source_path=None, params=None, quantity_id='', progress_cb=None)[source]¶
Compute every dynamics table from a tracked label TIFF and write the
.h5.
- itasc.contact_analysis.dynamics.extract_trajectories(label_path, *, pixel_size_um, progress_cb=None)[source]¶
Read a tracked label TIFF and return one
Trajectoryper track id.Centroids come from
regionprops(frame).centroid(row, col) scaled by pixel_size_um into(x_um, y_um). Trajectories are sorted by track id; each is internally sorted by frame.
- itasc.contact_analysis.dynamics.per_track_msd_fit(trajectories, *, time_interval_s, window_frames=8)[source]¶
Fit each track’s own MSD over a shared fixed lag window →
track_id → MsdFit.For each track the MSD is averaged over its present
(k, k+n)origin pairs for lags1 … window_frames(the same rule asensemble_msd(), capped at the window), then fit in log-log. A track that cannot fill at least two distinct lags within the window yieldsMsdFit(nan, nan, nan), so itsD/α/r2are NaN rather than a spurious single-point slope.
- itasc.contact_analysis.dynamics.pooled_corr_length(corr_curve)[source]¶
Single per-tissue correlation length
ξfrom the pooledC(r)curve.Applies the same
1/ecrossing rule as the per-framecorr_length_umcolumn to the dataset-level pooled curve; returnsNaNwhen the curve is empty or never decays to1/e.
- itasc.contact_analysis.dynamics.read_instantaneous_table(path)[source]¶
The
(frame, cell_id, …)instantaneous table — the tidy-table contract.
- itasc.contact_analysis.dynamics.read_track_dynamics(path)[source]¶
Load a dynamics
.h5into aTrackDynamics.- Return type:
- Parameters:
- itasc.contact_analysis.dynamics.trajectories_from_stack(label_stack, *, pixel_size_um, progress_cb=None)[source]¶
extract_trajectories()over an in-memoryT×Y×Xlabel stack.
Submodules
Tissue-scale collective motion: alignment, velocity correlation, length scale. |
|
Per-frame velocities, per-track motility summaries, and persistence times. |
|
Ensemble time-averaged mean-square displacement and its power-law fit. |
|
Persist / read the track-dynamics artifact and orchestrate the build. |
|
Tracked label stack → per-track centroid trajectories (µm), gaps preserved. |