예제 #1
0
 coeff_novert = genfromtxt(path + 'coefficients/' + 'novert.coeff')
 coeff_all = genfromtxt(path + 'coefficients/' + 'all.coeff')
 #Get coefficient  uncertainties
 sigma_novert = 1.96 * genfromtxt(path + 'coefficients/novert.boot',
                                  usecols=1)
 sigma_novert[1] = -sigma_novert[1]
 sigma_novert[2] = -sigma_novert[2]
 sigma_all = 1.96 * genfromtxt(path + 'coefficients/novert.boot',
                               usecols=1)
 sigma_all[1] = -sigma_all[1]
 sigma_all[2] = -sigma_all[2]
 if len(dnov) >= minsta:
     #print "using "+str(len(dnov))+' stations'
     Mw_nov[kt] = scaling.PGD((dnov + delta) * 100,
                              R,
                              coefficients=coeff_novert,
                              weight=False,
                              norm=norm)
     Mw_all[kt] = scaling.PGD((dall + delta) * 100,
                              R,
                              coefficients=coeff_all,
                              weight=False,
                              norm=norm)
     #Now get upper and lower magnitude bound
     Mw_nov_plus[kt] = scaling.PGD(dnov * 100,
                                   R,
                                   coefficients=coeff_novert +
                                   sigma_novert,
                                   weight=True,
                                   norm=norm)
     Mw_all_plus[kt] = scaling.PGD(dall * 100,
예제 #2
0
                dnov=r_[dnov,pgd[i,1]]
                dall=r_[dall,pgd[i,2]]
                R=r_[R,pgd[i,5]]
                #print R
                #print dall
        #Solve regression
        coeff_novert=genfromtxt(path+'coefficients/'+'novert.coeff')
        coeff_all=genfromtxt(path+'coefficients/'+'all.coeff')
        #Get coefficient  uncertainties
        sigma_novert=1.96*genfromtxt(path+'coefficients/novert.boot',usecols=1)
        sigma_novert[1]=-sigma_novert[1] ; sigma_novert[2]=-sigma_novert[2]
        sigma_all=1.96*genfromtxt(path+'coefficients/novert.boot',usecols=1)
        sigma_all[1]=-sigma_all[1] ; sigma_all[2]=-sigma_all[2]
        if len(dnov)>=minsta:
            #print "using "+str(len(dnov))+' stations'
            Mw_nov[kt]=scaling.PGD(dnov*100,R,coefficients=coeff_novert,weight=weight,norm=norm)
            Mw_all[kt]=scaling.PGD(dall*100,R,coefficients=coeff_all,weight=weight,norm=norm)
            #Now get upper and lower magnitude bound
            Mw_nov_plus[kt]=scaling.PGD(dnov*100,R,coefficients=coeff_novert+sigma_novert,weight=weight,norm=norm)
            Mw_all_plus[kt]=scaling.PGD(dall*100,R,coefficients=coeff_all+sigma_all,weight=weight,norm=norm)
            Mw_nov_minus[kt]=scaling.PGD(dnov*100,R,coefficients=coeff_novert-sigma_novert,weight=weight,norm=norm)
            Mw_all_minus[kt]=scaling.PGD(dall*100,R,coefficients=coeff_all-sigma_all,weight=weight,norm=norm)
            
        else:
            Mw_nov[kt]=nan
            Mw_all[kt]=nan
    #Write to file
    savetxt(path+'PGD/magnitudes/'+event+'.mag',c_[tpgd,Mw_nov,Mw_all,Mw_nov_minus,Mw_nov_plus,Mw_all_minus,Mw_all_plus],fmt='%5.1f\t%5.4f\t%5.4f\t%5.4f\t%5.4f\t%5.4f\t%5.4f',header='t,Mw_nov,Mw_all,Mw_nov_minus,Mw_nov_plus,Mw_all_minus,Mw_all_plus')


if plot:
예제 #3
0
            coeff_all = genfromtxt(path + 'coefficients/' + 'all.coeff')
            #Get coefficient  uncertainties
            sigma_novert = 1.96 * genfromtxt(path + 'coefficients/novert.boot',
                                             usecols=1)
            sigma_novert[1] = -sigma_novert[1]
            sigma_novert[2] = -sigma_novert[2]
            sigma_all = 1.96 * genfromtxt(path + 'coefficients/novert.boot',
                                          usecols=1)
            sigma_all[1] = -sigma_all[1]
            sigma_all[2] = -sigma_all[2]
            if len(dnov) >= minsta:
                #print "using "+str(len(dnov))+' stations'
                #Mw_nov[kt],res_nov[kt]=scaling.PGD(dnov*100,R,coefficients=coeff_novert,weight=False,norm=2,residual=True)
                Mw_all, res_all = scaling.PGD(dall * 100,
                                              R,
                                              coefficients=coeff_all,
                                              weight=False,
                                              norm=2,
                                              residual=True)
                #Now get upper and lower magnitude bound
                #Mw_nov_plus[kt]=scaling.PGD(dnov*100,R,coefficients=coeff_novert+sigma_novert,weight=True,norm=2)
                #Mw_all_plus[kt]=scaling.PGD(dall*100,R,coefficients=coeff_all+sigma_all,weight=True,norm=2)
                #Mw_nov_minus[kt]=scaling.PGD(dnov*100,R,coefficients=coeff_novert-sigma_novert,weight=True,norm=2)
                #Mw_all_minus[kt]=scaling.PGD(dall*100,R,coefficients=coeff_all-sigma_all,weight=True,norm=2)

            else:
                Mw_nov[kt] = nan
                Mw_all[kt] = nan
        Mw_nov = Mw_all
        Mw_nov_plus = Mw_all
        Mw_nov_minus = Mw_all
        Mw_all_plus = Mw_all