runtraj.transforms.weigh#
- runtraj.transforms.weigh(particles, factor)[source]#
Return a copy of the particles with
weightmultiplied by factor.A table without a
weightcolumn starts from 1 at every row.- Parameters:
- Returns:
A new table;
particlesis unchanged.- Return type:
Examples
>>> import pandas as pd >>> from runtraj.transforms import weigh >>> p = pd.DataFrame({"particle": [1, 2]}) >>> weigh(weigh(p, [0.5, 1.0]), [0.5, 0.5])["weight"].tolist() [0.25, 0.5]