Skip to content

Commit

Permalink
Merge pull request #182 from jrleja/phot_outlier
Browse files Browse the repository at this point in the history
PhotoCal model for correlated photometric noise
  • Loading branch information
bd-j authored Jun 9, 2020
2 parents 9d34c31 + 8672c46 commit 629674b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
3 changes: 2 additions & 1 deletion prospect/fitting/fitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
16 changes: 12 additions & 4 deletions prospect/likelihood/kernels.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np

__all__ = ["Kernel", "Uncorrelated", "ExpSquared", "Matern"]
__all__ = ["Kernel", "Uncorrelated", "ExpSquared", "Matern", "PhotoCal"]


class Kernel(object):
Expand Down Expand Up @@ -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

0 comments on commit 629674b

Please sign in to comment.