Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
adaptive
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Quantum Tinkerer
adaptive
Commits
aade38cf
Commit
aade38cf
authored
7 years ago
by
Bas Nijholt
Browse files
Options
Downloads
Patches
Plain Diff
2D: remove self.tri because self.tri.points != self.points, different order
parent
8d75baa4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!7
implement 2D learner
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
adaptive/learner.py
+6
-13
6 additions, 13 deletions
adaptive/learner.py
with
6 additions
and
13 deletions
adaptive/learner.py
+
6
−
13
View file @
aade38cf
...
...
@@ -620,7 +620,6 @@ class Learner2D(BaseLearner):
self
.
_stack
=
[]
self
.
_interp
=
{}
self
.
_loss_improvements
=
[]
self
.
tri
=
None
self
.
tri_combined
=
None
# Keeps track till which index _points and _values are filled
...
...
@@ -664,15 +663,11 @@ class Learner2D(BaseLearner):
@property
def
ip
(
self
):
# Create the Delaunay object
if
self
.
tri
is
None
:
self
.
tri
=
spatial
.
Delaunay
(
self
.
points
,
incremental
=
True
,
qhull_options
=
'
Q11 QJ
'
)
return
interpolate
.
LinearNDInterpolator
(
self
.
tri
,
self
.
values
)
return
interpolate
.
LinearNDInterpolator
(
self
.
points
,
self
.
values
)
@property
def
ip_combined
(
self
):
# Create the Delaunay object
if
self
.
tri_combined
is
None
:
self
.
tri_combined
=
spatial
.
Delaunay
(
self
.
points_combined
,
incremental
=
True
,
...
...
@@ -718,13 +713,10 @@ class Learner2D(BaseLearner):
self
.
_stack
.
pop
(
i
)
break
# Add the points to the Delaunay object
s
# Add the points to the Delaunay object
if
self
.
tri_combined
and
not
old_point
:
self
.
tri_combined
.
add_points
([
point
])
if
self
.
tri
and
value
is
not
None
:
self
.
tri
.
add_points
([
point
])
def
_deviation_from_linear_estimate
(
self
,
ip
,
gradients
):
tri
=
ip
.
tri
p
=
tri
.
points
[
tri
.
vertices
]
...
...
@@ -744,7 +736,6 @@ class Learner2D(BaseLearner):
def
tri_radius
(
self
,
points
):
center
=
points
.
mean
(
axis
=-
2
)
/
(
self
.
ndim
+
1
)
center_val
=
self
.
ip_combined
(
center
)
return
np
.
linalg
.
norm
(
points
-
center
,
axis
=
1
).
max
()
def
_fill_stack
(
self
,
stack_till
=
None
):
...
...
@@ -767,7 +758,7 @@ class Learner2D(BaseLearner):
# Interpolate
ip
=
self
.
ip_combined
tri
=
ip
.
tri
tri
=
self
.
tri_combined
# Gradients
grad
=
interpolate
.
interpnd
.
estimate_gradients_2d_global
(
...
...
@@ -863,6 +854,8 @@ class Learner2D(BaseLearner):
def
remove_unfinished
(
self
):
self
.
_points
=
self
.
points
self
.
_values
=
self
.
values
self
.
tri_combined
=
spatial
.
Delaunay
(
self
.
points
,
incremental
=
True
,
qhull_options
=
'
Q11 QJ
'
)
self
.
n
-=
len
(
self
.
_interp
)
self
.
_interp
=
{}
...
...
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