@@ -100,7 +100,7 @@ class _Interval:
100
100
The parent interval.
101
101
children : list of `_Interval`s
102
102
The intervals resulting from a split.
103
- done_points : dict
103
+ data : dict
104
104
A dictionary with the x-values and y-values: `{x1: y1, x2: y2 ...}`.
105
105
done : bool
106
106
The integral and the error for the interval has been calculated.
@@ -133,15 +133,15 @@ class _Interval:
133
133
"ndiv" ,
134
134
"parent" ,
135
135
"children" ,
136
- "done_points " ,
136
+ "data " ,
137
137
"done_leaves" ,
138
138
"depth_complete" ,
139
139
"removed" ,
140
140
]
141
141
142
142
def __init__ (self , a , b , depth , rdepth ):
143
143
self .children = []
144
- self .done_points = {}
144
+ self .data = {}
145
145
self .a = a
146
146
self .b = b
147
147
self .depth = depth
@@ -172,9 +172,9 @@ def T(self):
172
172
173
173
def refinement_complete (self , depth ):
174
174
"""The interval has all the y-values to calculate the intergral."""
175
- if len (self .done_points ) < ns [depth ]:
175
+ if len (self .data ) < ns [depth ]:
176
176
return False
177
- return all (p in self .done_points for p in self .points (depth ))
177
+ return all (p in self .data for p in self .points (depth ))
178
178
179
179
def points (self , depth = None ):
180
180
if depth is None :
@@ -255,7 +255,7 @@ def complete_process(self, depth):
255
255
assert self .depth_complete is None or self .depth_complete == depth - 1
256
256
self .depth_complete = depth
257
257
258
- fx = [self .done_points [k ] for k in self .points (depth )]
258
+ fx = [self .data [k ] for k in self .points (depth )]
259
259
self .fx = np .array (fx )
260
260
force_split = False # This may change when refining
261
261
@@ -375,7 +375,7 @@ def __init__(self, function, bounds, tol):
375
375
self .tol = tol
376
376
self .max_ivals = 1000
377
377
self .priority_split = []
378
- self .done_points = {}
378
+ self .data = {}
379
379
self .pending_points = set ()
380
380
self ._stack = []
381
381
self .x_mapping = defaultdict (lambda : SortedSet ([], key = attrgetter ("rdepth" )))
@@ -391,13 +391,13 @@ def approximating_intervals(self):
391
391
def tell (self , point , value ):
392
392
if point not in self .x_mapping :
393
393
raise ValueError (f"Point { point } doesn't belong to any interval" )
394
- self .done_points [point ] = value
394
+ self .data [point ] = value
395
395
self .pending_points .discard (point )
396
396
397
397
# Select the intervals that have this point
398
398
ivals = self .x_mapping [point ]
399
399
for ival in ivals :
400
- ival .done_points [point ] = value
400
+ ival .data [point ] = value
401
401
402
402
if ival .depth_complete is None :
403
403
from_depth = 0 if ival .parent is not None else 2
@@ -438,8 +438,8 @@ def add_ival(self, ival):
438
438
for x in ival .points ():
439
439
# Update the mappings
440
440
self .x_mapping [x ].add (ival )
441
- if x in self .done_points :
442
- self .tell (x , self .done_points [x ])
441
+ if x in self .data :
442
+ self .tell (x , self .data [x ])
443
443
elif x not in self .pending_points :
444
444
self .pending_points .add (x )
445
445
self ._stack .append (x )
@@ -518,7 +518,7 @@ def _fill_stack(self):
518
518
@property
519
519
def npoints (self ):
520
520
"""Number of evaluated points."""
521
- return len (self .done_points )
521
+ return len (self .data )
522
522
523
523
@property
524
524
def igral (self ):
@@ -552,11 +552,9 @@ def loss(self, real=True):
552
552
def plot (self ):
553
553
hv = ensure_holoviews ()
554
554
ivals = sorted (self .ivals , key = attrgetter ("a" ))
555
- if not self .done_points :
555
+ if not self .data :
556
556
return hv .Path ([])
557
- xs , ys = zip (
558
- * [(x , y ) for ival in ivals for x , y in sorted (ival .done_points .items ())]
559
- )
557
+ xs , ys = zip (* [(x , y ) for ival in ivals for x , y in sorted (ival .data .items ())])
560
558
return hv .Path ((xs , ys ))
561
559
562
560
def _get_data (self ):
@@ -565,7 +563,7 @@ def _get_data(self):
565
563
566
564
return (
567
565
self .priority_split ,
568
- self .done_points ,
566
+ self .data ,
569
567
self .pending_points ,
570
568
self ._stack ,
571
569
x_mapping ,
@@ -574,7 +572,7 @@ def _get_data(self):
574
572
)
575
573
576
574
def _set_data (self , data ):
577
- self .priority_split , self .done_points , self .pending_points , self ._stack , x_mapping , self .ivals , self .first_ival = (
575
+ self .priority_split , self .data , self .pending_points , self ._stack , x_mapping , self .ivals , self .first_ival = (
578
576
data
579
577
)
580
578
0 commit comments