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
6acd9c49
Commit
6acd9c49
authored
Sep 9, 2020
by
Laura Christine Kühle
Browse files
Options
Downloads
Patches
Plain Diff
Made projection a local variable for all classes.
parent
83a45cda
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Limiter.py
+18
-21
18 additions, 21 deletions
Limiter.py
Troubled_Cell_Detector.py
+1
-3
1 addition, 3 deletions
Troubled_Cell_Detector.py
with
19 additions
and
24 deletions
Limiter.py
+
18
−
21
View file @
6acd9c49
...
@@ -38,51 +38,49 @@ class MinMod(Limiter):
...
@@ -38,51 +38,49 @@ class MinMod(Limiter):
# Pop unnecessary parameter
# Pop unnecessary parameter
config
.
pop
(
'
cell_len
'
)
config
.
pop
(
'
cell_len
'
)
self
.
projection
=
[]
self
.
cell
=
0
self
.
cell
=
0
def
apply
(
self
,
projection
,
cell
):
def
apply
(
self
,
projection
,
cell
):
self
.
projection
=
projection
self
.
cell
=
cell
self
.
cell
=
cell
self
.
_set_cell_slope
()
self
.
_set_cell_slope
(
projection
)
is_good_cell
=
self
.
_determine_modification
()
is_good_cell
=
self
.
_determine_modification
(
projection
)
if
is_good_cell
:
if
is_good_cell
:
return
self
.
projection
[:,
self
.
cell
]
return
projection
[:,
self
.
cell
]
adapted_projection
=
self
.
projection
[:,
self
.
cell
].
copy
()
adapted_projection
=
projection
[:,
self
.
cell
].
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
:
adapted_projection
[
i
]
=
0
adapted_projection
[
i
]
=
0
return
adapted_projection
return
adapted_projection
def
_set_cell_slope
(
self
):
def
_set_cell_slope
(
self
,
projection
):
tic
=
timeit
.
default_timer
()
tic
=
timeit
.
default_timer
()
slope
=
[]
slope
=
[]
transposed_projection
=
np
.
transpose
(
self
.
projection
)
transposed_projection
=
np
.
transpose
(
projection
)
for
cell
in
range
(
len
(
transposed_projection
)):
for
cell
in
range
(
len
(
transposed_projection
)):
new_entry
=
sum
(
transposed_projection
[
cell
][
degree
]
*
(
degree
+
0.5
)
**
0.5
new_entry
=
sum
(
transposed_projection
[
cell
][
degree
]
*
(
degree
+
0.5
)
**
0.5
for
degree
in
range
(
1
,
len
(
self
.
projection
)))
for
degree
in
range
(
1
,
len
(
projection
)))
slope
.
append
(
new_entry
)
slope
.
append
(
new_entry
)
toc
=
timeit
.
default_timer
()
toc
=
timeit
.
default_timer
()
print
(
'
Trans:
'
,
toc
-
tic
)
#
print('Trans:', toc-tic)
tic
=
timeit
.
default_timer
()
tic
=
timeit
.
default_timer
()
slope1
=
[]
slope1
=
[]
transposed_projection
=
self
.
projection
transposed_projection
=
projection
for
cell
in
range
(
len
(
transposed_projection
[
0
])):
for
cell
in
range
(
len
(
transposed_projection
[
0
])):
new_entry
=
sum
(
transposed_projection
[
degree
][
cell
]
*
(
degree
+
0.5
)
**
0.5
new_entry
=
sum
(
transposed_projection
[
degree
][
cell
]
*
(
degree
+
0.5
)
**
0.5
for
degree
in
range
(
1
,
len
(
self
.
projection
)))
for
degree
in
range
(
1
,
len
(
projection
)))
slope1
.
append
(
new_entry
)
slope1
.
append
(
new_entry
)
toc
=
timeit
.
default_timer
()
toc
=
timeit
.
default_timer
()
print
(
'
Vecto:
'
,
toc
-
tic
)
#
print('Vecto:', toc-tic)
#
print
(
slope
==
slope1
)
#
print(slope == slope1)
self
.
cell_slope
=
slope
[
self
.
cell
]
self
.
cell_slope
=
slope
[
self
.
cell
]
def
_determine_modification
(
self
):
def
_determine_modification
(
self
,
projection
):
forward_slope
=
(
self
.
projection
[
0
][
self
.
cell
+
1
]
-
self
.
projection
[
0
][
self
.
cell
])
*
(
0.5
**
0.5
)
forward_slope
=
(
projection
[
0
][
self
.
cell
+
1
]
-
projection
[
0
][
self
.
cell
])
*
(
0.5
**
0.5
)
backward_slope
=
(
self
.
projection
[
0
][
self
.
cell
]
-
self
.
projection
[
0
][
self
.
cell
-
1
])
*
(
0.5
**
0.5
)
backward_slope
=
(
projection
[
0
][
self
.
cell
]
-
projection
[
0
][
self
.
cell
-
1
])
*
(
0.5
**
0.5
)
return
(
forward_slope
<=
0
)
&
(
backward_slope
<=
0
)
&
(
self
.
cell_slope
<=
0
)
\
return
(
forward_slope
<=
0
)
&
(
backward_slope
<=
0
)
&
(
self
.
cell_slope
<=
0
)
\
|
(
forward_slope
>=
0
)
&
(
backward_slope
>=
0
)
&
(
self
.
cell_slope
>=
0
)
|
(
forward_slope
>=
0
)
&
(
backward_slope
>=
0
)
&
(
self
.
cell_slope
>=
0
)
...
@@ -98,11 +96,10 @@ class ModifiedMinMod(MinMod):
...
@@ -98,11 +96,10 @@ class ModifiedMinMod(MinMod):
# Set name of function
# Set name of function
self
.
function_name
=
'
ModifiedMinMod
'
+
str
(
self
.
erase_degree
)
self
.
function_name
=
'
ModifiedMinMod
'
+
str
(
self
.
erase_degree
)
self
.
projection
=
[]
self
.
cell
=
0
self
.
cell
=
0
def
_determine_modification
(
self
):
def
_determine_modification
(
self
,
projection
):
if
abs
(
self
.
cell_slope
)
<=
self
.
mod_factor
*
self
.
cell_len
**
2
:
if
abs
(
self
.
cell_slope
)
<=
self
.
mod_factor
*
self
.
cell_len
**
2
:
return
True
return
True
return
super
().
_determine_modification
()
return
super
().
_determine_modification
(
projection
)
This diff is collapsed.
Click to expand it.
Troubled_Cell_Detector.py
+
1
−
3
View file @
6acd9c49
...
@@ -155,14 +155,12 @@ class Theoretical(WaveletDetector):
...
@@ -155,14 +155,12 @@ class Theoretical(WaveletDetector):
# comment to line above: or 2 or 3
# comment to line above: or 2 or 3
self
.
multiwavelet_coeffs
=
[]
self
.
multiwavelet_coeffs
=
[]
self
.
projection
=
[]
self
.
max_avg
=
None
self
.
max_avg
=
None
def
_get_cells
(
self
,
multiwavelet_coeffs
,
projection
):
def
_get_cells
(
self
,
multiwavelet_coeffs
,
projection
):
self
.
multiwavelet_coeffs
=
multiwavelet_coeffs
self
.
multiwavelet_coeffs
=
multiwavelet_coeffs
self
.
projection
=
projection
troubled_cells
=
[]
troubled_cells
=
[]
self
.
max_avg
=
max
(
1
,
max
(
abs
(
self
.
projection
[
0
][
degree
])
for
degree
in
range
(
self
.
polynom_degree
+
1
)))
self
.
max_avg
=
max
(
1
,
max
(
abs
(
projection
[
0
][
degree
])
for
degree
in
range
(
self
.
polynom_degree
+
1
)))
for
cell
in
range
(
int
(
self
.
num_grid_cells
/
2
)):
for
cell
in
range
(
int
(
self
.
num_grid_cells
/
2
)):
if
self
.
_is_troubled_cell
(
cell
):
if
self
.
_is_troubled_cell
(
cell
):
...
...
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