itasc.contact_analysis.dynamics.collective¶
Tissue-scale collective motion: alignment, velocity correlation, length scale.
Consumes the per-frame instantaneous table (positions + velocities, the single source of truth) and, for each frame, measures how coherently neighbours move:
order parameter
φ = |⟨v_i/|v_i|⟩|∈ [0,1] — 0 random, 1 fully aligned (uses raw velocities).velocity correlation of fluctuations
δv_i = v_i − ⟨v⟩(the per-frame drift removed):C(r) = ⟨δv_i·δv_j⟩_{|r_i−r_j|≈r} / ⟨δv_i·δv_i⟩, normalised soC → 1asr → 0.correlation length
ξ= the separation whereC(r)decays to1/e(linear interpolation between bin centres); NaN when it never does.nearest-neighbour distance (median, per frame) — a natural length scale and the default correlation bin width.
Pairs are binned by separation with width corr_bin_um (defaults to the global
median NN distance). The per-frame C(r) curves are also pooled across frames
into a single dataset-level curve. Pure NumPy; no I/O.
Module attributes
Per-frame collective columns. |
|
Pooled correlation-curve columns. |
Functions
|
Return |
|
Single per-tissue correlation length |
- itasc.contact_analysis.dynamics.collective.COLLECTIVE_COLUMNS = ('frame', 'n_cells', 'order_param', 'corr_length_um', 'nn_distance_um')¶
Per-frame collective columns.
- itasc.contact_analysis.dynamics.collective.CORR_CURVE_COLUMNS = ('separation_um', 'corr', 'n_pairs')¶
Pooled correlation-curve columns.
- itasc.contact_analysis.dynamics.collective.collective_tables(instantaneous, *, corr_bin_um=None, min_cells=5)[source]¶
Return
(collective_table, corr_curve_table)from the instantaneous table.min_cells is the minimum velocity-bearing cells a frame needs for its correlation/alignment metrics (fewer → NaN, but the frame’s NN distance is still recorded). corr_bin_um defaults to the global median NN distance.
- itasc.contact_analysis.dynamics.collective.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.