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

Draw trivial tokens and indices #12

Merged
merged 8 commits into from
Feb 6, 2024
10 changes: 10 additions & 0 deletions RASP_support/DrawCompFlow.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,15 @@ def contains_tokens(mvs):
False)


def just_base_sequence_fix(d_ffs, ff_parents):
# when there are no parents and only one ff, then we are actually just
# looking at the indices/tokens by themselves. in this case, putting that
# ff in as a parent (with no child) makes the layer draw it properly
if not ff_parents and len(d_ffs) == 1:
return ff_parents, d_ffs
return d_ffs, ff_parents


class Layer:
def __init__(self, depth, d_heads, d_ffs, add_tokens_on_ff=False):
self.heads = []
Expand All @@ -464,6 +473,7 @@ def __init__(self, depth, d_heads, d_ffs, add_tokens_on_ff=False):
ff_parents += ff.get_nonminor_parent_sequences()
ff_parents = list(set(ff_parents))
ff_parents = [p for p in ff_parents if not guarded_contains(d_ffs, p)]
d_ffs, ff_parents = just_base_sequence_fix(d_ffs, ff_parents)
rows_by_type = {RES: d_ffs, VVAR: ff_parents}
rowtype_order = [VVAR, RES]
if add_tokens_on_ff and not contains_tokens(ff_parents):
Expand Down
5 changes: 4 additions & 1 deletion RASP_support/analyse.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ def __init__(self, select, sequences, comp_depth):
seq_layers, layer_selects = self.schedule(
'best', remove_minors=remove_minors)

all_ffs = [m for m in self.get_full_seq_parents() if m.from_zipmap]
all_ffs = self.get_full_seq_parents()
if len(all_ffs) > 1:
# filter out non-ffs in the non-trivial case
all_ffs = [m for m in all_ffs if m.from_zipmap]
if remove_minors:
all_ffs = [ff for ff in all_ffs if not ff.is_minor]

Expand Down
Loading