コード例 #1
0
             ls='--')

method, sym, col, shift, label = (
    'fitness,terminal nodes', 0.0,
    'pred(T)'), 's', 'k', -0.25, 'top ranked terminal nodes '
plt.plot(years + shift,
         prediction_distances[method],
         sym,
         c=col,
         ms=8,
         label=label + r' $\bar{d}=' +
         str(np.round(normed_distances[method][0], 2)) + '$')
method, sym, col, shift, label = (
    'L&L', 0.0,
    'L\&L'), 'o', 'r', 0.25, r'prediction by \L{}uksza and L\"assig'
plt.plot(years[AU.laessig_years(years)] + shift,
         prediction_distances[method][AU.laessig_years(years)],
         sym,
         c=col,
         ms=8,
         label=label + r' $\bar{d}=' +
         str(np.round(normed_distances[method][0], 2)) + '$')

# set limits, ticks, legends
plt.ylim([0.2, 1.7])
plt.yticks([0.5, 1, 1.5])
plt.xlim([min(years) - 0.5, max(years) + 0.5])
plt.xticks(years[::2])
plt.ylabel(r'$\Delta(\mathrm{prediction})$ to next season')
#plt.ylabel('nucleodide distance to next season\n(relative to average)')
plt.xlabel('year')
コード例 #2
0
##################################################################################
# make figure
plt.figure(figsize = (12,6))
# plot line for random expection
plt.plot([min(years)-0.5,max(years)+0.5], [1,1], lw=2, c='k')
# add shaded boxes and optimal
for yi,year in enumerate(years):
    plt.gca().add_patch(plt.Rectangle([year-0.5, 0.2], 1.0, 1.8, color='k', alpha=0.05*(1+np.mod(year,2))))
    plt.plot([year-0.5, year+0.5], [prediction_distances[('minimal',boost,'minimal')][yi],
                                    prediction_distances[('minimal',boost,'minimal')][yi]],
            lw=2, c='k', ls = '--')

method, sym, col, shift, label = ('fitness,terminal nodes',0.0,'pred(T)'), 's', 'k', -0.25, 'top ranked terminal nodes '
plt.plot(years+shift, prediction_distances[method], sym, c= col, ms=8, label=label+r' $\bar{d}='+str(np.round(normed_distances[method][0],2))+'$')
method, sym, col, shift, label = ('L&L',0.0,'L\&L'), 'o', 'r', 0.25, r'prediction by \L{}uksza and L\"assig'
plt.plot(years[AU.laessig_years(years)]+shift, prediction_distances[method][AU.laessig_years(years)],
         sym, c= col, ms=8, label=label+r' $\bar{d}='+str(np.round(normed_distances[method][0],2))+'$')

# set limits, ticks, legends
plt.ylim([0.2, 1.7])
plt.yticks([0.5, 1, 1.5])
plt.xlim([min(years)-0.5,max(years)+0.5])
plt.xticks(years[::2])
plt.ylabel(r'$\Delta(\mathrm{prediction})$ to next season')
#plt.ylabel('nucleodide distance to next season\n(relative to average)')
plt.xlabel('year')
plt.legend(loc=9, ncol=1,numpoints=1)
#add panel label
plt.text(0.02,0.9,'Fig.~3-S1', transform = plt.gca().transAxes, fontsize = 20)
#save figure
plt.tight_layout()
コード例 #3
0
params.year = '????'
params.sample_size = 100
params.collapse = True

base_name, name_mod = test_flu.get_fname(params)
#remove year
base_name = '_'.join(base_name.split('_')[:1] + base_name.split('_')[2:])
base_name = base_name.replace('_????', '')

# load data for different diffusion constants, distance_scales, and koel boosts
metric = 'nuc'
# divide by 2 to change units to pairwise distance
mem_time_scale = m_list = 2.0**np.arange(-6, 4, 1) * 0.5
years, prediction_distance, normed_distance = AU.load_polarizer_data(
    params, metric)
LLii = AU.laessig_years(years)
tau_i = 4
ti_ext = tau_i + 3
ti_int = tau_i + 3 + len(mem_time_scale)
tau = mem_time_scale[tau_i]

##################################################################################
## Fig 5-1 polarizer figure
##################################################################################
# make figure showing the dependence on the scale parameter
fig = plt.figure(figsize=(12, 9))
ax = plt.subplot(111)
plt.plot(mem_time_scale,
         np.ones_like(mem_time_scale) * normed_distance[LLii, 1].mean(),
         c='k',
         lw=2,
コード例 #4
0
analysis_folder = test_flu.flu_analysis_folder
# parse the commandline arguments
parser = test_flu.make_flu_parser()
params = parser.parse_args()
params.year = '????'
params.sample_size = 100
Dlist = [0.2, 0.5]
glist = [1.0, 2.0, 3.0, 5.0]
olist = [0.1]
boost = 0.0

base_name, name_mod = test_flu.get_fname(params)
#remove year
base_name = '_'.join(base_name.split('_')[:1] + base_name.split('_')[2:])
base_name = base_name.replace('_????', '')
LLy = AU.laessig_years(years)

params.collapse = False

# load data for different diffusion constants, distance_scales, and koel boosts
prediction_distance = {}
normed_distance = {}
metric = 'nuc'
for D in Dlist:
    for gamma in glist:
        for omega in olist:
            params.diffusion, params.gamma, params.omega = D, gamma, omega
            prediction_distance[(D, gamma, omega)] = {}
            normed_distance[(D, gamma, omega)] = {}
            years, tmp_pred, tmp_normed = AU.load_prediction_data(
                params, metric)
コード例 #5
0
analysis_folder = test_flu.flu_analysis_folder
# parse the commandline arguments
parser = test_flu.make_flu_parser()
params=parser.parse_args()
params.year='????'
params.sample_size = 100
Dlist = [0.2, 0.5]
glist = [1.0,2.0,3.0, 5.0]
olist = [0.1]
boost = 0.0

base_name, name_mod = test_flu.get_fname(params)
#remove year
base_name = '_'.join(base_name.split('_')[:1]+base_name.split('_')[2:])
base_name = base_name.replace('_????','')
LLy = AU.laessig_years(years)

params.collapse = False

# load data for different diffusion constants, distance_scales, and koel boosts
prediction_distance={}
normed_distance={}
metric = 'nuc'
for D in Dlist:
    for gamma in glist:
        for omega in olist:
            params.diffusion, params.gamma, params.omega = D,gamma, omega
            prediction_distance[(D,gamma,omega)]={}
            normed_distance[(D,gamma,omega)]={}
            years, tmp_pred, tmp_normed = AU.load_prediction_data(params, metric)
            prediction_distance[(D,gamma,omega)].update(tmp_pred)
コード例 #6
0
params=parser.parse_args()
params.year='????'
params.sample_size = 100
params.collapse = True

base_name, name_mod = test_flu.get_fname(params)
#remove year
base_name = '_'.join(base_name.split('_')[:1]+base_name.split('_')[2:])
base_name = base_name.replace('_????','')

# load data for different diffusion constants, distance_scales, and koel boosts
metric = 'nuc'
# divide by 2 to change units to pairwise distance
mem_time_scale = m_list = 2.0**np.arange(-6,4, 1) * 0.5
years, prediction_distance, normed_distance = AU.load_polarizer_data(params, metric)
LLii = AU.laessig_years(years)
tau_i=4
ti_ext = tau_i+3
ti_int = tau_i+3+len(mem_time_scale)
tau = mem_time_scale[tau_i]

##################################################################################
## Fig 5-1 polarizer figure
##################################################################################
# make figure showing the dependence on the scale parameter
fig = plt.figure(figsize = (12,9))
ax= plt.subplot(111)
plt.plot(mem_time_scale, np.ones_like(mem_time_scale)*normed_distance[LLii,1].mean(),
         c='k', lw=2, label = r"L\&L")

# plot values for terminal nodes, they reside in columns 2:(len(mem_time_scale)+2