def calc_marg_stats(self, *params): """ Calculate the marginal density and Jacobian vs. nonlinear parameters and memoize the results. """ if (params == self.pars): return self.Q, self.suf, self.Jac #... Evaluate the standardized models on the data, first calling the setup #... function for the data if it is present. args = list(params) args.append(self.absc) args = tuple(args) if (self.setup != None): aux = self.setup(*args) args = list(args) args.append(aux) args = tuple(args) for a in range(self.M): g = self.basis[a] self.modvals[a,:] = g(*args) / self.sigs #... Calculate the metric and various derived quantities. Store them #... for possible future use before returning. self.metric, self.L, self.Jac, self.proj, self.ampl, self.suf =\ vba.metricAnalysis(self.modvals, self.std_smpls) self.Q = self.dsqr - self.suf self.pars = params self.Jac = 1. / self.Jac
def calc_marg_stats(self, *params): """ Calculate the marginal density and Jacobian vs. nonlinear parameters and memoize the results. """ if (params == self.pars): return self.Q, self.suf, self.Jac #... Evaluate the standardized models on the data, first calling the setup #... function. self.obj.set_nonlin(*params) for a in range(self.M): self.modvals[a,:] = self.obj.std_basis[a]() #... Calculate the metric and various derived quantities. Store them #... for possible future use before returning. self.metric, self.L, self.Jac, self.proj, self.ampl, self.suf =\ vba.metricAnalysis(self.modvals, self.obj.std_smpls) self.Q = self.dsqr - self.suf self.pars = params self.Jac = 1. / self.Jac