def get_synthetics(self, point, **kwargs): """ Get synthetics for given point in solution space. Parameters ---------- point : :func:`pymc3.Point` Dictionary with model parameters kwargs especially to change output of the forward model Returns ------- list with :class:`numpy.ndarray` synthetics for each target """ tpoint = copy.deepcopy(point) tpoint.update(self.fixed_rvs) spoint, bpoint = seperate_point(tpoint) self.point2sources(spoint) synths = [] for target, data in zip(self.targets, self.datasets): disp = geo_backslip_synthetics(engine=self.engine, sources=self.sources, targets=[target], lons=target.lons, lats=target.lats, reference=self.event, **bpoint) synths.append((disp * data.los_vector).sum(axis=1)) return synths
def perform(self, node, inputs, output): """ Perform method of the Operator to calculate synthetic displacements. Parameters ---------- inputs : list of :class:`numpy.ndarray` output : list of synthetic displacements of :class:`numpy.ndarray` (n x 3) """ z = output[0] point = {vname: i for vname, i in zip(self.varnames, inputs)} point.update(self.fixed_values) point = utility.adjust_point_units(point) spoint, bpoint = interseismic.seperate_point(point) source_points = utility.split_point(spoint) for i, source_point in enumerate(source_points): self.sources[i].update(**source_point) z[0] = interseismic.geo_backslip_synthetics( engine=self.engine, targets=self.targets, sources=self.sources, lons=num.array(self.lons), lats=num.array(self.lats), reference=self.reference, **bpoint) def infer_shape(self, node, input_shapes): return [(len(self.lats), 3)]
self._get_synthetic_data() return interseismic.geo_block_synthetics(lons=self.lons, lats=self.lats, sources=self._get_sources(), amplitude=self.amplitude, azimuth=self.azimuth, reference=self.reference) def _test_backslip_synthetics(self, case=1): if self.reference is None: self._get_synthetic_data() return interseismic.geo_backslip_synthetics( store_superdir=self._get_store_superdir(), crust_ind=0, sources=self._get_sources(case), lons=self.lons, lats=self.lats, reference=self.reference, amplitude=self.amplitude, azimuth=self.azimuth, locking_depth=self.locking_depth) def _old_test_plot_synthetics(self): from matplotlib import pyplot as plt fig, ax = plt.subplots(nrows=1, ncols=3, figsize=plot.mpl_papersize('a4', 'portrait'))