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
074f94d4
Commit
074f94d4
authored
Oct 28, 2022
by
Laura Christine Kühle
Browse files
Options
Downloads
Patches
Plain Diff
Reworked limit masking to apply over array instead of cell.
parent
8d1035fa
No related branches found
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
+13
-21
13 additions, 21 deletions
scripts/tcd/Limiter.py
with
13 additions
and
21 deletions
scripts/tcd/Limiter.py
+
13
−
21
View file @
074f94d4
...
@@ -135,11 +135,9 @@ class MinMod(Limiter):
...
@@ -135,11 +135,9 @@ class MinMod(Limiter):
"""
"""
new_projection
=
projection
.
copy
()
new_projection
=
projection
.
copy
()
cell_slopes
=
self
.
_set_cell_slope
(
projection
)
cell_slopes
=
self
.
_set_cell_slope
(
projection
)
modification_mask
=
self
.
_determine_mask
(
projection
,
cell_slopes
)
for
cell
in
cells
:
for
cell
in
cells
:
is_good_cell
=
self
.
_determine_modification
(
projection
,
cell
,
if
not
modification_mask
[
cell
]:
cell_slopes
)
if
not
is_good_cell
:
adapted_projection
=
projection
[:,
cell
+
1
].
copy
()
adapted_projection
=
projection
[:,
cell
+
1
].
copy
()
for
i
in
range
(
len
(
adapted_projection
)):
for
i
in
range
(
len
(
adapted_projection
)):
if
i
>
self
.
_erase_degree
:
if
i
>
self
.
_erase_degree
:
...
@@ -147,22 +145,20 @@ class MinMod(Limiter):
...
@@ -147,22 +145,20 @@ class MinMod(Limiter):
new_projection
[:,
cell
+
1
]
=
adapted_projection
new_projection
[:,
cell
+
1
]
=
adapted_projection
return
new_projection
return
new_projection
def
_determine_m
odification
(
self
,
projection
,
cell
,
slopes
):
def
_determine_m
ask
(
self
,
projection
,
slopes
):
"""
Determine
s whether
limiting
is applied
.
"""
Determine limiting
mask
.
Parameters
Parameters
----------
----------
projection : ndarray
projection : ndarray
Matrix of projection for each polynomial degree.
Matrix of projection for each polynomial degree.
cell : int
Index of cell.
slopes : ndarray
slopes : ndarray
Vector of slopes of projection cells.
Vector of slopes of projection cells.
Returns
Returns
-------
-------
bool
ndarray
Flag
whether cell should be adjusted.
Mask
whether cell
s
should be adjusted.
"""
"""
forward_slopes
=
(
projection
[
0
,
2
:]
-
projection
[
0
,
1
:
-
1
])
*
(
0.5
**
0.5
)
forward_slopes
=
(
projection
[
0
,
2
:]
-
projection
[
0
,
1
:
-
1
])
*
(
0.5
**
0.5
)
...
@@ -175,7 +171,7 @@ class MinMod(Limiter):
...
@@ -175,7 +171,7 @@ class MinMod(Limiter):
backward_slopes
<=
0
))
backward_slopes
<=
0
))
slope_mask
=
np
.
logical_or
(
pos_mask
,
neg_mask
)
slope_mask
=
np
.
logical_or
(
pos_mask
,
neg_mask
)
return
slope_mask
[
cell
]
return
slope_mask
@staticmethod
@staticmethod
def
_set_cell_slope
(
projection
):
def
_set_cell_slope
(
projection
):
...
@@ -240,25 +236,21 @@ class ModifiedMinMod(MinMod):
...
@@ -240,25 +236,21 @@ class ModifiedMinMod(MinMod):
"""
Returns string of class name concatenated with the erase-degree.
"""
"""
Returns string of class name concatenated with the erase-degree.
"""
return
self
.
__class__
.
__name__
+
str
(
self
.
_erase_degree
)
return
self
.
__class__
.
__name__
+
str
(
self
.
_erase_degree
)
def
_determine_m
odification
(
self
,
projection
,
cell
,
slopes
):
def
_determine_m
ask
(
self
,
projection
,
slopes
):
"""
Determine
s whether
limiting
is applied
.
"""
Determine limiting
mask
.
Parameters
Parameters
----------
----------
projection : ndarray
projection : ndarray
Matrix of projection for each polynomial degree.
Matrix of projection for each polynomial degree.
cell : int
Index of cell.
slopes : ndarray
slopes : ndarray
Vector of slopes of projection cells.
Vector of slopes of projection cells.
Returns
Returns
-------
-------
bool
ndarray
Flag
whether cell should be adjusted.
Mask
whether cell
s
should be adjusted.
"""
"""
if
abs
(
slopes
[
cell
])
<=
self
.
_threshold
:
return
np
.
logical_or
(
abs
(
slopes
)
<=
self
.
_threshold
,
return
True
super
().
_determine_mask
(
projection
,
slopes
))
return
super
().
_determine_modification
(
projection
,
cell
,
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