From 8672c46f6d69bee4d4119f3eeb395b521e7b6521 Mon Sep 17 00:00:00 2001 From: Joel Leja Date: Wed, 3 Jun 2020 17:15:35 -0400 Subject: [PATCH] PhotoCal model for correlated photometric noise --- prospect/fitting/fitting.py | 3 ++- prospect/likelihood/kernels.py | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/prospect/fitting/fitting.py b/prospect/fitting/fitting.py index 7fb61739..b1a273f5 100644 --- a/prospect/fitting/fitting.py +++ b/prospect/fitting/fitting.py @@ -99,7 +99,8 @@ def lnprobfn(theta, model=None, obs=None, sps=None, noise=(None, None), sigma_spec = spec_noise.construct_covariance(**vectors) if phot_noise is not None: phot_noise.update(**model.params) - vectors.update({'phot_unc': obs.get('maggies_unc', None)}) + vectors.update({'phot_unc': obs.get('maggies_unc', None), + 'phot': obs.get('maggies', None)}) # --- Generate mean model --- try: diff --git a/prospect/likelihood/kernels.py b/prospect/likelihood/kernels.py index 790f40b8..c5bda9fc 100644 --- a/prospect/likelihood/kernels.py +++ b/prospect/likelihood/kernels.py @@ -1,6 +1,6 @@ import numpy as np -__all__ = ["Kernel", "Uncorrelated", "ExpSquared", "Matern"] +__all__ = ["Kernel", "Uncorrelated", "ExpSquared", "Matern", "PhotoCal"] class Kernel(object): @@ -94,8 +94,16 @@ def construct_kernel(self, metric): return Sigma -class Outliers(Kernel): - kernel_params = ['amplitude', 'location'] +class PhotoCal(Kernel): + ndim = 2 + npars = 2 + kernel_params = ['amplitude', 'filter_names'] + def construct_kernel(self, metric): - raise(NotImplementedError) + """ This adds correlated noise in specified bands of photometry + """ + k = np.array([f in self.params["filter_names"] for f in metric]) + K = k[:, None] * k[None, :] # select off-diagonal elements + return K * self.params["amplitude"]**2 +