コード例 #1
0
ファイル: test.py プロジェクト: lullimat/idea.deploy
    def test_ManageData_ReadAndDump(self):
        md_dump = ManageData(dump_file=self.file_name)
        md_dump.PushData(data=np.random.rand(10), key='paperino')
        md_dump.PushData(data='pippo, pluto', key='pappo')
        md_dump.Dump()
        del md_dump

        md_read = ManageData(dump_file=self.file_name)
        md_read.Read()
        os.rename(self.file_name, self.file_name_mv)
        md_read.Dump()
        del md_read
        file_cmp = filecmp.cmp(self.file_name, self.file_name_mv)
        os.remove(self.file_name)
        os.remove(self.file_name_mv)
        self.assertTrue(file_cmp)
コード例 #2
0
ファイル: test.py プロジェクト: lullimat/idea.deploy
 def test_ManageData_Dump(self):
     md_dump = ManageData(dump_file=self.file_name)
     md_dump.PushData(data=np.random.rand(10), key='paperino')
     md_dump.PushData(data='pippo, pluto', key='pappo')
     chars_n = md_dump.Dump()
     del md_dump
     os.remove(self.file_name)
     self.assertTrue(True)
コード例 #3
0
ファイル: test.py プロジェクト: lullimat/idea.deploy
    def test_ManageData_Read(self):
        md_dump = ManageData(dump_file=self.file_name)
        md_dump.PushData(data=np.random.rand(10), key='paperino')
        md_dump.PushData(data='pippo, pluto', key='pappo')
        md_dump.Dump()
        del md_dump

        md_read = ManageData(dump_file=self.file_name)
        read_flag = md_read.Read()
        del md_read
        os.remove(self.file_name)
        self.assertTrue(read_flag)
コード例 #4
0
        kde_iso = KernelDensity(bandwidth=0.25, kernel='gaussian')
        kde_iso.fit(np.log(norm_2iso_histo)[:, None])
        logprob_iso_E12[G] = kde_iso.score_samples(u_bins_iso_E12[G][:, None])

        kde_niso = KernelDensity(bandwidth=0.25, kernel='gaussian')
        kde_niso.fit(np.log(norm_2niso_histo)[:, None])
        logprob_niso_E12[G] = kde_niso.score_samples(u_bins_niso_E12[G][:,
                                                                        None])

    MDH.PushData(data=u_bins_iso_E12, key='u_bins_iso' + 'E12')
    MDH.PushData(data=u_bins_niso_E12, key='u_bins_niso' + 'E12')
    MDH.PushData(data=logprob_iso_E12, key='logprob_iso' + 'E12')
    MDH.PushData(data=logprob_niso_E12, key='logprob_niso' + 'E12')

    MDH.Dump()
else:
    u_bins_iso_E6 = MDH.PullData('u_bins_iso' + 'E6')
    u_bins_niso_E6 = MDH.PullData('u_bins_niso' + 'E6')
    logprob_iso_E6 = MDH.PullData('logprob_iso' + 'E6')
    logprob_niso_E6 = MDH.PullData('logprob_niso' + 'E6')

    u_bins_iso_E8 = MDH.PullData('u_bins_iso' + 'E8')
    u_bins_niso_E8 = MDH.PullData('u_bins_niso' + 'E8')
    logprob_iso_E8 = MDH.PullData('logprob_iso' + 'E8')
    logprob_niso_E8 = MDH.PullData('logprob_niso' + 'E8')

    u_bins_iso_E10 = MDH.PullData('u_bins_iso' + 'E10')
    u_bins_niso_E10 = MDH.PullData('u_bins_niso' + 'E10')
    logprob_iso_E10 = MDH.PullData('logprob_iso' + 'E10')
    logprob_niso_E10 = MDH.PullData('logprob_niso' + 'E10')
コード例 #5
0
                    _u_profiles[_bin_i, _r] = np.sqrt(((UX_spl(_x_cut, _y_cut)) ** 2 + 
                                                       (UY_spl(_x_cut, _y_cut)) ** 2)/c2)
                _bin_i += 1

            _u_profile_ave[_str] = np.zeros(_r_range.shape[0])
            _u_profile_err[_str] = np.zeros(_r_range.shape[0])

            for _r in _r_range:
                _u_profile_ave[_str][_r] = np.mean(_u_profiles[:, _r])
                _u_profile_err[_str][_r] = np.sqrt(np.var(_u_profiles[:, _r])/(_n_bins - 1))

    AveU.PushData(data = _u_profile_ave, key = '_u_profile_ave')
    AveU.PushData(data = _u_profile_err, key = '_u_profile_err')
    AveU.PushData(data = L, key = 'L')

    AveU.Dump()
else:
    _u_profile_ave = AveU.PullData('_u_profile_ave')
    _u_profile_err = AveU.PullData('_u_profile_err')
    L = AveU.PullData('L')
    _r_range = np.arange(0, L//2, 1)

'''
Plotting
'''
from matplotlib import rc, rcParams
import matplotlib
import matplotlib.pyplot as plt
rc('font',**{'family':'STIXGeneral'})
rc('mathtext', **{'fontset': 'stix'})
rc('text', usetex=True)