Skip to content

Commit

Permalink
AMD
Browse files Browse the repository at this point in the history
  • Loading branch information
christianbrodbeck committed Jul 26, 2021
1 parent b596b1a commit ea07d5b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion eelbrain/plot/_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def __init__(
splits: Splits,
legend: LegendArg = 'upper right',
colors: dict = None,
xlabel: str = 'Segment',
**kwargs,
):
"""Plot data splits
Expand Down Expand Up @@ -71,7 +72,8 @@ def __init__(
ax.set_ylabel('Split')
ax.set_ylim(-0.5, len(splits.splits)-0.5)
ax.yaxis.set_major_locator(MaxNLocator(integer=True))
ax.set_xlabel('Sample')
if xlabel:
ax.set_xlabel(xlabel)
ax.set_xlim(splits.segments[0, 0], splits.segments[-1, 1])
LegendMixin.__init__(self, legend, handles, labels)
self._show()
Expand Down Expand Up @@ -103,15 +105,18 @@ def preview_partitions(
"""
if isinstance(cases, int):
if cases == 0:
has_case = False
if partitions is None:
partitions = 2 + test + validate if test else 10
ns = [partitions]
else:
has_case = True
if partitions is None:
raise NotImplementedError('Automatic partitions with trials')
ns = [1] * cases
else:
y = asndvar(cases, ds=ds)
has_case = y.has_case
if y.has_case:
n_cases = len(y)
else:
Expand All @@ -120,4 +125,5 @@ def preview_partitions(
index = numpy.cumsum([0] + ns)
segments = numpy.hstack([index[:-1, None], index[1:, None]])
splits = split_data(segments, partitions, model, ds, validate, test)
kwargs.setdefault('xlabel', 'Case' if has_case else 'Segment')
return DataSplit(splits, **kwargs)

0 comments on commit ea07d5b

Please sign in to comment.