Example #1
0
def export_fragility(vuln, plot_feature, x, y,leg):
    plotflag, linew, fontsize, units, iml = plot_feature[0:5]
    cd = os.getcwd()
    if vuln == 0:
        if plotflag[2]:
            plot_fragility(iml,np.exp(x),y,linew,fontsize,units,leg)
        # Export fragility parameters (mu and cov of Sa) to csv
        # from log-mean to mean and from dispersion to cofficient of variation
        [meanSa, stSa] = from_median_to_mean(np.exp(x),y)
        cov = np.divide(stSa,meanSa)
        output_path = cd+'/outputs/fragility_parameters.csv'
        header = ['DS', 'mean', 'coefficient of variation']
        n_lines = len(meanSa)
        DS = range(len(meanSa)+1)
        col_data = [DS[1:], meanSa, cov]
        print_outputs(output_path,header,n_lines,col_data)
Example #2
0
def export_fragility(vuln, plot_feature, x, y, leg):
    plotflag, linew, fontsize, units, iml = plot_feature[0:5]
    cd = os.getcwd()
    if vuln == 0:
        if plotflag[2]:
            plot_fragility(iml, np.exp(x), y, linew, fontsize, units, leg)
        # Export fragility parameters (mu and cov of Sa) to csv
        # from log-mean to mean and from dispersion to cofficient of variation
        [meanSa, stSa] = from_median_to_mean(np.exp(x), y)
        cov = np.divide(stSa, meanSa)
        output_path = cd + '/outputs/fragility_parameters.csv'
        header = ['DS', 'mean', 'coefficient of variation']
        n_lines = len(meanSa)
        DS = range(len(meanSa) + 1)
        col_data = [DS[1:], meanSa, cov]
        print_outputs(output_path, header, n_lines, col_data)
Example #3
0
# <nbformat>3.0</nbformat>

# <codecell>

# Clear existing variables
def clearall():
    all = [var for var in globals() if var[0] != "_"]
    for var in all:
        del globals()[var]
clearall()
import numpy as np
from rmtk.vulnerability.common.conversions import from_median_to_mean
from rmtk.vulnerability.common.conversions import from_mean_to_median
# variables
log_meanSa, beta = 0.60, 0.757
Sa50 = np.exp(log_meanSa)

# <codecell>

[meanSa, stSa] = from_median_to_mean(Sa50,beta)
print meanSa, stSa

# <codecell>

[Sa50, beta] = from_mean_to_median(meanSa, stSa)
print np.log(Sa50), beta

# <codecell>


Example #4
0
# <codecell>


# Clear existing variables
def clearall():
    all = [var for var in globals() if var[0] != "_"]
    for var in all:
        del globals()[var]


clearall()
import numpy as np
from rmtk.vulnerability.common.conversions import from_median_to_mean
from rmtk.vulnerability.common.conversions import from_mean_to_median
# variables
log_meanSa, beta = 0.60, 0.757
Sa50 = np.exp(log_meanSa)

# <codecell>

[meanSa, stSa] = from_median_to_mean(Sa50, beta)
print meanSa, stSa

# <codecell>

[Sa50, beta] = from_mean_to_median(meanSa, stSa)
print np.log(Sa50), beta

# <codecell>