Skip to content

Commit

Permalink
Merge pull request #104 from jiangyi15/2d_pull
Browse files Browse the repository at this point in the history
feat: plot 2d pull directly
  • Loading branch information
jiangyi15 authored Aug 26, 2023
2 parents 11f56b3 + 2b6b523 commit 5a7ef7e
Show file tree
Hide file tree
Showing 4 changed files with 299 additions and 154 deletions.
8 changes: 5 additions & 3 deletions tf_pwa/adaptive_bins.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
class AdaptiveBound(object):
"""adaptive bound cut for data value"""

def __init__(self, base_data, bins):
def __init__(self, base_data, bins, base_bound=None):
self._base_bound = base_bound
if isinstance(bins, int):
self._base_data = np.array([base_data])
self.bins = [[bins]]
Expand All @@ -33,9 +34,10 @@ def __init__(self, base_data, bins):
@functools.lru_cache()
def get_bounds_data(self):
"""get split data bounds, and the data after splitting"""
base_bound = AdaptiveBound.base_bound(self._base_data)
if self._base_bound is None:
self._base_bound = AdaptiveBound.base_bound(self._base_data)
bounds, datas = AdaptiveBound.loop_split_bound(
self._base_data, self.bins
self._base_data, self.bins, self._base_bound
)
return bounds, datas

Expand Down
Loading

0 comments on commit 5a7ef7e

Please sign in to comment.