예제 #1
0
import os, copy, argparse
from collections import OrderedDict
from pypospack.pyposmat.data import PyposmatDataFile
from pypospack.pyposmat.data import PyposmatConfigurationFile
from pypospack.pyposmat.data import PyposmatDataAnalyzer

if __name__ == "__main__":
    _fn_config = os.path.join("resources", "pyposmat.config.in")
    _fn_data = os.path.join("resources", "pyposmat.results.0.out")
    _fn_pareto_out = os.path.join("pyposmat.pareto.out")

    pda = PyposmatDataAnalyzer(fn_config=_fn_config, fn_data=_fn_data)
    pareto_df = pda.calculate_pareto_set()

    datafile = PyposmatDataFile()
    datafile.df = pareto_df
    datafile.parameter_names = pda.parameter_names
    datafile.qoi_names = pda.qoi_names
    datafile.error_names = pda.error_names
    datafile.names = ['sim_id'] \
            +datafile.parameter_names\
            +datafile.qoi_names\
            +datafile.error_names
    datafile.types = ['sim_id']\
            +len(datafile.parameter_names)*['param']\
            +len(datafile.qoi_names)*['qoi_names']\
            +len(datafile.error_names)*['error_names']
    datafile.write(_fn_pareto_out)
    datafile.read(_fn_pareto_out)
예제 #2
0
def test__calculate_pareto_set__df_equals_DataFrame():
    o = PyposmatDataAnalyzer(fn_config=config_fn, fn_data=data_fn)
    o.calculate_pareto_set(df=o.data.df)
예제 #3
0
def test__calculate_pareto_set__df_equals_None():
    o = PyposmatDataAnalyzer(fn_config=config_fn, fn_data=data_fn)
    o.calculate_pareto_set()
예제 #4
0
                           'examples', 'Ni__eam__born_exp_rose',
                           '01_preconditioning_3.5NN', 'data',
                           'pyposmat.results.0.out')

    # check if files exist
    if os.path.isfile(config_fn):
        print('config_fn:{}'.format(config_fn))
    else:
        print('cannot find config_fn:{}'.format(config_fn))
        exit()

    if os.path.isfile(data_fn):
        print('data_fn:{}'.format(data_fn))
    else:
        print('cannot find data_fn:{}'.format(data_fn))
        exit()

    # initialization
    o = PyposmatDataAnalyzer(fn_config=config_fn, fn_data=data_fn)
    print(o.parameter_names)
    results_nrows, results_ncols = o.data.df.shape
    # calculate_pareto_set
    pareto_df = o.calculate_pareto_set(df=o.data.df)
    pareto_nrows, pareto_ncols = pareto_df.loc[pareto_df["is_pareto"] ==
                                               True].shape

    print("n_results:{}".format(results_nrows))
    print("n_pareto:{}".format(pareto_nrows))

    print(pareto_df["is_pareto"])