예제 #1
0
    else:
        print("ERROR: File %s does not exist", sim_file)
        sys.exit(-1)

    # main db
    db_dic = {}

    #array of size of elements per component
    comp_len_dic = {}

    for comp, file_path in sim_files.items():
        if os.path.isfile(file_path):
            # create array of dictionaries to combine
            db_obj = ReadConfig(file_path)
            db_obj.load_db_values()
            comp_len_dic[comp] = (len(db_obj.get_comp_items()))
            # put the array in a dictionary to don't loose it
            db_dic[comp] = db_obj.get_comp_items()

        else:
            print("WARNING: File %s does not exist", file_path)
            pass

    pprint.pprint(db_dic)

    # combine and create tree
    combination = np.array(np.meshgrid(*[np.arange(1, x+1) for k,x in \
            comp_len_dic.items()])).T.reshape(-1,len(comp_len_dic))

    print("\n")
    print("Combinations tree:")