Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Troubled Cell Detection
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Laura Christine Kühle
Troubled Cell Detection
Commits
76e3c1a5
Commit
76e3c1a5
authored
2 years ago
by
Laura Christine Kühle
Browse files
Options
Downloads
Patches
Plain Diff
Vectorized 'apply()' in MinMod limiter.
parent
074f94d4
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/tcd/Limiter.py
+15
-7
15 additions, 7 deletions
scripts/tcd/Limiter.py
with
15 additions
and
7 deletions
scripts/tcd/Limiter.py
+
15
−
7
View file @
76e3c1a5
...
@@ -134,15 +134,23 @@ class MinMod(Limiter):
...
@@ -134,15 +134,23 @@ class MinMod(Limiter):
"""
"""
new_projection
=
projection
.
copy
()
new_projection
=
projection
.
copy
()
# If no troubled cells are detected, return copy
if
len
(
cells
)
==
0
:
return
new_projection
# Set mask to limit complete projection
cell_slopes
=
self
.
_set_cell_slope
(
projection
)
cell_slopes
=
self
.
_set_cell_slope
(
projection
)
modification_mask
=
self
.
_determine_mask
(
projection
,
cell_slopes
)
modification_mask
=
self
.
_determine_mask
(
projection
,
cell_slopes
)
for
cell
in
cells
:
cells
=
np
.
array
(
cells
)
if
not
modification_mask
[
cell
]:
mask
=
np
.
zeros_like
(
new_projection
,
dtype
=
bool
)
adapted_projection
=
projection
[:,
cell
+
1
].
copy
()
mask
[
self
.
_erase_degree
+
1
:,
cells
+
1
]
=
np
.
tile
(
for
i
in
range
(
len
(
adapted_projection
)):
np
.
logical_not
(
modification_mask
)[
cells
],
if
i
>
self
.
_erase_degree
:
(
len
(
projection
)
-
self
.
_erase_degree
-
1
,
1
))
adapted_projection
[
i
]
=
0
new_projection
[:,
cell
+
1
]
=
adapted_projection
# Limit troubled cells for higher degrees
new_projection
[
mask
]
=
0
return
new_projection
return
new_projection
def
_determine_mask
(
self
,
projection
,
slopes
):
def
_determine_mask
(
self
,
projection
,
slopes
):
...
...
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