Skip to content

Commit

Permalink
Identify trivial case without using the constant property
Browse files Browse the repository at this point in the history
  • Loading branch information
emileferreira committed Feb 6, 2024
1 parent 870d7a2 commit 3d389dd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 10 additions & 6 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,12 +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)]
# in the trivial case (no parents and only one ff), the ff is
# temporarily marked as constant and should be labelled as 'X'
for x in [ff for ff in d_ffs if ff.is_constant()]:
d_ffs.remove(x)
ff_parents.append(x)
x._constant = False
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
4 changes: 0 additions & 4 deletions RASP_support/analyse.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,6 @@ def __init__(self, select, sequences, comp_depth):
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]
else:
# temporarily mark the sequence as constant in the trivial case
for ff in all_ffs:
ff.mark_as_constant()
if remove_minors:
all_ffs = [ff for ff in all_ffs if not ff.is_minor]

Expand Down

0 comments on commit 3d389dd

Please sign in to comment.