def TimingModel(coefficients=False, name="linear_timing_model", use_svd=False, normed=True): """Class factory for marginalized linear timing model signals.""" if normed is True: basis = utils.normed_tm_basis() elif isinstance(normed, np.ndarray): basis = utils.normed_tm_basis(norm=normed) elif use_svd is True: if normed is not True: msg = "use_svd == True is incompatible with normed != True" raise ValueError(msg) basis = utils.svd_tm_basis() else: basis = utils.unnormed_tm_basis() prior = utils.tm_prior() BaseClass = BasisGP(prior, basis, coefficients=coefficients, name=name) class TimingModel(BaseClass): signal_type = "basis" signal_name = "linear timing model" signal_id = name + "_svd" if use_svd else name if coefficients: def _get_coefficient_logprior(self, key, c, **params): # MV: probably better to avoid this altogether # than to use 1e40 as in get_phi return 0 return TimingModel
def get_timing_model_basis(use_svd=False, normed=True): if use_svd: if normed is not True: raise ValueError("use_svd == True requires normed == True") return utils.svd_tm_basis() elif normed is True: return utils.normed_tm_basis() elif normed is not False: return utils.normed_tm_basis(norm=normed) else: return utils.unnormed_tm_basis()