Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add progress bars #4072

Merged
merged 10 commits into from
Mar 29, 2023
Merged
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
1 change: 1 addition & 0 deletions package/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ Chronological list of authors
- Ahmed Salah Ghoneim
- Alexander Schlaich
- Josh Vermaas
- Xiaoxu Ruan

External code
-------------
Expand Down
4 changes: 3 additions & 1 deletion package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The rules for this file:

??/??/?? IAlibay, pgbarletta, mglagolev, hmacdope, manuel.nuno.melo, chrispfae,
ooprathamm, MeetB7, BFedder, v-parmar, MoSchaeffler, jbarnoud, jandom,
xhgchen, jaclark5, DrDomenicoMarson, AHMED-salah00, schlaicha
xhgchen, jaclark5, DrDomenicoMarson, AHMED-salah00, schlaicha, SophiaRuan
* 2.5.0

Fixes
Expand Down Expand Up @@ -49,6 +49,8 @@ Enhancements
and SegmentGroup. (PR #3953)

Changes
* Add progress bars to track the progress of _conclude() functions
(_conclude_simple() and _conclude_fft()) in msd.py (Issue #4070, PR #4072)
* As per NEP29 the minimum supported NumPy version has been raised to 1.21
(note: in practice later versions of NumPy may be used depending on your
architecture, operating system, or Python version) (PR #3983)
Expand Down
5 changes: 3 additions & 2 deletions package/MDAnalysis/analysis/msd.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@
from ..due import due, Doi
from .base import AnalysisBase
from ..core import groups
from tqdm import tqdm

logger = logging.getLogger('MDAnalysis.analysis.msd')

Expand Down Expand Up @@ -387,7 +388,7 @@ def _conclude_simple(self):
"""
lagtimes = np.arange(1, self.n_frames)
positions = self._position_array.astype(np.float64)
for lag in lagtimes:
for lag in tqdm(lagtimes):
disp = positions[:-lag, :, :] - positions[lag:, :, :]
sqdist = np.square(disp).sum(axis=-1)
self.results.msds_by_particle[lag, :] = np.mean(sqdist, axis=0)
Expand All @@ -411,7 +412,7 @@ def _conclude_fft(self): # with FFT, np.float64 bit prescision required.
or set fft=False""")

positions = self._position_array.astype(np.float64)
for n in range(self.n_particles):
for n in tqdm(range(self.n_particles)):
self.results.msds_by_particle[:, n] = tidynamics.msd(
positions[:, n, :])
self.results.timeseries = self.results.msds_by_particle.mean(axis=1)