self._source = source
self._targets = targets
self._contour_data = contour_data
self.axes.set_xlim(-10., 10.) self.axes.set_ylim(-10., 10.)
HighScoreOptimiserPlot.start(self) x = [getattr(t, self.xpar_name) for t in self._targets] y = [getattr(t, self.ypar_name) for t in self._targets] self.axes.plot(x, y, '^', color='black')
for ibootstrap, (xc, yc, zc) in enumerate( self._contour_data['east', 'depth']):
zmin = num.min(zc)
if self.optimiser.nbootstrap < 5: alpha = 1.0 else: alpha = 0.5
self.axes.contour( xc, yc, zc, [zmin + 0.01], colors=[self.bcolors[ibootstrap]], alpha=alpha)
self.axes.plot( getattr(self._source, self.xpar_name), getattr(self._source, self.ypar_name), '*', color='black')
Parameter('north', 'm', label='North'), Parameter('east', 'm', label='East'), Parameter('depth', 'm', label='Depth')]
return num.array( [source.north, source.east, source.depth], dtype=num.float)
[(t.north, t.east, t.depth) for t in self.targets], dtype=num.float)
[t.obs_distance for t in self.targets], dtype=num.float)
raise NotImplementedError('Toy problem does not have evaluate()')
num.sum((x[num.newaxis, :]-self._xtargets)**2, axis=1))
* num.mean(num.abs(self._obs_distances))
num.sum( (xs[:, num.newaxis, :]-self._xtargets[num.newaxis, :])**2, axis=2))
distances - self._obs_distances[num.newaxis, :])
base_source = self.base_source return num.array([ base_source.north, base_source.east, base_source.depth])
if xs.ndim == 1: return self.extract(xs[num.newaxis, :], i)[0]
if i < self.nparameters: return xs[:, i] else: return self.make_dependant( xs, self.dependants[i-self.nparameters].name)
north=snorth, east=seast, depth=sdepth)
elif station_setup == 'illposed': easts = num.random.uniform(0, 10., n) else: assert False
(norths-snorth)**2 + (easts-seast)**2 + (depths-sdepth)**2)
elif noise_setup == 'lownoise': measured_distances = distances + num.random.normal(scale=0.4, size=n) elif noise_setup == 'highnoise': measured_distances = distances + num.random.normal(scale=0.8, size=n)
ToyTarget( path='t%03i' % i, north=float(norths[i]), east=float(easts[i]), depth=float(depths[i]), obs_distance=float(measured_distances[i])) for i in range(n)]
ToyTarget ToySource ToyProblem scenario '''.split() |