def selected_plans(plans_path): """ Given path to MATSim plans input, yield person id and plan for all selected plans. """ for person in utils.get_elems(plans_path, "person"): for plan in person: if plan.get('selected') == 'yes': yield person.get('id'), plan
def load_attributes_map(attributes_path): """ Given path to MATSim attributes input, return dictionary of attributes (as dict) """ attributes_map = {} people = utils.get_elems(attributes_path, "object") for person in people: att_map = {} for attribute in person: att_map[attribute.get('name')] = attribute.text attributes_map[person.get('id')] = att_map return attributes_map
def load_attributes_map_from_v12(plans_path): return dict([ get_attributes_from_plans(elem) for elem in utils.get_elems(plans_path, "person") ])