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
212c0a8f
Commit
212c0a8f
authored
4 years ago
by
Laura Christine Kühle
Browse files
Options
Downloads
Patches
Plain Diff
Adapted 'randomize()' to take an input configuration. Allowed adjustment in x-direction.
parent
c40e57bb
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
Initial_Condition.py
+35
-24
35 additions, 24 deletions
Initial_Condition.py
with
35 additions
and
24 deletions
Initial_Condition.py
+
35
−
24
View file @
212c0a8f
...
...
@@ -22,7 +22,10 @@ class InitialCondition(object):
def
is_smooth
(
self
):
return
True
def
randomize
(
self
):
def
induce_adjustment
(
self
,
value
):
pass
def
randomize
(
self
,
config
):
pass
def
calculate
(
self
,
x
):
...
...
@@ -43,8 +46,9 @@ class Sine(InitialCondition):
# Unpack necessary configurations
self
.
_factor
=
config
.
pop
(
'
factor
'
,
2
)
def
randomize
(
self
):
config
=
{
'
factor
'
:
2
}
def
randomize
(
self
,
config
):
factor
=
config
.
pop
(
'
factor
'
,
np
.
random
.
uniform
(
low
=-
100
,
high
=
100
))
config
=
{
'
factor
'
:
factor
}
self
.
_reset
(
config
)
def
_get_point
(
self
,
x
):
...
...
@@ -109,9 +113,9 @@ class Linear(InitialCondition):
# Unpack necessary configurations
self
.
_factor
=
config
.
pop
(
'
factor
'
,
1
)
def
randomize
(
self
):
a
=
np
.
random
.
uniform
(
low
=-
100
,
high
=
100
)
config
=
{
'
factor
'
:
a
}
def
randomize
(
self
,
config
):
factor
=
config
.
pop
(
'
factor
'
,
np
.
random
.
uniform
(
low
=-
100
,
high
=
100
)
)
config
=
{
'
factor
'
:
factor
}
self
.
_reset
(
config
)
def
_get_point
(
self
,
x
):
...
...
@@ -128,9 +132,9 @@ class LinearAbsolut(InitialCondition):
def
is_smooth
(
self
):
return
False
def
randomize
(
self
):
a
=
np
.
random
.
uniform
(
low
=-
100
,
high
=
100
)
config
=
{
'
factor
'
:
a
}
def
randomize
(
self
,
config
):
factor
=
config
.
pop
(
'
factor
'
,
np
.
random
.
uniform
(
low
=-
100
,
high
=
100
)
)
config
=
{
'
factor
'
:
factor
}
self
.
_reset
(
config
)
def
_get_point
(
self
,
x
):
...
...
@@ -158,10 +162,10 @@ class Polynomial(InitialCondition):
self
.
_factor
=
config
.
pop
(
'
factor
'
,
1
)
self
.
_exponential
=
config
.
pop
(
'
exponential
'
,
2
)
def
randomize
(
self
):
a
=
np
.
random
.
uniform
(
low
=-
100
,
high
=
100
)
k
=
np
.
random
.
randint
(
2
,
high
=
6
)
config
=
{
'
factor
'
:
a
,
'
exponential
'
:
k
}
def
randomize
(
self
,
config
):
factor
=
config
.
pop
(
'
factor
'
,
np
.
random
.
uniform
(
low
=-
100
,
high
=
100
)
)
exponential
=
config
.
pop
(
'
exponential
'
,
np
.
random
.
randint
(
2
,
high
=
6
)
)
config
=
{
'
factor
'
:
factor
,
'
exponential
'
:
exponential
}
self
.
_reset
(
config
)
def
_get_point
(
self
,
x
):
...
...
@@ -175,9 +179,9 @@ class Continuous(InitialCondition):
# Unpack necessary configurations
self
.
_factor
=
config
.
pop
(
'
factor
'
,
1
)
def
randomize
(
self
):
a
=
np
.
random
.
uniform
(
low
=-
100
,
high
=
100
)
config
=
{
'
factor
'
:
a
}
def
randomize
(
self
,
config
):
factor
=
config
.
pop
(
'
factor
'
,
np
.
random
.
uniform
(
low
=-
100
,
high
=
100
)
)
config
=
{
'
factor
'
:
factor
}
self
.
_reset
(
config
)
def
_get_point
(
self
,
x
):
...
...
@@ -194,9 +198,9 @@ class HeavisideOneSided(InitialCondition):
def
is_smooth
(
self
):
return
False
def
randomize
(
self
):
a
=
np
.
random
.
choice
([
-
1
,
1
]
)
config
=
{
'
factor
'
:
a
}
def
randomize
(
self
,
config
):
factor
=
config
.
pop
(
'
factor
'
,
np
.
random
.
uniform
(
low
=-
100
,
high
=
100
)
)
config
=
{
'
factor
'
:
factor
}
self
.
_reset
(
config
)
def
_get_point
(
self
,
x
):
...
...
@@ -210,15 +214,22 @@ class HeavisideTwoSided(InitialCondition):
# Unpack necessary configurations
self
.
_left_factor
=
config
.
pop
(
'
left_factor
'
,
1
)
self
.
_right_factor
=
config
.
pop
(
'
right_factor
'
,
2
)
self
.
_adjustment
=
config
.
pop
(
'
adjustment
'
,
0
)
def
is_smooth
(
self
):
return
False
def
randomize
(
self
):
a
=
np
.
random
.
choice
([
-
1
,
1
])
b
=
np
.
random
.
choice
([
-
1
,
1
])
config
=
{
'
left_factor
'
:
a
,
'
right_factor
'
:
b
}
def
induce_adjustment
(
self
,
value
):
self
.
_adjustment
=
value
def
randomize
(
self
,
config
):
left_factor
=
config
.
pop
(
'
left_factor
'
,
np
.
random
.
choice
([
-
1
,
1
]))
right_factor
=
config
.
pop
(
'
right_factor
'
,
np
.
random
.
choice
([
-
1
,
1
]))
adjustment
=
config
.
pop
(
'
adjustment
'
,
np
.
random
.
uniform
(
low
=-
1
,
high
=
1
))
config
=
{
'
left_factor
'
:
left_factor
,
'
right_factor
'
:
right_factor
,
'
adjustment
'
:
adjustment
}
self
.
_reset
(
config
)
def
_get_point
(
self
,
x
):
return
self
.
_left_factor
-
self
.
_left_factor
*
np
.
heaviside
(
x
,
0
)
-
self
.
_right_factor
*
np
.
heaviside
(
x
,
0
)
return
self
.
_left_factor
\
-
self
.
_left_factor
*
np
.
heaviside
(
x
-
self
.
_adjustment
,
0
)
\
-
self
.
_right_factor
*
np
.
heaviside
(
x
+
self
.
_adjustment
,
0
)
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