def dmeas_dinstrumentb(self, x_instrument, wl_hi, rdn_hi): """Jacobian of radiance with respect to the instrument parameters that are unknown and not retrieved, i.e. the inevitable persisting uncertainties in instrument spectral and radiometric calibration. Input: meas, a vector of size n_chan Returns: Kb_instrument, a matrix of size [n_measurements x nb_instrument]""" # Uncertainty due to radiometric calibration meas = self.sample(x_instrument, wl_hi, rdn_hi) dmeas_dinstrument = s.hstack( (s.diagflat(meas), s.zeros((self.n_chan, 2)))) # Uncertainty due to spectral calibration if self.bval[-2] > 1e-6: dmeas_dinstrument[:, -2] = self.sample( x_instrument, wl_hi, s.hstack((s.diff(rdn_hi), s.array([0])))) # Uncertainty due to spectral stray light if self.bval[-1] > 1e-6: ssrf = srf(s.arange(-10, 11), 0, 4) blur = convolve(meas, ssrf, mode='same') dmeas_dinstrument[:, -1] = blur - meas return dmeas_dinstrument
def dLs_dsurface(self, x_surface, geom): '''Emission at surface includes fluorescence (here, a Gaussian)''' dLs = s.zeros((len(self.wl), len(self.statevec))) ngauss = srf(self.wl, self.fl_mu, self.fl_sigma) ngauss = ngauss/max(ngauss) dLs[:, self.flh_ind] = ngauss return dLs
def sample(self, x_instrument, wl_hi, rdn_hi): """ Apply instrument sampling to a radiance spectrum, returning the predicted measurement""" if self.calibration_fixed and all((self.wl_init - wl_hi) < wl_tol): return rdn_hi wl, fwhm = self.calibration(x_instrument) if rdn_hi.ndim == 1: return resample_spectrum(rdn_hi, wl_hi, wl, fwhm) else: resamp = [] # The "fast resample" option approximates a complete resampling # by a convolution with a uniform FWHM. if self.fast_resample: for i, r in enumerate(rdn_hi): ssrf = srf(s.arange(-10, 11), 0, fwhm[0]) blur = convolve(r, ssrf, mode='same') resamp.append(interp1d(wl_hi, blur)(wl)) else: for i, r in enumerate(rdn_hi): r2 = resample_spectrum(r, wl_hi, wl, fwhm) resamp.append(r2) return s.array(resamp)
def calc_Ls(self, x_surface, geom): '''Emission at surface includes fluorescence (here, a Gaussian)''' ngauss = srf(self.wl, self.fl_mu, self.fl_sigma) ngauss = ngauss/max(ngauss) return ngauss * x_surface[self.flh_ind]