Пример #1
0
    def get_nu_1st_2nd(self):
        import pandas as pd
        filename = './fom/nus_mom.csv'
        fom = pd.read_csv(filename).to_numpy()

        # For now, grep proj and rom relerr at the same time
        if self.info['init'] == 'zero':
            self.info['J0'] = mypostpro.find_nearest(self.outputs['t'][0, :],
                                                     501)
        elif self.info['init'] == 'ic':
            self.info['J0'] = 0
        files_dict = self.cdict('nu')
        nbs = []
        ms = []
        sds = []
        merr = []
        verr = []
        sderr = []
        for nb, fnames in files_dict.items():
            for fname in fnames:
                nuss = mypostpro.read_nuss(fname)
                nuss[:, 2] = nuss[:, 2] / 40
                avgidx1 = mypostpro.find_nearest(nuss[:, 1],
                                                 int(self.info['J0']))
                rom_mean = mypostpro.cmean(nuss[avgidx1:-1, :], 2)
                rom_var = mypostpro.cvar(nuss[avgidx1:-1, :], rom_mean, 2)
                rom_sd = mypostpro.csd(nuss[avgidx1:-1, :], rom_mean, 2)
                [mean_err, var_err,
                 sd_err] = mypostpro.cnuss_err(fom[0][0], fom[0][1], fom[0][1],
                                               rom_mean, rom_var, rom_sd)
            merr.append(mean_err)
            verr.append(var_err)
            sderr.append(sd_err)
            nbs.append(int(nb))
            ms.append(rom_mean)
            sds.append(rom_sd)
        self.nbs, self.nus_ms, self.nus_sds, self.mnuserr, self.stdnuserr = [
            list(tuple)
            for tuple in zip(*sorted(zip(nbs, ms, sds, merr, sderr)))
        ]
        return
Пример #2
0
    elif int(sys.argv[3]) > 1:
        root, filenames = setup.gtfpath(search_dir, '^.*_(.*)rom_'+str(N)+'nb_zero.*_'+str(int(anchor-90))+'_*nu$')
    fs.append(filenames.pop())

files_dict = setup.create_dict(fs, '^.*_([0-9]*)nb_.*$')
dict_final = sorted(files_dict.items(), key=operator.itemgetter(0))

color_ctr = 0

i = 0
tpath = './nu/'

fig, ax = plt.subplots(1, tight_layout=True)
# get the FOM data
filename = '../../../../fom_nuss/nuss_fom_'+str(int(anchor))
data = mypostpro.read_nuss(filename)
data[:, 2] = data[:, 2]/40
idx1 = mypostpro.find_nearest(data[:, 0], 0)
idx2 = mypostpro.find_nearest(data[:, 0], 1000)
avgidx1 = mypostpro.find_nearest(data[:, 0], 501)
nuss_fom = data[avgidx1:idx2, :]
fom_mean = mypostpro.cmean(nuss_fom[:idx2], 2)
fom_var = mypostpro.cvar(nuss_fom[:idx2], fom_mean, 2)
fom_sd = mypostpro.csd(nuss_fom[:idx2], fom_mean, 2)
print('FOM data at deg '+str(int(anchor-90)), fom_mean, fom_var, fom_sd)
ax.plot(nuss_fom[:, 0], nuss_fom[:, 2], 'k-', mfc="None", label=r'FOM')

for nb, fnames in dict_final:
    for fname in fnames:

        forleg = fname.split('_')