slitflow.trj.subtrj module

class Subtrajectory(info_path=None)[source]

Bases: Table

Break down a trajectory into multiple subtrajectories.

Reference:

Ito, Y., Sakata-Sogawa, K. & Tokunaga, M. Multi-color single-molecule tracking and subtrajectory analysis for quantification of spatiotemporal dynamics and kinetics upon T cell activation. Sci Rep 7, 6994 (2017). https://doi.org/10.1038/s41598-017-06960-z

Parameters:
  • reqs[0] (Trajectory) – Trajectory data.

  • param["step"] (int) – Step number of the subtrajectory. An N-step subtrajectory consists of N + 1 localizations.

  • param["group_depth"] (int) – Groupby depth.

  • param["split_depth"] (int) – File split depth number.

Returns:

Subtrajectory Table.

Return type:

Table

set_info(param={})[source]

Insert a subtrj_no column and add parameters.

static process(reqs, param)[source]

Break down a trajectory into multiple subtrajectories.

Parameters:
  • reqs[0] (Trajectory) – Trajectory data.

  • param["step"] (int) – Step number of the subtrajectory.

  • param["split_cols"] (list of str) – Index columns for groupby.

  • param["index_cols"] (list of str) – Index columns for sorting.

Returns:

Subtrajectory Table.

Return type:

Table

calc_subtrj(df, param)[source]

Break down a trajectory into multiple subtrajectories using rolling.

The code calculates rolling windows of a specified size on a given DataFrame and adds a new column indicating the subtrajectory number for each window.

Parameters:
  • df (pandas.DataFrame) – Trajectory data.

  • param["step"] (int) – Step number of subtrajectory.

Returns:

Subtrajectory DataFrame.

Return type:

pandas.DataFrame