Skip to content

Commit 5c5e5a5

Browse files
committed
made some functions private and added author
1 parent e0b7f9a commit 5c5e5a5

3 files changed

Lines changed: 12 additions & 11 deletions

File tree

package/AUTHORS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,12 @@ Chronological list of authors
246246
- Matthew Davies
247247
- Jia-Xin Zhu
248248
- Tanish Yelgoe
249-
2025
249+
2025
250250
- Joshua Raphael Uy
251251
- Namir Oues
252252
- Lexi Xu
253253
- BHM-Bob G
254+
- Debasish Mohanty
254255

255256
External code
256257
-------------

package/MDAnalysis/visualization/streamlines.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ def split_grid(grid, num_cores):
177177
]
178178

179179

180-
# some utility functions for trajectory iteration
181-
def produce_list_indices_point_in_polygon_this_frame(
180+
# some private utility functions for trajectory iteration
181+
def _produce_list_indices_point_in_polygon_this_frame(
182182
vertex_coord_list, relevant_particle_coordinate_array_xy
183183
):
184184
"""
@@ -197,7 +197,7 @@ def produce_list_indices_point_in_polygon_this_frame(
197197
return list_indices_point_in_polygon
198198

199199

200-
def produce_list_centroids_this_frame(
200+
def _produce_list_centroids_this_frame(
201201
list_indices_in_polygon, relevant_particle_coordinate_array_xy
202202
):
203203
"""
@@ -253,14 +253,14 @@ def per_core_work(
253253
# only 2D / xy coords for now
254254
# I will need a list of indices for relevant particles falling within each square in THIS frame:
255255
list_indices_in_squares_this_frame = (
256-
produce_list_indices_point_in_polygon_this_frame(
256+
_produce_list_indices_point_in_polygon_this_frame(
257257
list_square_vertex_arrays_this_core,
258258
relevant_particle_coordinate_array_xy,
259259
)
260260
)
261261
# likewise, I will need a list of centroids of particles in each square (same order as above list):
262262
list_centroids_in_squares_this_frame = (
263-
produce_list_centroids_this_frame(
263+
_produce_list_centroids_this_frame(
264264
list_indices_in_squares_this_frame,
265265
relevant_particle_coordinate_array_xy,
266266
)
@@ -270,7 +270,7 @@ def per_core_work(
270270
): # if the previous frame had indices in at least one square I will need to use
271271
# those indices to generate the updates to the corresponding centroids in this frame:
272272
list_centroids_this_frame_using_indices_from_last_frame = (
273-
produce_list_centroids_this_frame(
273+
_produce_list_centroids_this_frame(
274274
list_previous_frame_indices,
275275
relevant_particle_coordinate_array_xy,
276276
)

testsuite/MDAnalysisTests/visualization/test_streamlines.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def test_produce_list_indices_point_in_polygon_this_frame():
7171
points = np.array([[0.5, 0.5], [1.5, 1.5], [2.5, 2.5], [3.5, 3.5]])
7272

7373
# Call the function under test.
74-
result = streamlines.produce_list_indices_point_in_polygon_this_frame(
74+
result = streamlines._produce_list_indices_point_in_polygon_this_frame(
7575
vertex_list, points
7676
)
7777

@@ -90,7 +90,7 @@ def test_produce_list_centroids_empty():
9090
list_indices = [(np.array([]),)]
9191
# Dummy particle coordinate array (won't be used since indices is empty)
9292
pts = np.array([[0, 0], [1, 1]])
93-
result = streamlines.produce_list_centroids_this_frame(list_indices, pts)
93+
result = streamlines._produce_list_centroids_this_frame(list_indices, pts)
9494
assert result == [None]
9595

9696

@@ -100,7 +100,7 @@ def test_produce_list_centroids_single_square():
100100
# Choose indices that pick points [1] and [3]
101101
indices_tuple = (np.array([1, 3]),)
102102
list_indices = [indices_tuple]
103-
result = streamlines.produce_list_centroids_this_frame(list_indices, pts)
103+
result = streamlines._produce_list_centroids_this_frame(list_indices, pts)
104104
expected = np.average(pts[[1, 3]], axis=0)
105105
np.testing.assert_array_almost_equal(result[0], expected)
106106

@@ -112,7 +112,7 @@ def test_produce_list_centroids_multiple_squares():
112112
# Second square will use pts[1], pts[3] and pts[4]
113113
indices2 = (np.array([1, 3, 4]),)
114114
list_indices = [indices1, indices2]
115-
result = streamlines.produce_list_centroids_this_frame(list_indices, pts)
115+
result = streamlines._produce_list_centroids_this_frame(list_indices, pts)
116116
expected1 = np.average(pts[[0, 2]], axis=0)
117117
expected2 = np.average(pts[[1, 3, 4]], axis=0)
118118
np.testing.assert_array_almost_equal(result[0], expected1)

0 commit comments

Comments
 (0)