Skip to content

Commit

Permalink
Draw trivial tokens and indices (#12)
Browse files Browse the repository at this point in the history
* Allow drawing the trivial s-ops (tokens and indices)
  • Loading branch information
emileferreira authored Feb 6, 2024
1 parent ffe807f commit 8fbbc67
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
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

0 comments on commit 8fbbc67

Please sign in to comment.