diff --git a/lifesim/gui/JWST_localzodi.npy b/lifesim/gui/JWST_localzodi.npy new file mode 100644 index 0000000..eb9abe2 Binary files /dev/null and b/lifesim/gui/JWST_localzodi.npy differ diff --git a/lifesim/instrument/instrument.py b/lifesim/instrument/instrument.py index e6d24e4..4806a9d 100644 --- a/lifesim/instrument/instrument.py +++ b/lifesim/instrument/instrument.py @@ -56,6 +56,9 @@ class Instrument(InstrumentModule): data.inst['radius_map'] : np.ndarray A map used for speeding up calculations. Contains the distance of a pixel from the center of the detector in [pix]. + data.inst['jwst_localzodi'] : np.ndarray + Pre-calculated localzodi background for whole sky, at integer wavelengths (3-20 microns) + in [photons/(sr m s)]. E.g. [k, :, :] provides skymap for wavelength of k+3 microns """ def __init__(self, @@ -117,6 +120,9 @@ def apply_options(self): r_square_map = ((x_map - (self.data.options.other['image_size'] - 1) / 2) ** 2 + (y_map - (self.data.options.other['image_size'] - 1) / 2) ** 2) self.data.inst['radius_map'] = np.sqrt(r_square_map) + + # load localzodi background data for calculations with jwst model + self.data.inst['jwst_localzodi'] = np.load('JWST_localzodi.npy') def get_wl_bins_const_spec_res(self): """ diff --git a/lifesim/instrument/pn_localzodi.py b/lifesim/instrument/pn_localzodi.py index d83503c..0e5030e 100644 --- a/lifesim/instrument/pn_localzodi.py +++ b/lifesim/instrument/pn_localzodi.py @@ -84,7 +84,8 @@ def noise(self, # check if the model exists if not ((self.data.options.models['localzodi'] == 'glasse') - or (self.data.options.models['localzodi'] == 'darwinsim')): + or (self.data.options.models['localzodi'] == 'darwinsim') + or (self.data.options.models['localzodi'] == 'jwst')): raise ValueError('Specified model does not exist') # fix the longitude of the observation. Since the simulation is static in time (planets not @@ -103,6 +104,29 @@ def noise(self, bins=self.data.inst['wl_bins'], width=self.data.inst['wl_bin_widths'], temp=temp) + + elif self.data.options.models['localzodi'] == 'jwst': + + # longitude dependence available for this model: + if index is None: + long = self.data.single['lon'] + else: + long = self.data.catalog.lon.iloc[index] + + # index math to get correct datapoint from JWST_localzodi.npy + lat_ind = round(150. - 299.*lat/np.pi) + long_ind = round(299.*long/(2*np.pi)) + wl_up = np.ceil(self.data.inst['wl_bins']*1e6).astype(int) + + # linear interpolation, as values are only avalilable for int wavelengths, 3-20microns + lz_flux_sr = (self.data.inst['wl_bins']*1e6 - wl_up + 1) \ + * self.data.inst['jwst_localzodi'][wl_up-4, long_ind, lat_ind] \ + + (wl_up - self.data.inst['wl_bins']*1e6) \ + * self.data.inst['jwst_localzodi'][wl_up-3, long_ind, lat_ind] + + # integrate over bin width + lz_flux_sr *= self.data.inst['wl_bin_widths'] + else: radius_sun_au = 0.00465047 # in AU diff --git a/lifesim/util/options.py b/lifesim/util/options.py index 9688342..c11ea70 100644 --- a/lifesim/util/options.py +++ b/lifesim/util/options.py @@ -40,8 +40,8 @@ class Options(object): - ``'n_plugins'`` : Number of sockets the instrument class will feature. models : dict Options concerning different models used in the simulation. They are - - ``'localzodi'`` : Model for the localzodi, possible options are ``'glasse'`` and - ``'darwinsim'`` + - ``'localzodi'`` : Model for the localzodi, possible options are ``'glasse'``, + ``'darwinsim'`` and ``'jwst'``. - ``'habitable'`` : Model used for calculating the habitable zone, possible options are ``'MS'`` and ``'POST_MS'`` optimization : dict