Demonstration of the MASTODON FTA Python module

Analysis for the 2006 assessment


In [1]:
from mastodonutils import FTA
quant2006 = FTA.Quantification("gnf_2006", 
                           logic='logic.csv', 
                           basic_events='bas_events_2006.csv',
                           analysis='Fragility', 
                           hazard='seismic_hazard_2006.csv', 
                           IM=[0.04, 0.11, 0.21, 0.42, 0.64, 0.87, 1.09, 1.52, 3.26, 4.34, 6.51], 
                           lite=True,
                           nbins=10,
                           write_output=True)
print 'Risk of collapse for the 2006 assessment is:\t',quant2006.toprisk_2


Risk of collapse for the 2006 assessment is:	[5.266270696624276e-05]

Analysis for the 2015 assessment


In [2]:
from mastodonutils import FTA
quant2015 = FTA.Quantification("gnf_2015", 
                           logic='logic.csv', 
                           basic_events='bas_events_2015.csv',
                           analysis='Fragility', 
                           hazard='seismic_hazard_2015.csv', 
                           IM=[0.01, 0.02, 0.05, 0.1, 0.2, 0.3, 0.7, 2.0, 3.0, 5.0, 10.0], 
                           lite=True,
                           nbins=10,
                           write_output=True)
print 'Risk of collapse for the 2015 assessment is:\t',quant2015.toprisk_2


Risk of collapse for the 2015 assessment is:	[5.195393493062263e-06]

Plotting the collapse frequencies of each bin


In [3]:
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rc('font',family='Times New Roman')
%matplotlib inline
plt.figure(figsize=(10,8))
plt.plot(quant2006.toprisk_2_info[0],quant2006.toprisk_2_info[4],color='blue',label='2006',marker='o',
     markerfacecolor='blue',markersize=8,linewidth=2)
plt.plot(quant2015.toprisk_2_info[0],quant2015.toprisk_2_info[4],color='red',label='2015',marker='o',
     markerfacecolor='red',markersize=8,linewidth=2)
plt.xscale('log')
plt.yscale('log')
plt.xlabel('Sa (10Hz)',fontname='Times New Roman',fontsize=18)
plt.ylabel('Collapse frequency',fontname='Times New Roman',fontsize=18)
plt.legend(loc='best',fontsize=18)
plt.grid(b=True,which='both')
plt.xticks(fontname='Times New Roman', fontsize=16)
plt.yticks(fontname='Times New Roman', fontsize=16)
# plt.savefig('collapse_frequencies.png',dpi=300)


Out[3]:
(array([1.e-29, 1.e-26, 1.e-23, 1.e-20, 1.e-17, 1.e-14, 1.e-11, 1.e-08,
        1.e-05, 1.e-02, 1.e+01]), <a list of 11 Text yticklabel objects>)