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

Before Change


    // I do here a copy because a "inplace=True" would sort the original "traj" which is perhaps unwanted/unexpected
    traj = pandas_sort(traj, "frame")
    // Probe by particle, take the difference between frames.
    delta = traj.groupby("particle", sort=False).apply(lambda x :
                                    x.set_index("frame", drop=False).diff())
    // Keep only deltas between frames that are consecutive.
    delta = delta[delta["frame"] == 1]
    // Restore the original frame column (replacing delta frame).
    del delta["frame"]

After Change


    
    if pos_columns is None:
        pos_columns = ["x", "y"]
    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()
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: EpistasisLab/scikit-rebate
Commit Name: 7d51c2e47a41418904a76c8c744c7ec51ac8a9aa
Time: 2019-01-09
Author: alexmxu99@gmail.com
File Name: visualizer.py
Class Name:
Method Name:


Project Name: Pinafore/qb
Commit Name: 1be7ed32b7f84d4988d81b813446b4b359c277ba
Time: 2018-04-26
Author: sjtufs@gmail.com
File Name: qanta/buzzer/util.py
Class Name:
Method Name: process_question