vs = np.linspace(2.5, 5., 100) vpvs = [1.81, 1.73, 1.65] px = [3.7, 3.8, 3.75] rd = {} with open(regionf, 'r') as f: j = json.load(f) for k in j.keys(): rd[k] = {} rd[k]['H'] = j[k]['kanamori']['H'] rd[k]['Vp'] = j[k]['crust1']['Vp'] rd[k]['R'] = j[k]['kanamori']['R'] rd[k]['Vs'] = rd[k]['Vp'] / rd[k]['R'] rd[k]['poisson'] = poisson(rd[k]['R']) #print '['+'"'+k+'"'+','+'np.array(['+str(rd[k]['Vp'])+','+str(rd[k]['poisson'])+'])],' legc = { "Canada": ["o", "b"], "Slave Province": ["^", "b"], "Grenville Province": ["^", "g"], "Churchill Province": ["^", "r"], "Superior Province": ["^", "c"], "Canadian Shield": ["o", "g"], "Platforms": ["o", "r"], "Orogens": ["o", "c"], "Proterozoic": ["D", "b"], "Archean": ["D", "g"] }
if __name__== '__main__' : reverse = False if len(sys.argv) == 2: if sys.argv[1] == '-r': reverse = True else: numbers = [sys.argv[1]] if len(sys.argv) == 3: if sys.argv[1] == '-r': reverse = True numbers = [sys.argv[2]] if sys.stdin.isatty(): pass else: # trick to get all floats out of list numbers = re.findall(r'[-+]?[0-9]*\.?[0-9]+', sys.stdin.read() ) numbers = map(float, numbers) for n in numbers: print poisson(n, reverse)
vs = np.linspace(2.5, 5., 100) vpvs = [1.81, 1.73, 1.65] px = [3.7, 3.8, 3.75] rd = {} with open(regionf, 'r') as f: j = json.load(f) for k in j.keys(): rd[k] = {} rd[k]['H'] = j[k]['kanamori']['H'] rd[k]['Vp'] = j[k]['crust1']['Vp'] rd[k]['R'] = j[k]['kanamori']['R'] rd[k]['Vs'] = rd[k]['Vp'] / rd[k]['R'] rd[k]['poisson'] = poisson(rd[k]['R']) #print '['+'"'+k+'"'+','+'np.array(['+str(rd[k]['Vp'])+','+str(rd[k]['poisson'])+'])],' legc = {"Canada": ["o","b"], "Slave Province": ["^","b"], "Grenville Province": ["^","g"], "Churchill Province": ["^","r"], "Superior Province": ["^","c"], "Canadian Shield":["o","g"], "Platforms": ["o","r"], "Orogens": ["o","c"], "Proterozoic": ["D","b"], "Archean": ["D","g"]} order = ["Canada", "Slave Province", "Grenville Province",