def fit_params(self, rfl_meas, Ls, geom): '''Given a reflectance estimate and one or more emissive parameters, fit a state vector.''' glint_band = s.argmin(abs(900-self.wl)) glint = s.mean(rfl_meas[(glint_band-2):glint_band+2]) water_band = s.argmin(abs(400-self.wl)) water = s.mean(rfl_meas[(water_band-2):water_band+2]) if glint > 0.05 or water < glint: glint = 0 glint = max(self.bounds[self.glint_ind][0]+eps, min(self.bounds[self.glint_ind][1]-eps, glint)) lamb_est = rfl_meas - glint x = MultiComponentSurface.fit_params(self, lamb_est, Ls, geom) x[self.glint_ind] = glint return x
def fit_params(self, rfl_meas, Ls, geom): '''Given a reflectance estimate and one or more emissive parameters, fit a state vector.''' def err(z): T, bb_frac = z emissivity = s.ones(self.n_wl, dtype=float) Ls_est, d = emissive_radiance(emissivity, T, self.wl) resid = Ls_est * bb_frac - Ls return sum(resid**2) x_surface = MultiComponentSurface.fit_params(self, rfl_meas, Ls, geom) T, bb_frac = minimize(err, s.array([300, 0.1])).x bb_frac = max(eps, min(bb_frac, 1.0-eps)) T = max(self.bounds[-2][0]+eps, min(T, self.bounds[-2][1]-eps)) x_surface[self.bb_frac_ind] = bb_frac x_surface[self.surf_temp_ind] = T return x_surface