Skip to content

Commit

Permalink
remove clusters larger than max_cluster_size
Browse files Browse the repository at this point in the history
  • Loading branch information
j-brady committed Mar 5, 2024
1 parent 66f1d11 commit e024885
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 2 additions & 0 deletions peakipy/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,8 @@ def fit(
max_cluster_size = warn_if_trying_to_fit_large_clusters(
max_cluster_size, peakipy_data
)
# remove peak clusters larger than max_cluster_size
peakipy_data.df = peakipy_data.df[peakipy_data.df.MEMCNT <= max_cluster_size]

args["max_cluster_size"] = max_cluster_size
args["to_fix"] = fix
Expand Down
6 changes: 2 additions & 4 deletions peakipy/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1757,10 +1757,8 @@ def update_df(self):
self.df["X_AXISf"] = self.df.X_PPM.apply(lambda x: self.uc_f2.f(x, "ppm"))
self.df["Y_AXISf"] = self.df.Y_PPM.apply(lambda x: self.uc_f1.f(x, "ppm"))
# in case of missing values (should estimate though)
# self.df.XW_HZ.replace("None", "20.0", inplace=True)
# self.df.YW_HZ.replace("None", "20.0", inplace=True)
self.df.XW_HZ.replace(np.NaN, "20.0", inplace=True)
self.df.YW_HZ.replace(np.NaN, "20.0", inplace=True)
self.df["XW_HZ"] = self.df.XW_HZ.replace(np.NaN, "20.0")
self.df["YW_HZ"] = self.df.YW_HZ.replace(np.NaN, "20.0")
# convert linewidths to float
self.df["XW_HZ"] = self.df.XW_HZ.apply(lambda x: float(x))
self.df["YW_HZ"] = self.df.YW_HZ.apply(lambda x: float(x))
Expand Down

0 comments on commit e024885

Please sign in to comment.