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)]
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