Skip to content

Commit

Permalink
safe guard when no fits pass the in contour threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
RodenLuo committed Dec 17, 2024
1 parent 523981d commit 323a08d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/DiffAtomComp.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,12 @@ def cluster_and_sort_sqd_fast(e_sqd_log, shift_tolerance: float = 3.0, angle_tol
fit_res_filtered[mol_idx][max_idx_in_filtered, sort_column_idx]])

# ======= Filter cluster by the density, keep max_clusters=100 clusters for each mol
sqd_clusters_mol = np.array(sqd_clusters_mol)
sqd_clusters_mol = sqd_clusters_mol[np.argsort(-sqd_clusters_mol[:, -1])]
sqd_clusters_mol = sqd_clusters_mol[:min(max_clusters, len(sqd_clusters_mol)), :]
if len(sqd_clusters_mol) > 0:
sqd_clusters_mol = np.array(sqd_clusters_mol)
sqd_clusters_mol = sqd_clusters_mol[np.argsort(-sqd_clusters_mol[:, -1])]
sqd_clusters_mol = sqd_clusters_mol[:min(max_clusters, len(sqd_clusters_mol)), :]

sqd_clusters.append(sqd_clusters_mol)
sqd_clusters.append(sqd_clusters_mol)

sqd_clusters = np.vstack(sqd_clusters)

Expand Down

0 comments on commit 323a08d

Please sign in to comment.