diff --git a/prospect/likelihood/noise_model.py b/prospect/likelihood/noise_model.py index 1fe0a044..a7166a67 100644 --- a/prospect/likelihood/noise_model.py +++ b/prospect/likelihood/noise_model.py @@ -37,6 +37,9 @@ def update(self, **params): def lnlike(self, pred, obs, vectors={}): + if obs.flux is None: + return 0 + # populatate vectors used as metrics and weight functions. vectors = self.populate_vectors(obs) # Construct Sigma (and factorize if 2d) diff --git a/prospect/observation/observation.py b/prospect/observation/observation.py index 0062db13..75596882 100644 --- a/prospect/observation/observation.py +++ b/prospect/observation/observation.py @@ -101,9 +101,24 @@ def rectify(self): uncertainties. """ n = self.__repr__ - if self.flux is None: - print(f"{n} has no data") - return + + _flux_array = False + try: + len(self.flux) + _flux_array = True + except: + _flux_array = False + + if _flux_array: + if self.flux is None: + print(f"{n} has no data") + return + else: + if self.flux == None: + print(f"{n} has no data") + self.flux = None + self.wavelength = None + return assert self.flux.ndim == 1, f"{n}: flux is not a 1d array" assert self.uncertainty.ndim == 1, f"{n}: uncertainty is not a 1d array" @@ -331,7 +346,10 @@ def __init__(self, self.resolution = resolution self.response = response self.instrument_smoothing_parameters = dict(smoothtype="vel", fftsmooth=True) - self.wavelength = np.atleast_1d(wavelength) + if wavelength is not None: + self.wavelength = np.atleast_1d(wavelength) + else: + self.wavelength = None @property def wavelength(self):