Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: plot 2d pull directly #104

Merged
merged 5 commits into from
Aug 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading