Adds NEDT instrument noise model
@@ -25,7 +25,7 @@ from scipy.signal import convolve
from scipy.io import loadmat
from numpy.random import multivariate_normal as mvn
-from .common import eps, srf, load_wavelen, resample_spectrum
+from .common import eps, srf, load_wavelen, resample_spectrum, emissive_radiance
### Variables ###
@@ -71,9 +71,6 @@ class Instrument:
self.prior_mean = s.array(self.prior_mean)
self.n_state = len(self.statevec)
- # Number of integrations comprising the measurement. Noise diminishes
- # with the square root of this number.
- self.integrations = config['integrations']
if 'SNR' in config:
@@ -99,6 +96,9 @@ class Instrument:
fill_value='extrapolate') for col in (1, 2, 3)]
self.noise = s.array([[p_a(w), p_b(w), p_c(w)]
for w in self.wl_init])
+ # Number of integrations comprising the measurement. Noise diminishes
+ # with the square root of this number.
+ self.integrations = config['integrations']
elif 'pushbroom_noise_file' in config:
# The third option is a full pushbroom noise model that
@@ -113,6 +113,21 @@ class Instrument:
raise ValueError('Noise model mismatches wavelength # bands')
cshape = ((self.ncols, self.n_chan, self.n_chan))
self.covs = D['covariances'].reshape(cshape)
+ # Number of integrations comprising the measurement. Noise diminishes
+ # with the square root of this number.
+ self.integrations = config['integrations']
+
+ elif 'NEDT_noise_file' in config:
+ self.model_type = 'NEDT'
+ self.noise_file = config['NEDT_noise_file']
+ self.noise_data = s.loadtxt(self.noise_file, delimiter = ',', skiprows = 8)
+ noise_data_w_nm = self.noise_data[:,0] * 1000
+ noise_data_NEDT = self.noise_data[:,1]
+ nedt = interp1d(noise_data_w_nm, noise_data_NEDT)(self.wl_init)
+
+ T, emis = 300., 1.
+ _, drdn_dT = emissive_radiance(emis, T, self.wl_init)
+ self.noise_NESR = nedt * drdn_dT
else:
logging.error('Instrument noise not defined.')
@@ -205,6 +220,9 @@ class Instrument:
C = self.covs[geom.pushbroom_column, :, :]
return C / s.sqrt(self.integrations)
+ elif self.model_type == 'NEDT':
+ return pow(s.diagflat(self.noise_NESR), 2)
+
def dmeas_dinstrument(self, x_instrument, wl_hi, rdn_hi):
"""Jacobian of measurement with respect to the instrument
free parameter state vector. We use finite differences for now."""
