Commit 91c4b83c authored by Pablo Iturrieta Rebolledo's avatar Pablo Iturrieta Rebolledo
Browse files

modified Get Models, to shorten name of HRSS

Modified cl test to display in joint plot, 5years above of the 10 yrs result
parent fcc1ecc7
......@@ -41,8 +41,8 @@ def merge_results_batchs(batch1, batch2):
if i.sim_name == j.sim_name:
Forecast_5 = copy.deepcopy(i)
Forecast_10 = copy.deepcopy(j)
Forecast_5.sim_name = Forecast_5.sim_name + ' - 10yr'
Forecast_10.sim_name = '5yr'
Forecast_5.sim_name = Forecast_5.sim_name + ' - 5yr'
Forecast_10.sim_name = '10yr'
CL_merged.append(Forecast_5)
CL_merged.append(Forecast_10)
......@@ -61,10 +61,10 @@ def plot_results(Results, years, savepath=False):
plt.plot(np.mean(j.test_distribution),len(Results)-i-1, 'ko', markersize=4)
ax.xaxis.set_major_locator(tick.MaxNLocator(integer=True))
legend_elements = [Line2D([0], [0], marker='o', lw=0,label='Expected value',
color='k', markersize=5),
Line2D([0], [0], color='k', lw=1, label='95% conf.'),
Line2D([0], [1], color='k', ls='--',lw=1, label='Obs. Likelihood')]
legend_elements = [Line2D([0], [0], marker='o', lw=0,label='Sim. expected value',
color='k', markersize=3),
Line2D([0], [0], color='k', lw=1, label='Sim. 95% conf.'),
Line2D([0], [1], color='k', ls='o',lw=0, markersize=4, label='Obs. Likelihood')]
ax.legend(handles=legend_elements, loc='lower left')
if savepath:
......@@ -74,7 +74,7 @@ def plot_results(Results, years, savepath=False):
def plot_merged_batchs(batch, savepath):
plot_args = {'title': 'CL-test (5-10 years)',
'figsize':(7,6),
'figsize':(6,7),
'xlabel': 'Log-likelihood',
'linewidth': 0.5,
'capsize': 0,
......@@ -87,10 +87,10 @@ def plot_merged_batchs(batch, savepath):
yTickPos = yTickPos[:-1]
ax.barh(yTickPos[::2] + 0.5, 1000*np.array([45] * len(yTickPos[::2])), left=-1000,
height=2 * (yTickPos[1] - yTickPos[0]), color=['w', 'gray'], alpha=0.3)
legend_elements = [Line2D([0], [0], marker='o', lw=0,label='Expected value',
color='k', markersize=5),
Line2D([0], [0], color='k', lw=1, label='95% conf.'),
Line2D([0], [1], color='k', ls='--',lw=1, label='Obs. Likelihood')]
legend_elements = [Line2D([0], [0], marker='o', lw=0,label='Sim. expected value',
color='k', markersize=3),
Line2D([0], [0], color='k', lw=1, label='Sim. 95% conf.'),
Line2D([0], [1], color='k', ls='o',lw=0, markersize=4, label='Obs. Likelihood')]
ax.legend(handles=legend_elements, loc='lower left')
if savepath:
......@@ -143,7 +143,7 @@ def run(use_saved=False):
Results[yr] = Result
plot_results(Result, years=yr, savepath=paths.get_csep_fig_path(test, yr, type))
plot_merged_batchs(merge_results_batchs(Results[years[0]], Results[years[1]]),
plot_merged_batchs(merge_results_batchs(Results[years[1]], Results[years[0]]),
savepath=paths.get_csep_fig_path(test, "%i-%i" % tuple(years), types[0]))
print('Scores 5yr')
get_score(Results[5])
......
......@@ -176,3 +176,5 @@ def filter_10yr_01_2010(cat):
if __name__ == '__main__':
a = bollettino()
cat = filter_10yr_01_2010(a)
print(cat.get_number_of_events())
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment