Skip to content

Commit 3f6d67c

Browse files
committed
fixed conflicts
2 parents 03e15ee + 48878be commit 3f6d67c

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

basicrta/gibbs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def cluster(self, method="GaussianMixture", **kwargs):
274274
setattr(self.processed_results, 'indicator', pindicator)
275275
setattr(self.processed_results, 'labels', all_labels)
276276

277-
def process_gibbs(self):
277+
def process_gibbs(self, show=True):
278278
r"""
279279
Process the samples collected from the Gibbs sampler.
280280
:meth:`process_gibbs` can be called multiple times to check the
@@ -298,7 +298,7 @@ def process_gibbs(self):
298298
lmode = stats.mode(lens).mode
299299

300300
self.cluster(n_init=117, n_components=lmode)
301-
labels, presorts = mixture_and_plot(self)
301+
labels, presorts = mixture_and_plot(self, show=show)
302302
setattr(self.processed_results, 'labels', labels)
303303
setattr(self.processed_results, 'indicator',
304304
self.processed_results.indicator[:, presorts])
@@ -712,8 +712,8 @@ def estimate_tau(self):
712712

713713
taus = 1 / rp.rates[rp.labels == index]
714714
ci = confidence_interval(taus)
715-
bins = 15
716-
h = np.histogram(taus, bins=bins)
715+
bins = 10
716+
h = np.histogram(taus, bins='sqrt')
717717
indmax = h[0].argmax()
718718
val = 0.5 * (h[1][:-1][indmax] + h[1][1:][indmax])
719719
return [ci[0], val, ci[1]]

basicrta/util.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ def extract_data(gibbs):
692692
return data, train_inds
693693

694694
def mixture_and_plot(gibbs, scale=2, sparse=1, remove_noise=False, wlim=None,
695-
rlim=None, **kwargs):
695+
rlim=None, show=True, **kwargs):
696696
from scipy import stats
697697
from matplotlib.ticker import MaxNLocator
698698

@@ -1193,10 +1193,10 @@ def mixture_and_plot(gibbs, scale=2, sparse=1, remove_noise=False, wlim=None,
11931193
figp.savefig(f"{basename}_validate.{suffix}",
11941194
bbox_inches='tight')
11951195

1196-
figa.show()
1197-
figt.show()
1198-
figp.show()
1199-
plt.close('all')
1196+
if show:
1197+
figa.show()
1198+
figt.show()
1199+
figp.show()
12001200
return all_labels, presorts
12011201

12021202

0 commit comments

Comments
 (0)