예제 #1
0
파일: mtBinSum.py 프로젝트: iwbailey/pythMT
# check some info was provided
if args.ifile.isatty():
    print >> sys.stderr, "Error: No ifile and nothing in stdin. Exiting..."
    sys.exit()

# read the moment tensors
if( args.ifmt == 1 ):
    if( args.isVb ): sys.stderr.write('Reading Strike/dip/rake.\n' )
    (mtlist, allin) = read_sdrlist( args.ifile )

    # convert
    for i in range(0,len(mtlist)): 
        mtlist[i] = dc2SymMT( mtlist[i] )

else:
    (mtlist, allin) = read_psmecalist( args.ifile, isEig=False )

ndata = len(mtlist)
if( args.isVb ): sys.stderr.write('%i events read in.\n' % ndata )

# normalise correction
if( args.stype == 1):  
    for i in range( 0, ndata ): mtlist[i].Norm = 1

# bin in magnitude
binx = 0.5*(args.x01[0]+args.x01[1])
biny = 0.5*(args.y01[0]+args.y01[1])
binz = 0.5*(args.z01[0]+args.z01[1])
( binlist1, ninside) = EB.binMT_mag( mtlist, args.m01[0], args.m01[1], args.nm, 
                                    NP.array([binx, biny, binz]) )
예제 #2
0
args = parser.parse_args()

#------------------------------

# check some info was provided
if args.ifile.isatty():
    print >> sys.stderr, "Error: No ifile and nothing in stdin. Exiting..."
    sys.exit()

# read the moment tensors
if (args.ifmt == 1):
    if (args.isVb): sys.stderr.write('Reading Strike/dip/rake.\n')
    (mtlist, alltxt) = IO.read_sdrlist(args.ifile)
else:
    (mtlist, alltxt) = IO.read_psmecalist(args.ifile, isEig=True)

ndata = len(mtlist)
if (args.isVb): sys.stderr.write('%i events read in.\n' % ndata)

# convert min plunge to min abs val of z component
if (args.pmin != None):
    if (args.isVb): sys.stderr.write('p_min = %f.\n' % args.pmin)
    minZ = sin(abs(args.pmin) * pi / 180)
    if (args.isVb): sys.stderr.write('minZ = %f.\n' % minZ)
else:
    # no oblique category if pmin is not defined
    minZ = 0.0

# loop through each tensor
for i in range(0, ndata):
예제 #3
0
                    action="store_true",
                    dest="isVb",
                    default=False,
                    help="Verbose output")

args = parser.parse_args()

#--------------------------------------------------

# check some info was provided
if args.ifile.isatty():
    print >> sys.stderr, "Error: No ifile and nothing in stdin. Exiting..."
    sys.exit()

# read the input into moment tensors
(mtlist, alltxt) = read_psmecalist(args.ifile)

# loop through all
n = len(mtlist)
if (args.isVb): print "Read %i moment tensors" % n

sth = False  # flag so we write a new line

for i in range(0, n):

    # output the original line
    if args.isPaste:
        sth = True
        args.ofile.write("%s " % alltxt[i])
    if args.pos:
        # output the position
예제 #4
0
# check some info was provided
if args.ifile.isatty():
    print >> sys.stderr, "Error: No ifile and nothing in stdin. Exiting..."
    sys.exit()

# read the moment tensors
if (args.ifmt == 1):
    if (args.isVb): sys.stderr.write('Reading Strike/dip/rake.\n')
    (mtlist, allin) = read_sdrlist(args.ifile)

    # convert
    for i in range(0, len(mtlist)):
        mtlist[i] = dc2SymMT(mtlist[i])

else:
    (mtlist, allin) = read_psmecalist(args.ifile, isEig=False)

ndata = len(mtlist)
if (args.isVb): sys.stderr.write('%i events read in.\n' % ndata)

# normalise correction
if (args.stype == 1):
    for i in range(0, ndata):
        mtlist[i].Norm = 1

# bin in magnitude
binx = 0.5 * (args.x01[0] + args.x01[1])
biny = 0.5 * (args.y01[0] + args.y01[1])
binz = 0.5 * (args.z01[0] + args.z01[1])
(binlist1, ninside) = EB.binMT_mag(mtlist, args.m01[0], args.m01[1], args.nm,
                                   NP.array([binx, biny, binz]))
예제 #5
0
args = parser.parse_args()

#------------------------------

# check some info was provided
if args.ifile.isatty():
    print >> sys.stderr, "Error: No ifile and nothing in stdin. Exiting..."
    sys.exit()

# read the moment tensors
if( args.ifmt == 1 ):
    if( args.isVb ): sys.stderr.write('Reading Strike/dip/rake.\n' )
    (mtlist, alltxt) = IO.read_sdrlist( args.ifile )
else:
    (mtlist, alltxt) = IO.read_psmecalist( args.ifile , isEig=True )

ndata = len(mtlist)
if( args.isVb ): sys.stderr.write('%i events read in.\n' % ndata )

# convert min plunge to min abs val of z component
if( args.pmin != None ):
    if( args.isVb ): sys.stderr.write('p_min = %f.\n' % args.pmin )
    minZ = sin(abs(args.pmin)*pi/180)
    if( args.isVb ): sys.stderr.write('minZ = %f.\n' % minZ )
else:
    # no oblique category if pmin is not defined
    minZ = 0.0


# loop through each tensor
예제 #6
0
파일: mtInfo.py 프로젝트: iwbailey/pythMT
                  help="Get M_rr/max(P,T)")

parser.add_argument("-v" , "--verbose", action="store_true", dest="isVb", default=False,
                    help="Verbose output")

args=parser.parse_args()

#--------------------------------------------------

# check some info was provided
if args.ifile.isatty():
    print >> sys.stderr, "Error: No ifile and nothing in stdin. Exiting..."
    sys.exit()

# read the input into moment tensors
(mtlist, alltxt) = read_psmecalist( args.ifile )

# loop through all
n = len(mtlist)
if( args.isVb ): print "Read %i moment tensors" % n

sth=False # flag so we write a new line

for i in range(0,n):
    
    # output the original line 
    if args.isPaste:
        sth = True
        args.ofile.write( "%s " % alltxt[i] )
    if args.pos: 
        # output the position