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

py3 + cleanup

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