> Am 6/18/21 um 00:55 schrieb Rob Arbon <
robert...@gmail.com>:
>
> Yes, ok, that sounds reasonble. So I need to map the first 200 frames of each trajectory to their indices in the concatenated verison -
When you iterate over a trajectory you can do fancy indexing. You can use a list of frame numbers or Boolean arrays. For simplicity, let’s say each trajectory has 10 frames and you want to discard the first two. Then make a Boolean array like
keep = np.ones(10, dtype=bool)
keep[:2]=False
production_frames = np.concatenate(10*keep.tolist())
for ts in u.trajectory[production_frames]:
Do_stuff()
I didn’t test the code and it’s kind of ugly but I hope you get the idea.
> and save as a new universe? Or is there a way of doing that 'in place'?
You don’t change the universe, you just slice the trajectory. This approach won’t work with typical analysis functions because they are limited to start/stop/step. (However, open an issue to suggest that analysis functions can also take an opt argument to take an array for indexing.)
Oliver