dbeab7509cfec1314b6529d57fbd090ce744695c,trackpy/motion.py,,compute_drift,#Any#Any#Any#,237

Before Change


    delta = delta[delta["frame"] == 1]
    // Restore the original frame column (replacing delta frame).
    del delta["frame"]
    delta.reset_index("particle", drop=True, inplace=True)
    delta.reset_index("frame", drop=False, inplace=True)
    dx = delta.groupby("frame").mean()
    if smoothing > 0:
        dx = pd.rolling_mean(dx, smoothing, min_periods=0)

After Change


    f_sort = traj.sort_values(["particle", "frame"])

    // Compute the difference list of positions, particle, and frame columns.
    f_diff = f_sort[list(pos_columns) + ["particle", "frame"]].diff()

    // Rename the frame column and insert the original frame column back in.
    f_diff.rename(columns={"frame": "frame_diff"}, inplace=True)
    f_diff["frame"] = f_sort["frame"]

    // Compute the per frame averages. Keep only deltas of the same particle,
    // and between frames that are consecutive, and of the same particle.
    mask = (f_diff["particle"] == 0) & (f_diff["frame_diff"] == 1)
    dx = f_diff.loc[mask, pos_columns + ["frame"]].groupby("frame").mean()
    if smoothing > 0:
        dx = pd.rolling_mean(dx, smoothing, min_periods=0)
    return dx.cumsum()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: soft-matter/trackpy
Commit Name: dbeab7509cfec1314b6529d57fbd090ce744695c
Time: 2017-07-27
Author: caspervdw@gmail.com
File Name: trackpy/motion.py
Class Name:
Method Name: compute_drift


Project Name: QUANTAXIS/QUANTAXIS
Commit Name: 89b43bbd55550d5c103a8b06281d9bc62e533680
Time: 2019-08-05
Author: yutiansut@qq.com
File Name: QUANTAXIS/QAData/data_resample.py
Class Name:
Method Name: QA_data_min_resample


Project Name: WZBSocialScienceCenter/tmtoolkit
Commit Name: 9def69a805132ff7549744b5b30a2fa7531fa405
Time: 2019-06-12
Author: markus.konrad@wzb.eu
File Name: tmtoolkit/preprocess/_tmpreproc.py
Class Name: TMPreproc
Method Name: load_tokens_dataframe