Fixed chill ice_cluster_traj() function

This commit is contained in:
Sebastian Kloth 2024-02-16 11:11:17 +01:00
parent 6b77ef78e1
commit 363e420cd8

View File

@ -161,8 +161,8 @@ def ice_types(trajectory: Coordinates, segments: int = 10000) -> pd.DataFrame:
def ice_clusters_traj( def ice_clusters_traj(
traj: Coordinates, segments: int = 10000, skip: float = 0.1 traj: Coordinates, segments: int = 10000, skip: float = 0.1
) -> list: ) -> list:
def ice_clusters(frame: CoordinateFrame, traj: Coordinates) -> Tuple[float, list]: def ice_clusters(frame: CoordinateFrame) -> Tuple[float, list]:
selection = selector_ice(frame, traj, [0, 1, 2]) selection = selector_ice(frame, [0, 1, 2])
if len(selection) == 0: if len(selection) == 0:
return frame.time, [] return frame.time, []
else: else:
@ -194,6 +194,6 @@ def ice_clusters_traj(
np.int_(np.linspace(len(traj) * skip, len(traj) - 1, num=segments)) np.int_(np.linspace(len(traj) * skip, len(traj) - 1, num=segments))
) )
all_clusters = [ all_clusters = [
ice_clusters(traj[frame_index], traj) for frame_index in frame_indices ice_clusters(traj[frame_index]) for frame_index in frame_indices
] ]
return all_clusters return all_clusters