def semisynthetic_test_paper_1():
    console.write_header("Loading Native symbols")
    symbolClasses = loader.load_native_xls()
    console.write_header("Loading Foreign symbols")
    foreignClasses = loader.load_foreign_xls()

    util.global_variables.CLASS_NUM = len(symbolClasses)
    util.global_variables.CHAR_NUM = len(symbolClasses[0].learning_set[0].characteristicsValues)
           
    # CREATE ELLIPSOIDS AND CUBOIDS FOR EACH LEARNING SET
    console.write_header("Generating Convex and Compact Sets")
    membership = BasicMembership(symbolClasses, False)
    membership.shrink_objects(0)  # just to write to he file
    

    
    for i in range(0,5):
        # Check native
        membership.check_natives_ellipsoid_proper(symbolClasses[:],"foreign_REAL","foreign_REAL")
        membership.check_natives_cuboid_proper(symbolClasses[:],"foreign_REAL","foreign_REAL")  
        # Check foreign
        membership.check_foreign_ellipsoid(foreignClasses,      "foreign_REAL")
        membership.check_foreign_cuboids(foreignClasses,     "foreign_REAL")
        # Shrink
        if i != 4:
            membership.shrink_objects(5)
def static_k_semisynthetic_test_paper_2():
    console.write_header("Loading Native symbols")
    symbolClasses = loader.load_native_xls()
    console.write_header("Loading Foreign symbols")
    foreignClasses = loader.load_foreign_xls()

    util.global_variables.CLASS_NUM = len(symbolClasses)
    util.global_variables.CHAR_NUM = len(symbolClasses[0].learning_set[0].characteristicsValues)
    

    Clusterer().computeClusters(symbolClasses)

    paper2.compute(symbolClasses, foreignClasses)
def real_data():
    console.write_header("Loading Native symbols")
    symbolClasses = loader.load_native_xls()
    console.write_header("Loading Foreign symbols")
    foreignClasses = loader.load_foreign_xls()

    util.global_variables.CLASS_NUM = len(symbolClasses)
    util.global_variables.CHAR_NUM = len(symbolClasses[0].learning_set[0].characteristicsValues)
    
    for c in range(0, util.global_variables.CLASS_NUM):
        console.write_header("Computing Cluster Evaluation")
        best_k = ps.cluster_evaluation(util.global_variables.MAX_K_CLUS_EVALUATION, symbolClasses[c:c+1])
        util.global_variables.K = best_k[0]
        console.write_header("Computing Clusters with K:", str(util.global_variables.K))
        Clusterer().computeClusters(symbolClasses[c:c+1])
        
    console.write_header(" Synthetic Data Calculations")
    synth_calc.ambiguity_for_different_radiuses_real_data(symbolClasses[:], foreignClasses)
def semisynthetic_test_paper_2():
    console.write_header("Loading Native symbols")
    symbolClasses = loader.load_native_xls()
    console.write_header("Loading Foreign symbols")
    foreignClasses = loader.load_foreign_xls()

    util.global_variables.CLASS_NUM = len(symbolClasses)
    util.global_variables.CHAR_NUM = len(symbolClasses[0].learning_set[0].characteristicsValues)
    
    # COMPUTE CLUSTER EVALUATION
    for c in range(0, util.global_variables.CLASS_NUM):
        console.write_header("Computing Cluster Evaluation")
        best_k = ps.cluster_evaluation(util.global_variables.MAX_K_CLUS_EVALUATION, symbolClasses[c:c+1])
        util.global_variables.K = best_k[0]
        console.write_header("Computing Clusters with K:", str(util.global_variables.K))
        Clusterer().computeClusters(symbolClasses[c:c+1])

    paper2.compute(symbolClasses, foreignClasses)
def __serialize():
    logger.log_header("Serializing")

    nativeElements = loader.load_native_xls()

    loader.serialize_chosen_elements(nativeElements)