def signify_actions(actions, constraints, signs, agent, events, obj_means): for action in actions: act_sign = Sign(action.name) act_signif = act_sign.add_significance() def update_significance(predicate, signature, effect=False): pred_sign = signs[predicate.name] if len(pred_sign.significances) > 1: pred_cm = pred_resonate('significance', pred_sign, predicate, signs, signature) elif len(pred_sign.significances) == 0: pred_cm = pred_sign.add_significance() else: pred_cm = pred_sign.significances[1] connector = act_signif.add_feature(pred_cm, effect=effect) pred_sign.add_out_significance(connector) if len(predicate.signature) == 1: fact = predicate.signature[0] role_sign = signs[fact[1][0].name + fact[0]] conn = act_signif.add_feature(role_sign.significances[1], connector.in_order, effect=effect, zero_out=True) role_sign.add_out_significance(conn) elif not len(predicate.signature) == 0: if not predicate.signature[0][1][ 0].name == predicate.signature[1][1][0].name: for role_sign in pred_cm.get_signs(): connector_new = act_signif.add_feature( role_sign.significances[1], connector.in_order, effect=effect, zero_out=True) role_sign.add_out_significance(connector_new) for predicate in action.precondition: update_significance(predicate, action.signature, False) for predicate in action.effect.addlist: update_significance(predicate, action.signature, True) signs[action.name] = act_sign if constraints: if not action.agents: nonspecialized(constraints, act_signif, signs, agent, obj_means, events) else: specialized(action, signs, events, obj_means, act_signif, agent, constraints) else: simple(signs, events, obj_means, act_signif)
def signify_connection(signs): Send = Sign("Send") send_signif = Send.add_significance() Broadcast = Sign("Broadcast") brdct_signif = Broadcast.add_significance() connector = brdct_signif.add_feature(send_signif) Send.add_out_significance(connector) Approve = Sign("Approve") approve_signif = Approve.add_significance() connector = approve_signif.add_feature(send_signif) Send.add_out_significance(connector) signs[Send.name] = Send signs[Broadcast.name] = Broadcast signs[Approve.name] = Approve They_sign = signs["They"] agents = They_sign.spread_up_activity_obj("significance", 1) agents_type = [] for agent in agents: agents_type.append({ cm.sign for cm in agent.sign.spread_up_activity_obj("significance", 1) }) types = [] if agents_type: types = [ t for t in reduce(lambda x, y: x & y, agents_type) if t != signs["object"] ] if types and len(agents): type = types[0] else: type = signs["I"] They_signif = They_sign.add_significance() brdct_signif = Broadcast.add_significance() connector = They_signif.add_feature(brdct_signif) Broadcast.add_out_significance(connector) type_signif = type.add_significance() approve_signif = Approve.add_significance() # They_signif = They_sign.add_significance() connector = type_signif.add_feature(approve_signif) Approve.add_out_significance(connector) brdct_signif = Broadcast.add_significance() executer = brdct_signif.add_execution(Broadcast.name.lower(), effect=True) Send.add_out_significance(executer) approve_signif = Approve.add_significance() executer = approve_signif.add_execution(Approve.name.lower(), effect=True) Send.add_out_significance(executer)
def ground(problem): domain = problem.domain actions = domain.actions.values() predicates = domain.predicates.values() # Objects objects = problem.objects objects.update(domain.constants) logging.debug("Objects:\n%s" % objects) # Create a map from types to objects type_map = _create_type_map(objects) logging.debug("Type to object map:\n%s" % type_map) # Sign world model signs = {} obj_signifs = {} for obj in objects: obj_sign = Sign(obj) obj_signifs[obj] = obj_sign.add_significance() signs[obj] = obj_sign for tp, objects in type_map.items(): tp_sign = Sign(tp.name) for obj in objects: obj_signif = obj_signifs[obj] tp_signif = tp_sign.add_significance() connector = tp_signif.add_feature(obj_signif, zero_out=True) signs[obj].add_out_significance(connector) signs[tp.name] = tp_sign for predicate in predicates: pred_sign = Sign(predicate.name) significance = pred_sign.add_significance() if len(predicate.signature) == 2: # on(block?x, block?y) def update_significance(fact, effect=False): role_name = fact[1][0].name + fact[0] # (?x, (block,)) if role_name not in signs: signs[role_name] = Sign(role_name) role_sign = signs[role_name] obj_sign = signs[fact[1][0].name] role_signif = role_sign.add_significance() conn = role_signif.add_feature(obj_sign.significances[1], zero_out=True) obj_sign.add_out_significance(conn) conn = significance.add_feature(role_signif, effect=effect, zero_out=True) role_sign.add_out_significance(conn) update_significance(predicate.signature[0]) update_significance(predicate.signature[1]) signs[predicate.name] = pred_sign for action in actions: act_sign = Sign(action.name) act_signif = act_sign.add_significance() def update_significance(predicate, effect=False): pred_sign = signs[predicate.name] connector = act_signif.add_feature(pred_sign.significances[1], effect=effect) pred_sign.add_out_significance(connector) if len(predicate.signature) == 1: fact = predicate.signature[0] role_sign = signs[fact[1][0].name + fact[0]] conn = act_signif.add_feature( role_sign.significances[1], connector.in_order, effect=effect, zero_out=True ) role_sign.add_out_significance(conn) for predicate in action.precondition: update_significance(predicate) for predicate in action.effect.addlist: update_significance(predicate, effect=True) signs[action.name] = act_sign start_situation, pms = _define_situation("*start*", problem.initial_state, signs) goal_situation, pms = _define_situation("*finish*", problem.goal, signs) _expand_situation1(goal_situation, signs, pms) # For task return Task(problem.name, signs, start_situation, goal_situation)
def signify_predicates(predicates, updated_predicates, signs, subtype_map): for predicate in predicates: pred_sign = Sign(predicate.name) # significance = pred_sign.add_significance() signs[predicate.name] = pred_sign if len(predicate.signature) == 2: signifs = [] def update_significance(fact, predicate, subtype_map, updated_predicates, effect=False): role_name = fact[1][0].name + fact[0] fact_name = fact[1][0].name roles = [] roles.append(role_name) role_signifs = [] subroles = [] if role_name not in signs: signs[role_name] = Sign(role_name) if fact_name in subtype_map.keys(): subroles = subtype_map[fact_name] for role, signif in subtype_map.items(): if fact_name in signif: for srole in subroles: srole_name = role + "?" + srole signs[srole_name] = Sign(srole_name) if not srole_name in roles: roles.append(srole_name) sfact_name = fact_name + "?" + srole signs[sfact_name] = Sign(sfact_name) if not sfact_name in roles: roles.append(sfact_name) used_facts = set() for updated_fact in updated_predicates[pred_sign.name]: updated_fact_name = updated_fact[1][0].name updated_fact_role = updated_fact[1][0].name + updated_fact[ 0] predicate_names = [ signa[1][0].name for signa in predicate.signature ] if fact_name == updated_fact_name: srole_name = updated_fact_role used_facts.add(updated_fact[0][1:]) if srole_name not in signs: signs[srole_name] = Sign(srole_name) if not srole_name in roles: roles.append(srole_name) elif fact[0] == updated_fact[0]: srole_name = updated_fact_role used_facts.add(updated_fact_name) if srole_name not in signs: signs[srole_name] = Sign(srole_name) if not srole_name in roles: roles.append(srole_name) elif updated_fact_name in subtype_map[ fact_name] and not updated_fact_name in predicate_names: srole_name = updated_fact_role used_facts.add(updated_fact_name) if srole_name not in signs: signs[srole_name] = Sign(srole_name) if not srole_name in roles: roles.append(srole_name) for role_name in roles: role_sign = signs[role_name] obj_sign = signs[fact_name] spec_sign = None if obj_sign.name in role_sign.name: spec_sign = role_sign.name[len(obj_sign.name) + 1:] smaller_roles = [] if spec_sign and subroles: for srole in subroles: if spec_sign in srole: smaller_roles.append(srole) #smaller_roles = [obj for obj in used_facts if obj in role_name and obj in signs] if not smaller_roles and spec_sign: smaller_roles = [ obj for obj in used_facts if spec_sign in obj and obj in signs ] if smaller_roles: for obj in smaller_roles: updated_obj_sign = signs[obj] if not obj_sign == updated_obj_sign: role_signif = role_sign.add_significance() connector = role_signif.add_feature( updated_obj_sign.significances[1], zero_out=True) updated_obj_sign.add_out_significance( connector) role_signifs.append(role_signif) else: role_signif = role_sign.add_significance() conn = role_signif.add_feature( obj_sign.significances[1], zero_out=True) obj_sign.add_out_significance(conn) role_signifs.append(role_signif) else: role_signif = role_sign.add_significance() conn = role_signif.add_feature( obj_sign.significances[1], zero_out=True) obj_sign.add_out_significance(conn) role_signifs.append(role_signif) if not signifs: signifs.extend(role_signifs) else: role_signs = [cm.sign for cm in role_signifs] if signifs[0].sign in role_signs and signifs[ 1].sign in role_signs: significance = pred_sign.add_significance() conn = significance.add_feature(signifs[0], effect=False, zero_out=True) signifs[0].sign.add_out_significance(conn) connector = significance.add_feature(signifs[1], effect=effect, zero_out=True) signifs[1].sign.add_out_significance(connector) else: for pair in itertools.product(signifs, role_signifs): significance = pred_sign.add_significance() conn = significance.add_feature(pair[0], effect=False, zero_out=True) pair[0].sign.add_out_significance(conn) connector = significance.add_feature(pair[1], effect=effect, zero_out=True) pair[1].sign.add_out_significance(connector) update_significance(predicate.signature[0], predicate, subtype_map, updated_predicates) update_significance(predicate.signature[1], predicate, subtype_map, updated_predicates) elif len(predicate.signature): pred_sign.add_significance()
def ground(problem, agent, subjects, logic, exp_signs=None): domain = problem.domain actions = domain.actions.values() predicates = domain.predicates.values() constraints = problem.constraints # Objects objects = problem.objects objects.update(domain.constants) logging.debug('Objects:\n%s' % objects) # Remove old type_map if exp_signs: objects = _update_exp_signs(exp_signs, objects) # Create a map from types to objects type_map = _create_type_map(objects) logging.debug("Type to object map:\n%s" % type_map) # Create type subtype map subtype_map = _create_subtype(domain.types) obj_signifs = {} obj_means = {} events = [] # Sign world model if exp_signs: signs = exp_signs finish = exp_signs[[ key for key in exp_signs.keys() if "finish" in key ][0]] finish_cm = finish.meanings.get(1) for event in finish_cm.cause: for connector in event.coincidences: if not connector.in_sign == finish: events.append(event) I_sign = signs['I'] They_sign = signs['They'] obj_means[I_sign] = I_sign.meanings[1] obj_signifs[I_sign] = I_sign.significances[1] obj_means[They_sign] = They_sign.meanings[1] obj_signifs[They_sign] = They_sign.significances[1] else: signs = {} I_sign = Sign("I") They_sign = Sign("They") obj_means[I_sign] = I_sign.add_meaning() obj_signifs[I_sign] = I_sign.add_significance() signs[I_sign.name] = I_sign obj_means[They_sign] = They_sign.add_meaning() obj_signifs[They_sign] = They_sign.add_significance() signs[They_sign.name] = They_sign for obj in objects: obj_sign = Sign(obj) obj_signifs[obj] = obj_sign.add_significance() obj_means[obj] = obj_sign.add_meaning() signs[obj] = obj_sign if obj_sign.name == agent: connector = obj_signifs[obj].add_feature(obj_signifs[I_sign], zero_out=True) I_sign.add_out_significance(connector) for tp, objects in type_map.items(): if exp_signs: tp_sign = signs[tp.name] else: tp_sign = Sign(tp.name) for obj in objects: obj_signif = obj_signifs[obj] tp_signif = tp_sign.add_significance() connector = tp_signif.add_feature(obj_signif, zero_out=True) signs[obj].add_out_significance(connector) if not exp_signs: signs[tp.name] = tp_sign for sub in subjects: if sub != agent: if not They_sign in signs[sub].significances[1]: connector = signs[sub].significances[1].add_feature( obj_signifs[They_sign], zero_out=True) They_sign.add_out_significance(connector) if not exp_signs: updated_predicates = _update_predicates(predicates, actions) signify_predicates(predicates, updated_predicates, signs, subtype_map) signify_actions(actions, constraints, signs, agent, events, obj_means) signify_connection(signs) start_situation, pms = _define_situation('*start*', problem.initial_state, signs, events) goal_situation, pms = _define_situation('*finish*', problem.goal, signs, events) if problem.name.startswith("blocks"): list_signs = task_signs(problem) _expand_situation_ma_blocks(goal_situation, signs, pms, list_signs) # For task elif problem.name.startswith("logistics"): _expand_situation_ma_logistics(goal_situation, signs, pms) return Task(problem.name, signs, constraints, start_situation, goal_situation, logic, None, None, None)
def ground(map_file, object_types, agent): """ :param :return: Task """ # map recognition region_map, cell_map, cell_location = map_recogn(map_file, object_types, agent) obj_signifs = {} obj_means = {} signs = {} #I, They signs I_sign = Sign("I") They_sign = Sign("They") obj_signifs[I_sign] = I_sign.add_significance() signs[I_sign.name] = I_sign obj_signifs[They_sign] = They_sign.add_significance() signs[They_sign.name] = They_sign # create sign map and matrix Map_sign = Sign("Map") obj_signifs[Map_sign] = Map_sign.add_significance() signs[Map_sign.name] = Map_sign # create regions signs and matrixes Region_sign = Sign("Region") region_signif = Region_sign.add_significance() obj_signifs[Region_sign] = region_signif signs[Region_sign.name] = Region_sign regions = [] for role in ('?X', '?Y', '?Z'): Region_signs = Sign('Region' + role) regions.append(Region_signs) role_signif = Region_signs.add_significance() obj_signifs[Region_signs] = role_signif signs[Region_signs.name] = Region_signs connector = role_signif.add_feature(region_signif, zero_out=True) Region_sign.add_out_significance(connector) for region in region_map: Regions_sign = Sign(region) obj_signifs[Regions_sign] = Regions_sign.add_significance() signs[Regions_sign.name] = Regions_sign Region_signif = Region_sign.add_significance() connector = Region_signif.add_feature(obj_signifs[Regions_sign], zero_out=True) Regions_sign.add_out_significance(connector) # create cell signs and matrixes Cell_sign = Sign("Cell") obj_signifs[Cell_sign] = Cell_sign.add_significance() signs[Cell_sign.name] = Cell_sign Cellx_sign = Sign("Cell?X") obj_signifs[Cellx_sign] = Cellx_sign.add_significance() signs[Cellx_sign.name] = Cellx_sign Celly_sign = Sign("Cell?Y") obj_signifs[Celly_sign] = Celly_sign.add_significance() signs[Celly_sign.name] = Celly_sign Celly_signif = Celly_sign.add_significance() con = Celly_signif.add_feature(obj_signifs[Cell_sign], zero_out=True) Cell_sign.add_out_significance(con) for cell, value in cell_map.items(): Cells_sign = Sign(cell) obj_signifs[Cells_sign] = Cells_sign.add_significance() signs[Cells_sign.name] = Cells_sign Cell_signif = Cell_sign.add_significance() connector = Cell_signif.add_feature(obj_signifs[Cells_sign], zero_out=True) Cells_sign.add_out_significance(connector) if agent in value: Cellx_signif = Cellx_sign.add_significance() con = Cellx_signif.add_feature(obj_signifs[Cells_sign], zero_out=True) Cells_sign.add_out_significance(con) # create objects signs Object_sign = Sign('Object') obj_signifs[Object_sign] = Object_sign.add_significance() signs[Object_sign.name] = Object_sign obj_signs = [] Block_sign = Sign('Block') obj_signs.append(Block_sign) Obstacle_sign = Sign('Obstacle') obj_signs.append(Obstacle_sign) Border_sign = Sign('Border') obj_signs.append(Border_sign) Nothing_sign = Sign('Nothing') obj_signs.append(Nothing_sign) Agent_sign = Sign('Agent') obj_signs.append(Agent_sign) Table_sign = Sign('Table') obj_signs.append(Table_sign) for s in obj_signs: obj_signifs[s] = s.add_significance() signs[s.name] = s Object_sign_signif = Object_sign.add_significance() connector = Object_sign_signif.add_feature(obj_signifs[s], zero_out=True) s.add_out_significance(connector) dirs = [] Direction_sign = Sign('Direction') dirs.append(Direction_sign) obj_signifs[Direction_sign] = Direction_sign.add_significance() signs[Direction_sign.name] = Direction_sign Direction_start = Sign('Dir-start') dirs.append(Direction_start) Dir_signif = Direction_start.add_significance() obj_signifs[Direction_start] = Dir_signif signs[Direction_start.name] = Direction_start connector = Dir_signif.add_feature(obj_signifs[Direction_sign], zero_out=True) Direction_sign.add_out_significance(connector) Direction_finish = Sign('Dir-finish') dirs.append(Direction_finish) Dir_signif = Direction_finish.add_significance() obj_signifs[Direction_finish] = Dir_signif signs[Direction_finish.name] = Direction_finish connector = Dir_signif.add_feature(obj_signifs[Direction_sign], zero_out=True) Direction_sign.add_out_significance(connector) directions = [ 'Above', 'Below', 'Left', 'Right', 'Above-left', 'Above-right', 'Below-left', 'Below-right' ] for dir in directions: dir_sign = Sign(dir) dir_signif = dir_sign.add_significance() obj_signifs[dir_sign] = dir_signif signs[dir_sign.name] = dir_sign Direction_signif = Direction_sign.add_significance() connector = Direction_signif.add_feature(dir_signif, zero_out=True) dir_sign.add_out_significance(connector) distance = [] # locate objects: include Include_sign = Sign('Include') distance.append(Include_sign) signs[Include_sign.name] = Include_sign obj_signifs[Include_sign] = Include_sign.add_significance() for obj in obj_signs: Include_signif = Include_sign.add_significance() connector = Include_signif.add_feature(obj_signifs[Region_sign], effect=False, zero_out=True) Region_sign.add_out_significance(connector) connector = Include_signif.add_feature(obj_signifs[obj], effect=True, zero_out=True) obj.add_out_significance(connector) #TODO test random cell generation place for region, cells in cell_location.items(): region_sign = signs[region] for cell in cells: Include_signif = Include_sign.add_significance() connector = Include_signif.add_feature(obj_signifs[region_sign], effect=False, zero_out=True) region_sign.add_out_significance(connector) cell_sign = signs[cell] connector = Include_signif.add_feature(obj_signifs[cell_sign], effect=True, zero_out=True) cell_sign.add_out_significance(connector) #include cellX cellY Include_X_signif = Include_sign.add_significance() connector = Include_X_signif.add_feature(obj_signifs[Region_sign], effect=False, zero_out=True) Region_sign.add_out_significance(connector) connector = Include_X_signif.add_feature(obj_signifs[Cellx_sign], effect=True, zero_out=True) Cellx_sign.add_out_significance(connector) Include_Y_signif = Include_sign.add_significance() connector = Include_Y_signif.add_feature(obj_signifs[Region_sign], effect=False, zero_out=True) Region_sign.add_out_significance(connector) connector = Include_Y_signif.add_feature(obj_signifs[Celly_sign], effect=True, zero_out=True) Celly_sign.add_out_significance(connector) # locate objects: contain ag_cell = [] Contain_sign = Sign('Contain') contain_signif = Contain_sign.add_significance() obj_signifs[Contain_sign] = contain_signif for cell, objs in cell_map.items(): cell_sign = signs[cell] if len(objs) > 1 and 0 in objs: for obj in objs: if obj != 0: contain_signif = Contain_sign.add_significance() connector = contain_signif.add_feature( obj_signifs[cell_sign], effect=False, zero_out=True) cell_sign.add_out_significance(connector) if obj in signs: obj_sign = signs[obj] else: obj_sign = Sign(obj) if 'agent' in obj: ag_cell.append(cell) signs[obj_sign.name] = obj_sign obj_signifs[obj_sign] = obj_sign.add_significance() obj_role = obj.title()[:-1] role_names = [s.name for s in obj_signs] if obj_role in role_names: obj_role_sign = signs[obj_role] orss = obj_role_sign.add_significance() con = orss.add_feature(obj_signifs[obj_sign], zero_out=True) obj_sign.add_out_significance(con) connector = contain_signif.add_feature( obj_signifs[obj_sign], effect=True, zero_out=True) obj_sign.add_out_significance(connector) else: contain_signif = Contain_sign.add_significance() connector = contain_signif.add_feature(obj_signifs[cell_sign], effect=False, zero_out=True) cell_sign.add_out_significance(connector) connector = contain_signif.add_feature(obj_signifs[Nothing_sign], effect=True, zero_out=True) Nothing_sign.add_out_significance(connector) # closely Closely_sign = Sign('Closely') distance.append(Closely_sign) signs[Closely_sign.name] = Closely_sign Closely_signif = Closely_sign.add_significance() obj_signifs[Closely_sign] = Closely_signif # locate cells: closely Closely_cells_signif = Closely_sign.add_significance() connector = Closely_cells_signif.add_feature(obj_signifs[Cellx_sign]) Cellx_sign.add_out_significance(connector) connector = Closely_cells_signif.add_feature(obj_signifs[Celly_sign]) Celly_sign.add_out_significance(connector) # locate regions: closely combinations = list(itertools.combinations(regions, 2)) closely_regions = [] for combination in combinations: Closely_signif = Closely_sign.add_significance() closely_regions.append(Closely_signif) connector = Closely_signif.add_feature(obj_signifs[combination[0]]) combination[0].add_out_significance(connector) connector = Closely_signif.add_feature(obj_signifs[combination[1]]) combination[1].add_out_significance(connector) # locate cell and regions: closely closely_regcells = [] for reg in regions: Closely_signif = Closely_sign.add_significance() closely_regcells.append(Closely_signif) connector = Closely_signif.add_feature(obj_signifs[Cellx_sign]) Cellx_sign.add_out_significance(connector) connector = Closely_signif.add_feature(obj_signifs[reg]) reg.add_out_significance(connector) for reg in regions: Closely_signif = Closely_sign.add_significance() closely_regcells.append(Closely_signif) connector = Closely_signif.add_feature(obj_signifs[Celly_sign]) Celly_sign.add_out_significance(connector) connector = Closely_signif.add_feature(obj_signifs[reg]) reg.add_out_significance(connector) # nearly Nearly_sign = Sign('Nearly') distance.append(Nearly_sign) signs[Nearly_sign.name] = Nearly_sign Nearly_signif = Nearly_sign.add_significance() obj_signifs[Nearly_sign] = Nearly_signif # locate cell and regions: nearly cell_y_reg = [ cm for cm in closely_regcells if Celly_sign in cm.get_signs() ] for cm in cell_y_reg: Nearly_signif = Nearly_sign.add_significance() con = Nearly_signif.add_feature(Closely_cells_signif) Closely_sign.add_out_significance(con) conn = Nearly_signif.add_feature(cm) Closely_sign.add_out_significance(conn) # locate regions: nearly Nearly_signif_reg = Nearly_sign.add_significance() Region_X_sign = signs['Region?X'] Region_Y_sign = signs['Region?Y'] Region_Z_sign = signs['Region?Z'] closely_XZ = [ cm for cm in closely_regions if Region_X_sign in cm.get_signs() and Region_Z_sign in cm.get_signs() ][0] closely_ZY = [ cm for cm in closely_regions if Region_Z_sign in cm.get_signs() and Region_Y_sign in cm.get_signs() ][0] con = Nearly_signif_reg.add_feature(closely_XZ) Closely_sign.add_out_significance(con) conn = Nearly_signif_reg.add_feature(closely_ZY) Closely_sign.add_out_significance(conn) # faraway Faraway_sign = Sign('Faraway') distance.append(Faraway_sign) signs[Faraway_sign.name] = Faraway_sign obj_signifs[Faraway_sign] = Faraway_sign.add_significance() Faraway_signif = Faraway_sign.add_significance() con = Faraway_signif.add_feature(Nearly_signif_reg) Nearly_sign.add_out_significance(con) conn = Faraway_signif.add_feature(Include_X_signif) Nearly_sign.add_out_significance(conn) # distance Distance_sign = Sign('Distance') signs[Distance_sign.name] = Distance_sign Distance_signif = Distance_sign.add_significance() obj_signifs[Distance_sign] = Distance_signif for dist in distance: Distance_signif = Distance_sign.add_significance() connector = Distance_signif.add_feature(obj_signifs[dist]) dist.add_out_significance(connector) # location Location_sign = Sign('Location') signs[Location_sign.name] = Location_sign obj_signifs[Location_sign] = Location_sign.add_significance() for dir in dirs: Location_signif = Location_sign.add_significance() conn = Location_signif.add_feature(obj_signifs[Distance_sign], effect=False) Distance_sign.add_out_significance(conn) con = Location_signif.add_feature(obj_signifs[dir], effect=True) dir.add_out_significance(con)