Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added lifesim/gui/JWST_localzodi.npy
Binary file not shown.
6 changes: 6 additions & 0 deletions lifesim/instrument/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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):
"""
Expand Down
26 changes: 25 additions & 1 deletion lifesim/instrument/pn_localzodi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lifesim/util/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down