Skip to content

Commit da28df6

Browse files
committed
More robust min and add nudge to avoid unique values
1 parent 08842c0 commit da28df6

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

panel/simdec.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ def display_n_bins(kind):
202202

203203
@pn.cache
204204
def xlim_auto(res):
205-
return (np.min(res.bin_edges), np.max(res.bin_edges))
205+
bins = np.concatenate(res.bin_edges)
206+
return (np.min(bins), np.max(bins))
206207

207208

208209
@pn.cache

src/simdec/decomposition.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ def statistic_(inputs):
168168
splits = np.array_split(sorted_inputs[:, i], states_)
169169
bin_edges_ = [splits_[0] for splits_ in splits]
170170
bin_edges_.append(splits[-1][-1]) # last point to close the edges
171+
# bin_edges_ = np.unique(bin_edges_) # remove duplicate points, sorted
172+
bin_edges_ += 1e-10 * np.linspace(0, 1, len(bin_edges_))
171173
bin_edges.append(bin_edges_)
172174

173175
res = stats.binned_statistic_dd(

0 commit comments

Comments
 (0)