# 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]) )
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):
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
# 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]))
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
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