diff --git a/RASP_support/DrawCompFlow.py b/RASP_support/DrawCompFlow.py index ff5edd6..43c840b 100644 --- a/RASP_support/DrawCompFlow.py +++ b/RASP_support/DrawCompFlow.py @@ -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 = [] @@ -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): diff --git a/RASP_support/analyse.py b/RASP_support/analyse.py index 62b4c0a..fc1b185 100644 --- a/RASP_support/analyse.py +++ b/RASP_support/analyse.py @@ -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]