Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add clip #3413

Open
jl-wynen opened this issue Mar 19, 2024 · 0 comments
Open

Add clip #3413

jl-wynen opened this issue Mar 19, 2024 · 0 comments
Labels
enhancement New feature or request good first issue

Comments

@jl-wynen
Copy link
Member

jl-wynen commented Mar 19, 2024

Add sc.clip corresponding to np.clip https://numpy.org/doc/stable/reference/generated/numpy.clip.html
Alternatively, it can be called clamp (https://en.cppreference.com/w/cpp/algorithm/clamp) which I think is more common in graphics programming.

Currently, we need to either use numpy or workaround it like this

var = sc.where(var < lo, lo, var)
var = sc.where(var > hi, hi, var)

I encountered this for the second time now when setting fit windows and making sure they are within the range of the data.

@jl-wynen jl-wynen added the enhancement New feature or request label Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue
Projects
None yet
Development

No branches or pull requests

2 participants