Commit 9f9aee18 authored by Sebastian Heimann's avatar Sebastian Heimann

py3 + cleanup

parent d1363d8d
......@@ -387,11 +387,11 @@ class Dataset(object):
elif quantity == 'velocity':
candidates.append(trace.MultiplyResponse([
x.response,
tarce.DifferentiationResponse()]))
trace.DifferentiationResponse()]))
elif quantity == 'acceleration':
candidates.append(trace.MultiplyResponse([
x.response,
tarce.DifferentiationResponse(2)]))
trace.DifferentiationResponse(2)]))
else:
assert False
......
......@@ -251,10 +251,9 @@ class Chains(object):
self, problem, history, nchains, nlinks_cap,
bootstrap_weights):
self.optimizer = optimizer
self.problem = problem
self.history = history
self.nchains = optimizer.nbootstrap + 1
self.nchains = nchains
self.nlinks_cap = nlinks_cap
self.chains_m = num.zeros(
(self.nchains, nlinks_cap), num.float)
......@@ -262,6 +261,7 @@ class Chains(object):
(self.nchains, nlinks_cap), num.int)
self.nlinks = 0
self.accept_sum = num.zeros(self.nchains, dtype=num.int)
self.extend(0, history.nmodels, history.models)
history.add_listener(self)
self.bootstrap_weights = num.vstack((
......
......@@ -4,7 +4,7 @@ import numpy as num
from matplotlib import pyplot as plt
from pyrocko.plot import mpl_init, mpl_margins
from grond import plot
from grond import plot, core
class HighScoreOptimizerPlot(object):
......@@ -99,9 +99,9 @@ class HighScoreOptimizerPlot(object):
self.writer.setup(self.fig, self.movie_filename, dpi=200)
#if self.show:
#plt.ion()
#plt.show()
# if self.show:
# plt.ion()
# plt.show()
def set_limits(self):
self.axes.set_xlim(*self.xlim)
......@@ -248,11 +248,10 @@ class HighScoreOptimizerPlot(object):
if self.show:
plt.show()
#plt.ioff()
# plt.ioff()
def render(self):
self.start()
self.draw_frame(100)
self.finish()
......@@ -188,7 +188,7 @@ class Problem(Object):
def random_uniform(self, xbounds):
x = []
for i in xrange(self.nparameters):
for i in range(self.nparameters):
x.append(num.random.uniform(xbounds[i, 0], xbounds[i, 1]))
return num.array(x, dtype=num.float)
......
......@@ -137,7 +137,7 @@ def scenario(station_setup, noise_setup):
east=float(easts[i]),
depth=float(depths[i]),
obs_distance=float(measured_distances[i]))
for i in xrange(n)]
for i in range(n)]
return source, targets
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment