Skip to content

Commit

Permalink
Added check for lowess_frac between 0 and 1
Browse files Browse the repository at this point in the history
  • Loading branch information
Gautam8387 committed Dec 17, 2024
1 parent 27f77c0 commit 5eab4d8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scarf/assay.py
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,8 @@ def set_summary_stats(
Args:
cell_key: Name of the key (column) from cell attribute table.
n_bins: Number of bins to divide the data into.
lowess_frac: Fraction of the data to use when estimating the fit between mean and variance.
lowess_frac: Between 0 and 1. The fraction of the data used when estimating the fit between mean and
variance. This is same as `frac` in statsmodels.nonparametric.smoothers_lowess.lowess
Returns:
A tuple of two strings.
Expand All @@ -920,6 +921,10 @@ def col_renamer(x):
if cell_key is None:
cell_key = "I"

# check lowess_frac is between 0 and 1
if not 0 <= lowess_frac <= 1:
raise ValueError("lowess_frac must be between 0 and 1")

self.set_feature_stats(cell_key)
identifier = self._load_stats_loc(cell_key)
c_var_col = f"c_var__{n_bins}__{lowess_frac}"
Expand Down

0 comments on commit 5eab4d8

Please sign in to comment.