Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/source/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@ Chronological list of authors
- Rub茅n Chaves
2025
- Yu-Yuan (Stuart) Yang
2026
- Francesco Siciliani
32 changes: 32 additions & 0 deletions doc/source/examples/analysis/custom_trajectory_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,38 @@
"plt.xlabel('Frame')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can also select frames by passing a mask to the `frames` argument of the `run()` method. The mask contains one boolean value per frame; only frames marked `True` are analysed. The mask can be a NumPy boolean array or a Python list of booleans.\n",
"\n",
"For example, the following mask selects every second frame:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"mask = np.zeros(len(u.trajectory), dtype=bool)\n",
"mask[::2] = True\n",
"\n",
"rog_masked = AnalysisFromFunction(\n",
" radgyr, u.trajectory, protein, protein.masses,\n",
" total_mass=np.sum(protein.masses),\n",
")\n",
"rog_masked.run(frames=mask);"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can also pass an array of integers to `frames`; in that case, the array directly specifies the frame indices to analyse."
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
Loading