Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
3pia
CMS Analyses
Tools
Commits
ccef9fa0
Commit
ccef9fa0
authored
3 years ago
by
Dennis Noll
Browse files
Options
Downloads
Patches
Plain Diff
[numpy] adds sigmaclip_mask
parent
2f64e6de
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
numpy.py
+15
-0
15 additions, 0 deletions
numpy.py
with
15 additions
and
0 deletions
numpy.py
+
15
−
0
View file @
ccef9fa0
...
...
@@ -87,3 +87,18 @@ def intersect2d(A, B, *args, **kwargs):
c
=
C
c
=
c
.
view
(
A
.
dtype
).
reshape
(
-
1
,
ncols
)
return
C
def
sigmaclip_mask
(
arr
,
low
=
4.0
,
high
=
4.0
):
delta
=
1
arr
=
np
.
array
(
arr
)
mask
=
np
.
ones_like
(
arr
,
dtype
=
bool
)
while
delta
:
arr_std
=
arr
[
mask
].
std
()
arr_mean
=
arr
[
mask
].
mean
()
good
=
np
.
sum
(
mask
)
critlower
=
arr_mean
-
arr_std
*
low
critupper
=
arr_mean
+
arr_std
*
high
mask
=
mask
&
(
arr
>=
critlower
)
&
(
arr
<=
critupper
)
delta
=
good
-
np
.
sum
(
mask
)
return
~
mask
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment