Beispiel #1
0
# ------------------------------------------------------------------------------
infec = np.convolve(infec, np.ones(2), 'same')
dead = np.convolve(dead, np.ones(2), 'same')
# ------------------------------------------------------------------------------
infec = np.diff(infec)
dead = np.diff(dead)
dates = dates[0:-1]
# ------------------------------------------------------------------------------
guarda_path = '../pics/cases/'
dpi = 120
size = [9.6, 5.76]
# ------------------------------------------------------------------------------
plt_ = fancy_figure(figsize=size,
                    x=dates,
                    curve=dead,
                    colop='k',
                    symbol='.-',
                    margin=(0.03, 0.03),
                    holdon='on').plotter_date()
# ------------------------------------------------------------------------------
plt_ = fancy_figure(
    figsize=size,
    x=dates,
    curve=infec,
    colop='r',
    symbol='.-',
    margin=(0.03, 0.03),
    title='Daily COVID-19 cases in ' + country_,
    ylabel='Number of people',
    xlabel='Time (days)',
    legends=['Dead', 'Infected'],
Beispiel #2
0
dates = np.array(dates, dtype=np.datetime64)
# ------------------------------------------------------------------------------
if place_name.size > 1:
    place_name_ = ''
    for i_ in range(place_name.size):
        place_name_ = place_name_ + ' ' + place_name[i_]
    place_name = place_name_
else:
    place_name = place_name.item()
# ------------------------------------------------------------------------------
#
# ------------------------------------------------------------------------------
plt_ = fancy_figure(figsize=size,
                    x=dates,
                    curve=dead,
                    colop='k',
                    symbol='.-',
                    margin=(0.03, 0.03),
                    holdon='on').plotter_date()
# ------------------------------------------------------------------------------
plt_ = fancy_figure(figsize=size,
                    x=dates,
                    curve=active,
                    colop='r',
                    symbol='.-',
                    margin=(0.03, 0.03),
                    title='Active COVID-19 cases in ' + place_name,
                    ylabel='Number of people',
                    xlabel='Time (days)',
                    legends=['Dead', 'Active'],
                    fig_name=place_name + '-active',
Beispiel #3
0
import numpy as np
# ------------------------------------------------------------------------------
# load when saved as binary
uo_obs = np.fromfile('../bin/uo_obs.bin', dtype=float)
uo_rec = np.fromfile('../bin/uo_rec.bin', dtype=float)
uo_sig = np.fromfile('../bin/uo_sig.bin', dtype=float)
t = np.fromfile('../bin/t.bin', dtype=float)
# ------------------------------------------------------------------------------
#
#                    plotting routine begins
#
# ------------------------------------------------------------------------------
fancy_figure(
    figsize=size,
    curve=uo_obs,
    x=t,
    symbol='-',
    # colop=((0.5,0,0)),
    margin=(0.05, 0.1),
    holdon='on').plotter()

fancy_figure(
    figsize=size,
    curve=uo_sig,
    x=t,
    symbol='-',
    # colop=((0.5,0,0)),
    margin=(0.05, 0.1),
    holdon='on').plotter()

fancy_figure(
    figsize=size,
Beispiel #4
0
vz_rx_real=vz_rx_real.reshape((nrx,nt))
vz_rx_imag=vz_rx_imag.reshape((nrx,nt))
vz_rx_real=vz_rx_real.transpose()
vz_rx_imag=vz_rx_imag.transpose()
# ------------------------------------------------------------------------------
# 
#                    plotting routine begins 
# 
# ------------------------------------------------------------------------------
fancy_figure(
figsize=size,
curve=sz_time[:,0],
x=t,
title=r'Source on $v_z$',
xlabel='Time (s)',
ylabel='Amplitude',
symbol='-',
colop=((0.3,0.3,0.3)),
margin=(0.05,0.1),
guarda_path=guarda_path,
guarda=dpi,
fig_name='elastic-lamb-source'
).plotter()
# ------------------------------------------------------------------------------
extent_ = np.array([rx[0],rx[-1],t[-1],t[0]],dtype=float)
# ------------------------------------------------------------------------------
plt_=fancy_figure(data=np.zeros((2,2)),holdon='close',colorbaron='off').matrix()
fig,ax=plt_.subplots(1,2,figsize=size)
# ------------------------------------------------------------------------------
fancy_figure(
ax_=ax[0],
aspect='auto',
Beispiel #5
0
    [x_test.max(),
     x_train.max(),
     y_train.max(),
     y_test.max(),
     y_reco.max()])
mini = min(
    [x_test.min(),
     x_train.min(),
     y_train.min(),
     y_test.min(),
     y_reco.min()])

n_samples, npix_x, npix_y = x_train.shape
n_tests, _, _ = x_test.shape
# ------------------------------------------------------------------------------
plt_ = fancy_figure(data=np.zeros((2, 2)), holdon='close',
                    colorbaron='off').matrix()
# ------------------------------------------------------------------------------
fig, ax = plt_.subplots(4, 6)  #,figsize=size)
# ------------------------------------------------------------------------------
for i_ in range(n_samples - 1):
    ic = int(i_ % 6)
    ir = int((i_ - ic) / 6)

    fancy_figure(
        ax_=ax[ir, ic],
        data=y_train[i_, :, :],
        vmin=mini,
        vmax=maxi,
        x_ticklabels='off',
        y_ticklabels='off',
        # colo='Greys',
Beispiel #6
0
quarantined,_,_=fancy_figure.bring(path_,'quarantined',0,0)
dead,_,_       =fancy_figure.bring(path_,'dead',0,0)
it_infec,_,_   =fancy_figure.bring(path_,'it_infec',0,0)
it_infec       = it_infec[0,0]
# ------------------------------------------------------------------------------
# matlab2py bullshit
time_ = time_- 366
time_ = time_.squeeze(axis=1)
it_infec = it_infec-1
# ------------------------------------------------------------------------------
# 
# ------------------------------------------------------------------------------
fancy_figure(
figsize=size,
x=time_,
curve=infectious,
colop='b',
symbol='-',
holdon='on').plotter_date()
# ------------------------------------------------------------------------------
fancy_figure(
x=time_,
curve=dead,
colop='k',
symbol='-',
holdon='on').plotter_date()
# ------------------------------------------------------------------------------
fancy_figure(
x=time_,
curve=quarantined,
colop='m',
Beispiel #7
0
two_d = two_d.transpose()
# ------------------------------------------------------------------------------
print('shape of 1D data ', one_d.shape)
print('shape of 2D data ', two_d.shape)
# ------------------------------------------------------------------------------
#
#                    plotting routine begins
#
# ------------------------------------------------------------------------------
# 2D matrix
fancy_figure(aspect='auto',
             figsize=[5, 5],
             data=two_d,
             x_ticklabels='off',
             y_ticklabels='off',
             title='2D data',
             ylabel='\# of rows',
             xlabel='\# of columns',
             guarda_path=guarda_path,
             guarda=dpi,
             fig_name='fortran-2D').matrix()
# ------------------------------------------------------------------------------
fancy_figure(figsize=size,
             curve=one_d,
             x=t,
             title='1D data',
             xlabel='Time (time units)',
             ylabel='Amplitude',
             symbol='-',
             colo_accu='%2i',
             colop=((0.0471, 0.4824, 0.8627)),
Beispiel #8
0
# ------------------------------------------------------------------------------
size=[4*2,4]
guarda_path = '../pics/'
dpi=120
# ------------------------------------------------------------------------------
import numpy as np
f = np.loadtxt('frequency.dat')
t = np.loadtxt('time.dat')
g_= np.loadtxt('data_f.dat')
g = np.loadtxt('data_t.dat')
# ------------------------------------------------------------------------------
# 
#                    plotting routine begins 
# 
# ------------------------------------------------------------------------------
plt_=fancy_figure(data=np.zeros((2,2)),holdon='close',colorbaron='off').matrix()
# ------------------------------------------------------------------------------
fig,ax=plt_.subplots(1,2,figsize=size)
# ------------------------------------------------------------------------------
fancy_figure(
ax_=ax[0],
figsize=size,
# curve=g_[:,0],
curve=np.fft.fftshift(g_[:,0]),
x=f,
title=r'$\mathbf{R}$',
xlabel='Frequency (Hz)',
ylabel='Amplitude',
symbol='-',
colo_accu='%2i',
colop=((0.0471,0.4824,0.8627)),
Beispiel #9
0
    for iy in range(ny):
        tmp_ = np.array([x_approx_[ix], y_approx_[iy]])
        tmp_ = tmp_.reshape(1, -1)
        tmp_ = exp_imp(tmp_, x_samples, y_samples, gau_pro_)
        y_approx[iy, ix] = tmp_[0]
# ------------------------------------------------------------------------------
#
#
#
#                   actual plotting
#
#
#
#
# ------------------------------------------------------------------------------
plt_ = fancy_figure(data=np.zeros((2, 2)), holdon='close',
                    colorbaron='off').matrix()
# ------------------------------------------------------------------------------
fig, ax = plt_.subplots(1, 2)  #,figsize=size)
# ------------------------------------------------------------------------------
extents_ = [-5, 5, 5, -5]

fancy_figure(ax_=ax[0],
             x=2.06,
             curve=2.14,
             symbol='*',
             colop='b',
             markersize=10,
             holdon='on').plotter()

fancy_figure(ax_=ax[0],
             x=x_samples[0:n_init, 0],
Beispiel #10
0
y_inte = np.fromfile('y_inte.dat', dtype=float)
# ------------------------------------------------------------------------------
nt = t.size
# ------------------------------------------------------------------------------
# # here you transpose/reshape vector to matrix
# data=data.reshape((ncols,nrows))
# data=data.transpose()
# ------------------------------------------------------------------------------
#
#                    plotting routine begins
#
# ------------------------------------------------------------------------------
#                             differentiate
fancy_figure(figsize=size,
             curve=y,
             x=t,
             symbol='-',
             colop=((0.3, 0.5, 0.3)),
             holdon='on').plotter()

fancy_figure(figsize=size,
             curve=y_diff,
             x=t,
             title=r'Differentiate',
             xlabel='Time',
             ylabel='Amplitude',
             symbol='-',
             colop=((0.5, 0.3, 0.3)),
             margin=(0.05, 0.1),
             guarda_path=guarda_path,
             guarda=dpi,
             fig_name='differentiate').plotter()
Beispiel #11
0
mini = -1
maxi = 1

extents_xz = [x[0], x[-1], z[-1], z[0]]
# ------------------------------------------------------------------------------
nrows = 2
ncols = 3

width_max = x[nx - 1]
height_max = z[nz - 1]

wi, he = figaspect(nrows * width_max / (ncols * height_max))
# ------------------------------------------------------------------------------
#                                 🎨🎨
# ------------------------------------------------------------------------------
plt_ = fancy_figure(data=np.zeros((2, 2)), holdon='close',
                    colorbaron='off').matrix()

fig = plt_.figure()
fig.set_size_inches(wi, he)
ax0 = plt_.subplot2grid((1, 2), (0, 0), rowspan=1, colspan=1)
ax1 = plt_.subplot2grid((1, 2), (0, 1), rowspan=1, colspan=1)
# ------------------------------------------------------------------------------
# fig, ax = plt_.subplots()
# fig.suptitle(title_mega,fontsize=20)
# ------------------------------------------------------------------------------
fancy_figure(ax_=ax0,
             x=x,
             y=z,
             extent=extents_xz,
             data=0 * psi1_,
             midi=midi,