示例#1
0
    #==================================3=============================================
    #                       compute re-scaled interevent times and distances
    #================================================================================
    catChild.copy(eqCatMc)
    catParent.copy(eqCatMc)
    #catChild, catPar = create_parent_child_cat( projCat, dNND)
    catChild.selEventsFromID(dNND['aEqID_c'], repeats=True)
    catParent.selEventsFromID(dNND['aEqID_p'], repeats=True)
    print('size of parent catalog', catChild.size(), 'size of offspring cat',
          catParent.size())
    # note that dictionary dPar here has to include 'b','D' and 'Mc'
    a_R, a_T = clustering.rescaled_t_r(catChild,
                                       catParent, {
                                           'b': dPar['b'],
                                           'D': dPar['D'],
                                           'Mc': f_Mc
                                       },
                                       correct_co_located=True)
    RT_file = 'data/df1.8/%s_RT_Mc_%.1f.mat' % (file_in.split('.')[0], f_Mc)
    scipy.io.savemat(RT_file, {'R': a_R, 'T': a_T}, do_compression=True)
    #==================================4==============================================================
    #                       T-R density plots
    #=================================================================================================
    a_Tbin = np.arange(dPar['Tmin'], dPar['Tmax'] + 2 * dPar['binx'],
                       dPar['binx'])
    a_Rbin = np.arange(dPar['Rmin'], dPar['Rmax'] + 2 * dPar['biny'],
                       dPar['biny'])
    XX, YY, ZZ = data_utils.density_2D(np.log10(a_T),
                                       np.log10(a_R),
                                       a_Tbin,
示例#2
0
            ax.grid( 'on')
            ax.set_xlim( dPar['xmin'], dPar['xmax'])


            #==================================4==============================================================
            #                           T-R density plot
            #=================================================================================================
            catChild = EqCat()
            catParent= EqCat()
            catChild.copy(  ranCat)
            catParent.copy( ranCat)

            catChild.selEventsFromID(    dNND['aEqID_c'], repeats = True)
            catParent.selEventsFromID(   dNND['aEqID_p'], repeats = True)
            print( catChild.size(), catParent.size(), eqCatMc.size())
            a_R, a_T = clustering.rescaled_t_r( catChild, catParent, dConst, correct_co_located = True)

            a_Tbin = np.arange( dPar['Tmin'], dPar['Tmax']+2*dPar['binx'], dPar['binx'])
            a_Rbin = np.arange( dPar['Rmin'], dPar['Rmax']+2*dPar['biny'], dPar['biny'])
            a_log_T = np.log10( a_T)
            a_log_R = np.log10( a_R)
            XX, YY, ZZ = data_utils.density_2D( a_log_T, a_log_R, a_Tbin, a_Rbin, sigma = dPar['sigma'])

            plt.figure(2, figsize= (8,10))
            ax = plt.subplot(111)
            ax.set_title( 'Nearest Neighbor Pairs in R-T')
            #------------------------------------------------------------------------------
            normZZ = ZZ*( dPar['binx']*dPar['biny']*eqCatMc.size())
            plot1 = ax.pcolormesh( XX, YY, normZZ, cmap=dPar['cmap'])
            cbar  = plt.colorbar(plot1, orientation = 'horizontal', shrink = .5, aspect = 20,)
            #ax.plot(  np.log10( a_T), np.log10( a_R), 'wo', ms = 1.5, alpha = .2)